From: Armin Novak Date: Tue, 1 Sep 2015 07:25:41 +0000 (+0200) Subject: Ignore AND mask for 32 bit pointer. X-Git-Tag: 2.0.0-beta1+android10~445^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=89227b97f03c240607b122029bdfaf4e373c906f;p=platform%2Fupstream%2Ffreerdp.git Ignore AND mask for 32 bit pointer. --- diff --git a/libfreerdp/codec/color.c b/libfreerdp/codec/color.c index 6002140..97a0d0c 100644 --- a/libfreerdp/codec/color.c +++ b/libfreerdp/codec/color.c @@ -1569,9 +1569,13 @@ int freerdp_image_copy_from_pointer_data(BYTE* pDstData, UINT32 DstFormat, for (x = 0; x < nWidth; x++) { + BOOL ignoreAndMask = FALSE; + if (xorBpp == 32) { xorPixel = *((UINT32*) xorBits); + if (xorPixel & 0xFF000000) + ignoreAndMask = TRUE; } else if (xorBpp == 16) { @@ -1597,11 +1601,14 @@ int freerdp_image_copy_from_pointer_data(BYTE* pDstData, UINT32 DstFormat, if (!(andBit >>= 1)) { andBits++; andBit = 0x80; } } - if (andPixel) + /* Ignore the AND mask, if the color format already supplies alpha data. */ + if (andPixel && !ignoreAndMask) { - if (xorPixel == 0xFF000000) /* black */ + const UINT32 xorPixelMasked = xorPixel | 0xFF000000; + + if (xorPixelMasked == 0xFF000000) /* black */ *pDstPixel++ = 0x00000000; /* transparent */ - else if (xorPixel == 0xFFFFFFFF) /* white */ + else if (xorPixelMasked == 0xFFFFFFFF) /* white */ *pDstPixel++ = 0xFF000000; /* inverted (set as black) */ else *pDstPixel++ = xorPixel;