Changeset 10558 for trunk/src/gdi32/dibitmap.cpp
- Timestamp:
- Mar 24, 2004, 5:55:35 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/dibitmap.cpp
r10373 r10558 1 /* $Id: dibitmap.cpp,v 1.4 2 2004-01-11 11:42:10sandervl Exp $ */1 /* $Id: dibitmap.cpp,v 1.43 2004-03-24 16:55:35 sandervl Exp $ */ 2 2 3 3 /* … … 73 73 } 74 74 75 // For some reason, GPI messes up the colors in DIB_PAL_COLORS mode. 76 // Work around it by converting palette indexes to RGB values 77 // (SetDIBitsToDevice works under the same circumstances though) 78 if(fuUsage == DIB_PAL_COLORS && lpbmi->bmiHeader.biSize == sizeof(BITMAPINFOHEADER) && 79 lpbmi->bmiHeader.biBitCount <= 8) 80 { 81 // workaround for open32 bug. 82 // If syscolors > 256 and wUsage == DIB_PAL_COLORS. 83 84 int i; 85 UINT biClrUsed; 86 USHORT *pColorIndex = (USHORT *)lpbmi->bmiColors; 87 RGBQUAD *pColors; 88 BITMAPINFO *infoLoc; 89 90 biClrUsed = (lpbmi->bmiHeader.biClrUsed) ? lpbmi->bmiHeader.biClrUsed : (1<<lpbmi->bmiHeader.biBitCount); 91 92 pColors = (RGBQUAD *) alloca(biClrUsed * sizeof(RGBQUAD)); 93 infoLoc = (BITMAPINFO *) alloca(sizeof(BITMAPINFO) + biClrUsed * sizeof(RGBQUAD)); 94 95 memcpy(infoLoc, lpbmi, sizeof(BITMAPINFO)); 96 97 if(GetDIBColorTable(hdc, 0, biClrUsed, pColors) == 0) 98 { 99 dprintf(("ERROR: StretchDIBits: GetDIBColorTable failed!!")); 100 return FALSE; 101 } 102 for(i=0;i<biClrUsed;i++, pColorIndex++) 103 { 104 infoLoc->bmiColors[i] = pColors[*pColorIndex]; 105 } 106 107 rc = CreateDIBitmap(hdc, lpbmih, fdwInit, lpbInit, (PBITMAPINFO)infoLoc, 108 DIB_RGB_COLORS); 109 110 return rc; 111 } 112 75 113 // 2000/09/01 PH Netscape 4.7 76 114 // If color depth of lpbhmi is 16 bit and lpbmi is 8 bit,
Note:
See TracChangeset
for help on using the changeset viewer.