From d78e2e5ed0ea946f60f6f322df800042bcea400f Mon Sep 17 00:00:00 2001 From: Jim Aston Date: Thu, 9 Mar 2000 18:41:36 +0000 Subject: [PATCH] Handle 24 bit DIBs <-> 24 bit deep/24 bits per pixel XImages. --- graphics/x11drv/dib.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/graphics/x11drv/dib.c b/graphics/x11drv/dib.c index 5db9589dd81..3ca3e74bca2 100644 --- a/graphics/x11drv/dib.c +++ b/graphics/x11drv/dib.c @@ -1697,6 +1697,22 @@ static void X11DRV_DIB_SetImageBits_24( int lines, const BYTE *srcbits, switch ( bmpImage->depth ) { case 24: + { + if (bmpImage->bits_per_pixel == 24) { + int tocopy = linebytes; + BYTE *dstpixel; + BYTE *ptr = srcbits+left*3; + + if (tocopy < 0 ) tocopy = -tocopy; + dstpixel = bmpImage->data + lines*tocopy + left*3; + for(h = lines ; h-- ; ) { + dstpixel-=tocopy; + memcpy(dstpixel,ptr,tocopy); + ptr +=linebytes; + } + break; + } + } case 32: { if( bmpImage->blue_mask == 0xff && bmpImage->red_mask == 0xff0000 ) /* packed BGR to unpacked BGR */ @@ -1915,6 +1931,22 @@ static void X11DRV_DIB_GetImageBits_24( int lines, BYTE *dstbits, switch ( bmpImage->depth ) { case 24: + { + if (bmpImage->bits_per_pixel == 24) { + int tocopy = linebytes; + BYTE *srcpixel; + BYTE *ptr = (LPBYTE)dstbits; + + if (tocopy < 0 ) tocopy = -tocopy; + srcpixel = bmpImage->data + lines*tocopy; + for(h = lines ; h-- ; ) { + srcpixel-=tocopy; + memcpy(ptr,srcpixel,tocopy); + ptr = (LPBYTE)(dstbits+=linebytes); + } + break; + } + } case 32: { DWORD *srcpixel, buf;