Commit 9611986a authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Correct the size of the colour map allocated in the bitmap header for

the case biClrUsed = 0.
parent 704bf5ae
......@@ -50,6 +50,15 @@ typedef struct {
LPVOID lpvbits; /* Buffer for holding decompressed dib */
} WINE_HDD;
int num_colours(LPBITMAPINFOHEADER lpbi)
{
if(lpbi->biClrUsed)
return lpbi->biClrUsed;
if(lpbi->biBitCount<=8)
return 1<<lpbi->biBitCount;
return 0;
}
/***********************************************************************
* DrawDibOpen [MSVFW32.@]
*/
......@@ -215,7 +224,7 @@ BOOL VFWAPI DrawDibBegin(HDRAWDIB hdd,
DWORD dwSize;
/* No compression */
TRACE("Not compressed!\n");
dwSize = lpbi->biSize + lpbi->biClrUsed*sizeof(RGBQUAD);
dwSize = lpbi->biSize + num_colours(lpbi)*sizeof(RGBQUAD);
whdd->lpbiOut = HeapAlloc(GetProcessHeap(),0,dwSize);
memcpy(whdd->lpbiOut,lpbi,dwSize);
}
......@@ -294,7 +303,7 @@ BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd, HDC hdc,
if (!lpBits) {
/* Undocumented? */
lpBits = (LPSTR)lpbi + (WORD)(lpbi->biSize) + (WORD)(lpbi->biClrUsed*sizeof(RGBQUAD));
lpBits = (LPSTR)lpbi + (WORD)(lpbi->biSize) + (WORD)(num_colours(lpbi)*sizeof(RGBQUAD));
}
whdd = GlobalLock16(hdd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment