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

Found by Mathias Kosch.
This commit is contained in:
Alexandre Julliard 2010-07-30 14:19:25 +02:00
parent d9cc69be5b
commit c68589e3dd
2 changed files with 9 additions and 1 deletions

View File

@ -227,6 +227,14 @@ INT WINAPI StretchDIBits(HDC hdc, INT xDst, INT yDst, INT widthDst,
return 0; 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); hBitmap = GetCurrentObject(hdc, OBJ_BITMAP);
if (xDst == 0 && yDst == 0 && xSrc == 0 && ySrc == 0 && if (xDst == 0 && yDst == 0 && xSrc == 0 && ySrc == 0 &&

View File

@ -2813,7 +2813,7 @@ static void test_StretchDIBits(void)
expected[2] = 0x00000000, expected[3] = 0x00000000; expected[2] = 0x00000000, expected[3] = 0x00000000;
legacy_expected[0] = 0xFEDCBA98, legacy_expected[1] = 0x00000000; legacy_expected[0] = 0xFEDCBA98, legacy_expected[1] = 0x00000000;
legacy_expected[2] = 0x00000000, legacy_expected[3] = 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__); 0, 0, 1, 1, 0, 0, 1, 1, expected, legacy_expected, __LINE__);
expected[0] = 0xFEDCBA98, expected[1] = 0xFEDCBA98; expected[0] = 0xFEDCBA98, expected[1] = 0xFEDCBA98;