Honour DIB_PAL_COLORS when the bitmap depths match.
diff --git a/objects/dib.c b/objects/dib.c
index 83a6a1e..ba623f2 100644
--- a/objects/dib.c
+++ b/objects/dib.c
@@ -433,7 +433,14 @@
/* 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);
+ if(coloruse == DIB_RGB_COLORS)
+ GetDIBColorTable(hdc, 0, 1 << info->bmiHeader.biBitCount, info->bmiColors);
+ else {
+ WORD *index = (WORD*)info->bmiColors;
+ int i;
+ for(i = 0; i < 1 << info->bmiHeader.biBitCount; i++, index++)
+ *index = i;
+ }
}
else {
if(info->bmiHeader.biBitCount >= bmp->bitmap.bmBitsPixel) {