libfreerdp-gdi: fix 16bpp glyph drawing
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Sun, 8 Jan 2012 22:43:07 +0000 (17:43 -0500)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Sun, 8 Jan 2012 22:43:07 +0000 (17:43 -0500)
libfreerdp-gdi/16bpp.c

index 2d670eb..44c121c 100644 (file)
@@ -368,9 +368,9 @@ static int BitBlt_SRCPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW
 static int BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
 {      
        int x, y;
-       uint16* srcp;
+       uint8* srcp;
        uint16* dstp;
-       uint16* patp;
+       uint16 src16;
        uint16 color16;
        HGDI_BITMAP hSrcBmp;
 
@@ -380,7 +380,6 @@ static int BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
        color16 = gdi_get_color_16bpp(hdcDest, hdcDest->textColor);
 
        hSrcBmp = (HGDI_BITMAP) hdcSrc->selectedObject;
-       srcp = (uint16*) hSrcBmp->data;
 
        if (hdcSrc->bytesPerPixel != 1)
        {
@@ -390,15 +389,15 @@ static int BitBlt_DSPDxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
        
        for (y = 0; y < nHeight; y++)
        {
-               srcp = (uint16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
+               srcp = (uint8*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
                dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
                if (dstp != 0)
                {
                        for (x = 0; x < nWidth; x++)
                        {
-                               patp = (uint16*) &color16;
-                               *dstp = (*srcp & *patp) | (~(*srcp) & *dstp);
+                               src16 = (*srcp << 8) | *srcp;
+                               *dstp = (src16 & color16) | (~src16 & *dstp);
                                srcp++;
                                dstp++;
                        }