Fix 1bpp -> 16bpp image conversion.
authorPavel Tsekov <ptsekov@open.bg>
Thu, 14 Aug 2014 17:09:12 +0000 (20:09 +0300)
committerPavel Tsekov <ptsekov@open.bg>
Thu, 14 Aug 2014 17:09:12 +0000 (20:09 +0300)
* libfreerdp/codec/color.c (freerdp_mono_image_convert): Update the
1bpp -> 16bpp conversion code to reflect the fact that the foreground
and the background colors are in GDI representation now.

libfreerdp/codec/color.c

index 365bdde..2c1c8c2 100644 (file)
@@ -1121,25 +1121,6 @@ BYTE* freerdp_mono_image_convert(BYTE* srcData, int width, int height, int srcBp
 
        if (dstBpp == 16)
        {
-               if (clrconv->rgb555)
-               {
-                       if (srcBpp == 16)
-                       {
-                               /* convert 15-bit colors to 16-bit colors */
-                               RGB16_RGB15(redBg, greenBg, blueBg, bgcolor);
-                               RGB16_RGB15(redFg, greenFg, blueFg, fgcolor);
-                       }
-               }
-               else
-               {
-                       if (srcBpp == 15)
-                       {
-                               /* convert 15-bit colors to 16-bit colors */
-                               RGB15_RGB16(redBg, greenBg, blueBg, bgcolor);
-                               RGB15_RGB16(redFg, greenFg, blueFg, fgcolor);
-                       }
-               }
-
                dstData = (BYTE*) _aligned_malloc(width * height * 2, 16);
 
                if (!dstData)
@@ -1147,6 +1128,17 @@ BYTE* freerdp_mono_image_convert(BYTE* srcData, int width, int height, int srcBp
 
                dst16 = (UINT16*) dstData;
 
+               if (clrconv->rgb555)
+               {
+                       bgcolor = clrconv->invert ? BGR15(redBg, greenBg, blueBg) : RGB15(redBg, greenBg, blueBg);
+                       fgcolor = clrconv->invert ? BGR15(redFg, greenFg, blueFg) : RGB15(redFg, greenFg, blueFg);
+               }
+               else
+               {
+                       bgcolor = clrconv->invert ? BGR16(redBg, greenBg, blueBg) : RGB16(redBg, greenBg, blueBg);
+                       fgcolor = clrconv->invert ? BGR16(redFg, greenFg, blueFg) : RGB16(redFg, greenFg, blueFg);
+               }
+
                for (index = height; index > 0; index--)
                {
                        /* each bit encodes a pixel */