From 36dab06a926c1a7e5cc9995c76d34588580db965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Mon, 13 Feb 2012 01:40:30 -0500 Subject: [PATCH] libfreerdp-gdi: implement non-monochrome DSPDxax BitBlt --- libfreerdp-gdi/32bpp.c | 65 +++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/libfreerdp-gdi/32bpp.c b/libfreerdp-gdi/32bpp.c index 6c5dcafd9..8ed8553a9 100644 --- a/libfreerdp-gdi/32bpp.c +++ b/libfreerdp-gdi/32bpp.c @@ -385,48 +385,61 @@ static int BitBlt_SRCPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nW static int BitBlt_DSPDxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc) { int x, y; - uint8* srcp; - uint8* dstp; - uint8* patp; + uint32* srcp; + uint32* dstp; + uint32* patp; + uint8* srcp8; + uint32 src32; uint32 color32; HGDI_BITMAP hSrcBmp; /* D = (S & P) | (~S & D) */ - /* DSPDxax, used to draw glyphs */ color32 = gdi_get_color_32bpp(hdcDest, hdcDest->textColor); + patp = (uint32*) &color32; hSrcBmp = (HGDI_BITMAP) hdcSrc->selectedObject; - srcp = hSrcBmp->data; - if (hdcSrc->bytesPerPixel != 1) + if (hdcSrc->bytesPerPixel == 1) { - printf("BitBlt_DSPDxax expects 1 bpp, unimplemented for %d\n", hdcSrc->bytesPerPixel); - return 0; - } - - for (y = 0; y < nHeight; y++) - { - srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); - dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + /* DSPDxax, used to draw glyphs */ - if (dstp != 0) + srcp = (uint32*) & src32; + + for (y = 0; y < nHeight; y++) { - for (x = 0; x < nWidth; x++) + srcp8 = (uint8*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); + + if (dstp != 0) { - patp = (uint8*) &color32; + for (x = 0; x < nWidth; x++) + { + *srcp = ((*srcp8) | (*srcp8 << 8) | (*srcp8 << 16) | (*srcp8 << 24)); - *dstp = (*srcp & *patp) | (~(*srcp) & *dstp); - dstp++; - patp++; + *dstp = (*srcp & *patp) | (~(*srcp) & *dstp); + dstp++; - *dstp = (*srcp & *patp) | (~(*srcp) & *dstp); - dstp++; - patp++; + srcp8++; + } + } + } + } + else + { + for (y = 0; y < nHeight; y++) + { + srcp = (uint32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y); + dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y); - *dstp = (*srcp & *patp) | (~(*srcp) & *dstp); - dstp += 2; - srcp++; + if (dstp != 0) + { + for (x = 0; x < nWidth; x++) + { + *dstp = (*srcp & *patp) | (~(*srcp) & *dstp); + srcp++; + dstp++; + } } } }