From 00c32f62d3845234f300d140ab5b987c3c1e1c9f Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Mon, 23 Jan 2017 09:26:56 +0100 Subject: [PATCH] Fixed alpha channel for color formats without. --- libfreerdp/codec/planar.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/libfreerdp/codec/planar.c b/libfreerdp/codec/planar.c index 07af15d48..585634b3d 100644 --- a/libfreerdp/codec/planar.c +++ b/libfreerdp/codec/planar.c @@ -250,18 +250,32 @@ static INLINE BOOL writeLine(BYTE** ppRgba, UINT32 DstFormat, UINT32 width, cons *(*ppRgba)++ = *(*ppB)++; *(*ppRgba)++ = *(*ppG)++; *(*ppRgba)++ = *(*ppR)++; - *(*ppRgba)++ = *(*ppA)++; + *(*ppRgba)++ = 0xFF; } return TRUE; default: - for (x = 0; x < width; x++) + if (ppA) { - BYTE alpha = (ppA) ? *(*ppA)++ : 0xFF; - UINT32 color = GetColor(DstFormat, *(*ppR)++, *(*ppG)++, *(*ppB)++, alpha); - WriteColor(*ppRgba, DstFormat, color); - *ppRgba += GetBytesPerPixel(DstFormat); + for (x = 0; x < width; x++) + { + BYTE alpha = *(*ppA)++; + UINT32 color = GetColor(DstFormat, *(*ppR)++, *(*ppG)++, *(*ppB)++, alpha); + WriteColor(*ppRgba, DstFormat, color); + *ppRgba += GetBytesPerPixel(DstFormat); + } + } + else + { + const BYTE alpha = 0xFF; + + for (x = 0; x < width; x++) + { + UINT32 color = GetColor(DstFormat, *(*ppR)++, *(*ppG)++, *(*ppB)++, alpha); + WriteColor(*ppRgba, DstFormat, color); + *ppRgba += GetBytesPerPixel(DstFormat); + } } return TRUE;