Fixed bitmap size handling.

This commit is contained in:
Andreas Mohr 2001-01-03 21:30:03 +00:00 committed by Alexandre Julliard
parent c90fb25c68
commit 0529c8bf33
1 changed files with 21 additions and 18 deletions

View File

@ -147,6 +147,7 @@ BOOL VFWAPI DrawDibBegin(HDRAWDIB hdd,
TRACE("(%d,0x%lx,%d,%d,%p,%d,%d,0x%08lx)\n", TRACE("(%d,0x%lx,%d,%d,%p,%d,%d,0x%08lx)\n",
hdd,(DWORD)hdc,dxDst,dyDst,lpbi,dxSrc,dySrc,(DWORD)wFlags hdd,(DWORD)hdc,dxDst,dyDst,lpbi,dxSrc,dySrc,(DWORD)wFlags
); );
TRACE("lpbi: %ld,%ld/%ld,%d,%d,%ld,%ld,%ld,%ld,%ld,%ld\n", lpbi->biSize, lpbi->biWidth, lpbi->biHeight, lpbi->biPlanes, lpbi->biBitCount, lpbi->biCompression, lpbi->biSizeImage, lpbi->biXPelsPerMeter, lpbi->biYPelsPerMeter, lpbi->biClrUsed, lpbi->biClrImportant);
if (wFlags) if (wFlags)
FIXME("wFlags == 0x%08lx not handled\n",(DWORD)wFlags); FIXME("wFlags == 0x%08lx not handled\n",(DWORD)wFlags);
@ -190,10 +191,12 @@ BOOL VFWAPI DrawDibBegin(HDRAWDIB hdd,
TRACE("biBitCount == %d\n",whdd->lpbiOut->biBitCount); TRACE("biBitCount == %d\n",whdd->lpbiOut->biBitCount);
} }
} else { } else {
DWORD dwSize;
/* No compression */ /* No compression */
TRACE("Not compressed!\n"); TRACE("Not compressed!\n");
whdd->lpbiOut = HeapAlloc(GetProcessHeap(),0,lpbi->biSize); dwSize = lpbi->biSize + lpbi->biClrUsed*sizeof(RGBQUAD);
memcpy(whdd->lpbiOut,lpbi,lpbi->biSize); whdd->lpbiOut = HeapAlloc(GetProcessHeap(),0,dwSize);
memcpy(whdd->lpbiOut,lpbi,dwSize);
} }
if (ret) { if (ret) {
@ -250,19 +253,13 @@ BOOL16 VFWAPI DrawDibBegin16(HDRAWDIB16 hdd,
/********************************************************************** /**********************************************************************
* DrawDibDraw [MSVFW32.6] * DrawDibDraw [MSVFW32.6]
*/ */
BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd, BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd, HDC hdc,
HDC hdc, INT xDst, INT yDst, INT dxDst, INT dyDst,
INT xDst, LPBITMAPINFOHEADER lpbi,
INT yDst, LPVOID lpBits,
INT dxDst, INT xSrc, INT ySrc, INT dxSrc, INT dySrc,
INT dyDst, UINT wFlags
LPBITMAPINFOHEADER lpbi, ) {
LPVOID lpBits,
INT xSrc,
INT ySrc,
INT dxSrc,
INT dySrc,
UINT wFlags) {
WINE_HDD *whdd; WINE_HDD *whdd;
BOOL ret = TRUE; BOOL ret = TRUE;
@ -290,11 +287,15 @@ BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd,
#undef CHANGED #undef CHANGED
if ((dxDst == -1) && (dyDst == -1)) { if ((dxDst == -1) && (dyDst == -1)) {
dxDst = dxSrc; dxDst = dxSrc;
dyDst = dySrc; dyDst = dySrc;
} }
/* biSizeImage may be set to 0 for BI_RGB (uncompressed) bitmaps */
if ((lpbi->biCompression == BI_RGB) && (lpbi->biSizeImage == 0))
lpbi->biSizeImage = ((lpbi->biWidth * lpbi->biBitCount + 31) / 32) * 4 * lpbi->biHeight;
if (lpbi->biCompression) { if (lpbi->biCompression) {
DWORD flags = 0; DWORD flags = 0;
@ -308,9 +309,11 @@ BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd,
memcpy(whdd->lpvbits,lpBits,lpbi->biSizeImage); memcpy(whdd->lpvbits,lpBits,lpbi->biSizeImage);
} }
SelectPalette(hdc,whdd->hpal,FALSE); if (whdd->hpal)
SelectPalette(hdc,whdd->hpal,FALSE);
StretchBlt(whdd->hdc,xDst,yDst,dxDst,dyDst,whdd->hMemDC,xSrc,ySrc,dxSrc,dySrc,SRCCOPY); if (!(StretchBlt(whdd->hdc,xDst,yDst,dxDst,dyDst,whdd->hMemDC,xSrc,ySrc,dxSrc,dySrc,SRCCOPY)))
ret = FALSE;
GlobalUnlock16(hdd); GlobalUnlock16(hdd);
return ret; return ret;