Small DIB fixes.

This commit is contained in:
Huw D M Davies 1999-09-19 12:04:17 +00:00 committed by Alexandre Julliard
parent 07c447f971
commit 1bb9860547
2 changed files with 24 additions and 33 deletions

View File

@ -285,10 +285,9 @@ static void X11DRV_DIB_GetImageBits_1( int lines, BYTE *dstbits,
/* 32 bit aligned */
DWORD linebytes = ((dstwidth + 31) & ~31) / 8;
if (lines < 0 )
{
if (lines < 0 ) {
lines = -lines;
dstbits = dstbits + ( linebytes * lines-1 );
dstbits = dstbits + linebytes * (lines - 1);
linebytes = -linebytes;
}
@ -1666,7 +1665,7 @@ static void X11DRV_DIB_SetImageBits_24( int lines, const BYTE *srcbits,
if (lines < 0 )
{
lines = -lines;
srcbits = srcbits + ( linebytes * lines-1 );
srcbits = srcbits + linebytes * (lines - 1);
linebytes = -linebytes;
}
@ -2853,7 +2852,6 @@ INT X11DRV_DIB_GetDIBits(
X11DRV_DIBSECTION *dib = (X11DRV_DIBSECTION *) bmp->dib;
X11DRV_DIB_IMAGEBITS_DESCR descr;
PALETTEOBJ * palette;
BYTE *bbits = (BYTE*)bits;
TRACE_(bitmap)("%u scanlines of (%i,%i) -> (%i,%i) starting from %u\n",
lines, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
@ -2909,13 +2907,9 @@ INT X11DRV_DIB_GetDIBits(
descr.colorMap = info->bmiColors;
if (dib)
{
descr.useShm = (dib->shminfo.shmid != -1);
}
else
{
descr.useShm = FALSE;
}
EnterCriticalSection( &X11DRV_CritSection );
@ -2930,9 +2924,6 @@ INT X11DRV_DIB_GetDIBits(
info->bmiHeader.biHeight,
info->bmiHeader.biBitCount );
if(bbits - (BYTE *)bits > info->bmiHeader.biSizeImage)
ERR_(bitmap)("Buffer overrun. Please investigate.\n");
info->bmiHeader.biCompression = 0;
GDI_HEAP_UNLOCK( dc->w.hPalette );

View File

@ -540,12 +540,12 @@ INT WINAPI GetDIBits(
/*FIXME: Only RGB dibs supported for now */
int srcwidth = bmp->dib->dsBm.bmWidth, srcwidthb = bmp->dib->dsBm.bmWidthBytes;
int dstwidthb = DIB_GetDIBWidthBytes( info->bmiHeader.biWidth, info->bmiHeader.biBitCount );
LPVOID dbits = bits, sbits = bmp->dib->dsBm.bmBits + (startscan * srcwidthb);
LPBYTE dbits = bits, sbits = bmp->dib->dsBm.bmBits + (startscan * srcwidthb);
int x, y;
if ((info->bmiHeader.biHeight < 0) ^ (bmp->dib->dsBmih.biHeight < 0))
{
dbits = bits + (dstwidthb * (lines-1));
dbits = (LPBYTE)bits + (dstwidthb * (lines-1));
dstwidthb = -dstwidthb;
}
@ -571,7 +571,7 @@ INT WINAPI GetDIBits(
case 24: /* 24 bpp srcDIB -> 16 bpp dstDIB */
{
LPBYTE srcbits = (LPBYTE)sbits;
LPBYTE srcbits = sbits;
for( y = 0; y < lines; y++) {
for( x = 0; x < srcwidth; x++ )
@ -579,7 +579,7 @@ INT WINAPI GetDIBits(
(((WORD)*srcbits++ << 2) & gmask) |
(((WORD)*srcbits++ << 7) & rmask);
dstbits = (LPWORD)(dbits+=dstwidthb);
srcbits = (LPBYTE)(sbits += srcwidthb);
srcbits = (sbits += srcwidthb);
}
}
break;
@ -611,7 +611,7 @@ INT WINAPI GetDIBits(
case 24: /* 24 bpp dstDIB */
{
LPBYTE dstbits = (LPBYTE)dbits;
LPBYTE dstbits = dbits;
switch(bmp->dib->dsBm.bmBitsPixel) {
@ -686,22 +686,22 @@ INT WINAPI GetDIBits(
((val << 6) & 0xf800) | ((val << 1) & 0x0700) |
((val << 19) & 0xf800) | ((val << 14) & 0x070000);
}
dstbits=(dbits+=dstwidthb);
srcbits=(sbits+=srcwidthb);
dstbits=(LPDWORD)(dbits+=dstwidthb);
srcbits=(LPWORD)(sbits+=srcwidthb);
}
}
break;
case 24: /* 24 bpp srcDIB -> 32 bpp dstDIB */
{
LPBYTE srcbits = (LPBYTE)sbits;
LPBYTE srcbits = sbits;
for( y = 0; y < lines; y++) {
for( x = 0; x < srcwidth; x++ )
*dstbits++ = ((DWORD)*srcbits++ & rmask) |
(((DWORD)*srcbits++ << 8) & gmask) |
(((DWORD)*srcbits++ << 7) & bmask);
dstbits=(dbits+=dstwidthb);
dstbits=(LPDWORD)(dbits+=dstwidthb);
srcbits=(sbits+=srcwidthb);
}
}