diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-07-11 13:36:02 +0000 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-11-02 04:14:43 +0200 |
commit | 95db5dd48c3b7cf3e4866fa35c9566e93a128c72 (patch) | |
tree | b9a41e4dd389dc1055bdf58a3188f6524e35dce2 /spudec.c | |
parent | e73ff7ae70dc92667e3fded14889aff41ae49ba1 (diff) | |
download | mpv-95db5dd48c3b7cf3e4866fa35c9566e93a128c72.tar.bz2 mpv-95db5dd48c3b7cf3e4866fa35c9566e93a128c72.tar.xz |
spudec: Fix conversion from paletted to MPlayer's OSD format
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31705 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'spudec.c')
-rw-r--r-- | spudec.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -1309,10 +1309,12 @@ void spudec_set_paletted(void *this, const uint8_t *pal_img, int pal_stride, for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { uint32_t pixel = pal[pal_img[x]]; - *aimg++ = -(pixel >> 24); - *img++ = (((pixel & 0x000000ff) >> 0) + - ((pixel & 0x0000ff00) >> 7) + - ((pixel & 0x00ff0000) >> 16)) >> 2; + int alpha = pixel >> 24; + int gray = (((pixel & 0x000000ff) >> 0) + + ((pixel & 0x0000ff00) >> 7) + + ((pixel & 0x00ff0000) >> 16)) >> 2; + *aimg++ = -alpha; + *img++ = FFMIN(gray, alpha); } for (; x < stride; x++) *aimg++ = *img++ = 0; |