Commit c68589e3 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Replicate a Windows bug in StretchDIBits for top-down bitmaps in the non-stretching case.

Found by Mathias Kosch.
parent d9cc69be
......@@ -227,6 +227,14 @@ INT WINAPI StretchDIBits(HDC hdc, INT xDst, INT yDst, INT widthDst,
return 0;
}
if (xSrc == 0 && ySrc == 0 && widthDst == widthSrc && heightDst == heightSrc &&
info->bmiHeader.biCompression == BI_RGB)
{
/* Windows appears to have a fast case optimization
* that uses the wrong origin for top-down DIBs */
if (height < 0 && heightSrc < abs(height)) ySrc = abs(height) - heightSrc;
}
hBitmap = GetCurrentObject(hdc, OBJ_BITMAP);
if (xDst == 0 && yDst == 0 && xSrc == 0 && ySrc == 0 &&
......
......@@ -2813,7 +2813,7 @@ static void test_StretchDIBits(void)
expected[2] = 0x00000000, expected[3] = 0x00000000;
legacy_expected[0] = 0xFEDCBA98, legacy_expected[1] = 0x00000000;
legacy_expected[2] = 0x00000000, legacy_expected[3] = 0x00000000;
todo_wine check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer,
check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer,
0, 0, 1, 1, 0, 0, 1, 1, expected, legacy_expected, __LINE__);
expected[0] = 0xFEDCBA98, expected[1] = 0xFEDCBA98;
......
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