Improvement on the code that deals with setting the color map in

GetDIBits.
This commit is contained in:
Dave Belanger 2003-10-11 05:23:45 +00:00 committed by Alexandre Julliard
parent fbdfd910c1
commit 4db092c0eb
1 changed files with 65 additions and 59 deletions

View File

@ -407,8 +407,6 @@ INT WINAPI GetDIBits(
{
DC * dc;
BITMAPOBJ * bmp;
PALETTEENTRY * palEntry;
PALETTEOBJ * palette;
int i;
if (!info) return 0;
@ -418,12 +416,6 @@ INT WINAPI GetDIBits(
GDI_ReleaseObj( hdc );
return 0;
}
if (!(palette = (PALETTEOBJ*)GDI_GetObjPtr( dc->hPalette, PALETTE_MAGIC )))
{
GDI_ReleaseObj( hdc );
GDI_ReleaseObj( hbitmap );
return 0;
}
/* Transfer color info */
@ -431,7 +423,21 @@ INT WINAPI GetDIBits(
info->bmiHeader.biClrUsed = 0;
/* If the bitmap object already has a dib section at the
same color depth then get the color map from it */
if (bmp->dib && bmp->dib->dsBm.bmBitsPixel == info->bmiHeader.biBitCount) {
GetDIBColorTable(hdc, 0, 1 << info->bmiHeader.biBitCount, info->bmiColors);
}
else {
if(info->bmiHeader.biBitCount >= bmp->bitmap.bmBitsPixel) {
/* Generate the color map from the selected palette */
PALETTEENTRY * palEntry;
PALETTEOBJ * palette;
if (!(palette = (PALETTEOBJ*)GDI_GetObjPtr( dc->hPalette, PALETTE_MAGIC ))) {
GDI_ReleaseObj( hdc );
GDI_ReleaseObj( hbitmap );
return 0;
}
palEntry = palette->logpalette.palPalEntry;
for (i = 0; i < (1 << bmp->bitmap.bmBitsPixel); i++, palEntry++) {
if (coloruse == DIB_RGB_COLORS) {
@ -442,6 +448,7 @@ INT WINAPI GetDIBits(
}
else ((WORD *)info->bmiColors)[i] = (WORD)i;
}
GDI_ReleaseObj( dc->hPalette );
} else {
switch (info->bmiHeader.biBitCount) {
case 1:
@ -480,8 +487,7 @@ INT WINAPI GetDIBits(
}
}
}
GDI_ReleaseObj( dc->hPalette );
}
if (bits && lines)
{
@ -664,8 +670,8 @@ INT WINAPI GetDIBits(
}
break;
default: /* ? bit bmp -> 16 bit DIB */
FIXME("15/16 bit DIB %d bit bitmap\n",
default: /* ? bit bmp -> 32 bit DIB */
FIXME("32 bit DIB %d bit bitmap\n",
bmp->bitmap.bmBitsPixel);
break;
}