Ignore alpha channel in freerdp_image_copy

When copying image data consider formats that only differ on use
of alpha data equal. This allows using the optimized copy routine
instead of the slower color conversion routine. Fixes #3616
This commit is contained in:
Armin Novak 2016-11-24 09:27:19 +01:00
parent 812def37f1
commit 1c4c57821b
2 changed files with 9 additions and 1 deletions

View File

@ -100,6 +100,14 @@ typedef struct gdi_palette gdiPalette;
extern "C" {
#endif
/* Compare two color formats but ignore differences in alpha channel.
*/
static INLINE DWORD AreColorFormatsEqualNoAlpha(DWORD first, DWORD second)
{
const DWORD mask = ~(8 << 12);
return (first & mask) == (second & mask);
}
/* Color Space Conversions: http://msdn.microsoft.com/en-us/library/ff566496/ */
/***

View File

@ -438,7 +438,7 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
srcVMultiplier = -1;
}
if (SrcFormat == DstFormat)
if (AreColorFormatsEqualNoAlpha(SrcFormat, DstFormat))
{
INT32 y;