Commit 47a3a052 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

msvfw32: Drawdib doesn't support inverted DIBs.

parent 93089217
......@@ -246,9 +246,18 @@ BOOL VFWAPI DrawDibBegin(HDRAWDIB hdd,
DWORD dwSize;
/* No compression */
TRACE("Not compressed!\n");
dwSize = lpbi->biSize + num_colours(lpbi)*sizeof(RGBQUAD);
whdd->lpbiOut = HeapAlloc(GetProcessHeap(), 0, dwSize);
memcpy(whdd->lpbiOut, lpbi, dwSize);
if (lpbi->biHeight <= 0)
{
/* we don't draw inverted DIBs */
TRACE("detected inverted DIB\n");
ret = FALSE;
}
else
{
dwSize = lpbi->biSize + num_colours(lpbi)*sizeof(RGBQUAD);
whdd->lpbiOut = HeapAlloc(GetProcessHeap(), 0, dwSize);
memcpy(whdd->lpbiOut, lpbi, dwSize);
}
}
if (ret)
......@@ -332,6 +341,8 @@ BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd, HDC hdc,
{
TRACE("Something changed!\n");
ret = DrawDibBegin(hdd, hdc, dxDst, dyDst, lpbi, dxSrc, dySrc, 0);
if (!ret)
return ret;
}
#undef CHANGED
......
......@@ -98,6 +98,13 @@ static void test_DrawDib_sizeimage(void)
{ WIDTH, HEIGHT, WIDTH * HEIGHT * sizeof(RGBQUAD), "bc943d5ab024b8b0118d0a80aa283055d39942b8" },
/* [1] zero size */
{ WIDTH, HEIGHT, 0, "bc943d5ab024b8b0118d0a80aa283055d39942b8" },
/* error patterns */
{ WIDTH, -HEIGHT, 0, "" },
{ -WIDTH, HEIGHT, 0, "" },
{ -WIDTH, -HEIGHT, 0, "" },
{ 0, 0, 0, "" },
{ 0, HEIGHT, 0, "" },
{ WIDTH, 0, 0, "" },
};
HDC hdc;
DWORD src_dib_size, dst_dib_size;
......
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