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 { ...@@ -50,6 +50,15 @@ typedef struct {
LPVOID lpvbits; /* Buffer for holding decompressed dib */ LPVOID lpvbits; /* Buffer for holding decompressed dib */
} WINE_HDD; } 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.@] * DrawDibOpen [MSVFW32.@]
*/ */
...@@ -215,7 +224,7 @@ BOOL VFWAPI DrawDibBegin(HDRAWDIB hdd, ...@@ -215,7 +224,7 @@ BOOL VFWAPI DrawDibBegin(HDRAWDIB hdd,
DWORD dwSize; DWORD dwSize;
/* No compression */ /* No compression */
TRACE("Not compressed!\n"); 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); whdd->lpbiOut = HeapAlloc(GetProcessHeap(),0,dwSize);
memcpy(whdd->lpbiOut,lpbi,dwSize); memcpy(whdd->lpbiOut,lpbi,dwSize);
} }
...@@ -294,7 +303,7 @@ BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd, HDC hdc, ...@@ -294,7 +303,7 @@ BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd, HDC hdc,
if (!lpBits) { if (!lpBits) {
/* Undocumented? */ /* 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); 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