Mercurial > mplayer.hg
diff gui/util/bitmap.c @ 33534:22c3241467b3
Remove function Normalize().
This function changed ARGB data as if it had been RGB24 data (not quite
correctly) converted to ARGB with all colors transparent.
Instead now, set the alpha channel for RGB24 data and leave ARGB data
untouched.
For X11, the alpha channel is disregarded, so both approaches are equal,
but the new one is more intelligible as we get correct ARGB PNG data.
For legacy reasons, all kind of fuchsia/magenta must be treated as
transparent, because some skins are using at least both full opaque and
full transparent fuchsia/magenta for transparency.
author | ib |
---|---|
date | Thu, 16 Jun 2011 11:19:15 +0000 |
parents | fd90a10d81a1 |
children | c5a19bbeac2b |
line wrap: on
line diff
--- a/gui/util/bitmap.c Thu Jun 16 09:27:31 2011 +0000 +++ b/gui/util/bitmap.c Thu Jun 16 11:19:15 2011 +0000 @@ -156,7 +156,7 @@ mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[bitmap] 32 bpp conversion size: %lu\n", bf->ImageSize); for (c = 0, i = 0; c < bf->ImageSize; c += 4, i += 3) - *(uint32_t *)&bf->Image[c] = AV_RB24(&orgImage[i]); + *(uint32_t *)&bf->Image[c] = ALPHA_OPAQUE | AV_RB24(&orgImage[i]); free(orgImage); } @@ -164,18 +164,6 @@ return 1; } -static void Normalize(txSample *bf) -{ - unsigned long i; - - for (i = 0; i < bf->ImageSize; i += 4) -#if HAVE_BIGENDIAN - bf->Image[i] = 0; -#else - bf->Image[i + 3] = 0; -#endif -} - static unsigned char *fExist(unsigned char *fname) { static const char ext[][4] = { "png", "PNG" }; @@ -219,8 +207,6 @@ if (!Convert24to32(bf)) return -8; - Normalize(bf); - return 0; } @@ -254,7 +240,7 @@ for (i = 0; i < out->Width * out->Height; i++) { tmp >>= 1; - if (buf[i] != TRANSPARENT) + if (!IS_TRANSPARENT(buf[i])) tmp |= 0x80; else { buf[i] = 0;