libfreerdp-gdi: implement non-monochrome DSPDxax BitBlt

This commit is contained in:
Marc-André Moreau 2012-02-13 01:40:30 -05:00
parent e22023cc76
commit 36dab06a92

View File

@ -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++;
}
}
}
}