msvfw32: Make it clear why a DrawDibBegin call is required.

Signed-off-by: Bruno Jesus <00cpxxx@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Bruno Jesus 2015-11-01 01:22:54 +08:00 committed by Alexandre Julliard
parent 2ccba1cf14
commit 560b13c273
1 changed files with 24 additions and 8 deletions

View File

@ -313,7 +313,8 @@ BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd, HDC hdc,
UINT wFlags) UINT wFlags)
{ {
WINE_HDD *whdd; WINE_HDD *whdd;
BOOL ret = TRUE; BOOL ret;
int reopen = 0;
TRACE("(%p,%p,%d,%d,%d,%d,%p,%p,%d,%d,%d,%d,0x%08x)\n", TRACE("(%p,%p,%d,%d,%d,%d,%p,%p,%d,%d,%d,%d,0x%08x)\n",
hdd, hdc, xDst, yDst, dxDst, dyDst, lpbi, lpBits, xSrc, ySrc, dxSrc, dySrc, wFlags); hdd, hdc, xDst, yDst, dxDst, dyDst, lpbi, lpBits, xSrc, ySrc, dxSrc, dySrc, wFlags);
@ -335,11 +336,25 @@ BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd, HDC hdc,
#define CHANGED(x) (whdd->x != x) #define CHANGED(x) (whdd->x != x)
if ((!whdd->begun) || /* Check if anything changed from the parameters passed and our struct.
(!(wFlags & DDF_SAME_HDC) && CHANGED(hdc)) || * If anything changed we need to run DrawDibBegin again to ensure we
(!(wFlags & DDF_SAME_DRAW) && (CHANGED(lpbi) || CHANGED(dxSrc) || CHANGED(dySrc) || CHANGED(dxDst) || CHANGED(dyDst)))) * can support the changes.
*/
if (!whdd->begun)
reopen = 1;
else if (!(wFlags & DDF_SAME_HDC) && CHANGED(hdc))
reopen = 2;
else if (!(wFlags & DDF_SAME_DRAW))
{ {
TRACE("Something changed!\n"); if (CHANGED(lpbi) && memcmp(lpbi, whdd->lpbi, sizeof(*lpbi))) reopen = 3;
else if (CHANGED(dxSrc)) reopen = 4;
else if (CHANGED(dySrc)) reopen = 5;
else if (CHANGED(dxDst)) reopen = 6;
else if (CHANGED(dyDst)) reopen = 7;
}
if (reopen)
{
TRACE("Something changed (reason %d)!\n", reopen);
ret = DrawDibBegin(hdd, hdc, dxDst, dyDst, lpbi, dxSrc, dySrc, 0); ret = DrawDibBegin(hdd, hdc, dxDst, dyDst, lpbi, dxSrc, dySrc, 0);
if (!ret) if (!ret)
return ret; return ret;
@ -388,9 +403,10 @@ BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd, HDC hdc,
SelectPalette(hdc, whdd->hpal, FALSE); SelectPalette(hdc, whdd->hpal, FALSE);
} }
if (!(StretchBlt(whdd->hdc, xDst, yDst, dxDst, dyDst, whdd->hMemDC, xSrc, ySrc, dxSrc, dySrc, SRCCOPY))) ret = StretchBlt(whdd->hdc, xDst, yDst, dxDst, dyDst, whdd->hMemDC, xSrc, ySrc, dxSrc, dySrc, SRCCOPY);
ret = FALSE; TRACE("Painting %dx%d at %d,%d from %dx%d at %d,%d -> %d\n",
dxDst, dyDst, xDst, yDst, dxSrc, dySrc, xSrc, ySrc, ret);
return ret; return ret;
} }