Commit 4dbc0690 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

gdi32/tests: Add some StretchDIBits tests.

parent c9a7bb71
......@@ -127,6 +127,8 @@ static const char *sha1_graphics_a8r8g8b8[] =
"aaf62842bb98d8a2945c4f643baf50afaeea9307",
"287b2f2f2fb5a1d7ee4a29b43342103d78a7a8ab",
"d7dd4700f49808541bba99244b7eb5840e0a2439",
"af99228aa4cfbd1f61bd824db046144a3c6c2ed7",
"568f87f0194ca19b69a5b2bcdef795d89c5721ce",
NULL
};
......@@ -182,6 +184,8 @@ static const char *sha1_graphics_a8b8g8r8[] =
"118bf4c5bddc206ba737f7aa8b239940cd1aadc2",
"7cb51f6c5f1dae926601986c934533df5f8baa9f",
"86c84cc8306975edecc6d4a89a8aff29f59b55a7",
"af99228aa4cfbd1f61bd824db046144a3c6c2ed7",
"25675c30adfe24d6cae60793b156dfdaa36ac3ba",
NULL
};
......@@ -237,6 +241,8 @@ static const char *sha1_graphics_r10g10b10[] =
"43d67bc61ef54014b022891e5c024fc24b1fe797",
"e8783644428b637adbe80bcd084a33428cb69983",
"fc0c32afb719295f28bcfef22803bef94f798e20",
"36f6db4fbe2a1630a7597d3a446f2902755c96ef",
"d3f08946300e1700865042aed121870e292d1095",
NULL
};
......@@ -292,6 +298,8 @@ static const char *sha1_graphics_r6g6b6[] =
"cd01f2c0a63b2229d4467d2f874d58edca32b3d4",
"94b54f1da5212b3f3a1195eda5ea927e160bc89d",
"49341c297a887186bd47d7465d827ab3147f05e3",
"325279e76367200d3fd7194d81c09fd139988ece",
"c3def160a1e847605ff0fc7edd30397fa90635a0",
NULL
};
......@@ -347,6 +355,8 @@ static const char *sha1_graphics_24[] =
"1015e0217ea13eaa62c7666b8b81aafd75f8f610",
"93e1aec608e037af3bfb7bd32dde446abe4eea11",
"b25ba91487ec945410deb2b51bc1156890c032a8",
"d347ca5c6c4b6a61389247c3b6f61564033e8c25",
"ee315634ed92da3a32c2675ecd1b369471c60936",
NULL
};
......@@ -406,6 +416,8 @@ static const char *sha1_graphics_r5g5b5[] =
"585061e403d9cac1603a38af420efe87338f381a",
"8f447a3820c83662086dfa836da2205b0130fd5f",
"3772003c7fb420003512d0c437b3659d96d89ce4",
"dab47c9dc149e570045d699598b14a613bf319b3",
"2daca4d26a086ed34894693be0b0374402232809",
NULL
};
......@@ -460,6 +472,8 @@ static const char *sha1_graphics_r4g4b4[] =
"9af4907a8144458a73dbb7471784f8c3d9aeffcf",
"e4731b63d41f6b51e30752ea52d85c4a2938731b",
"f0acb3cfcda62e95bee5f7bc8830ffeb3dd7e5a7",
"07b10c3f191d0a93e5e5694aae37dcad407e10f5",
"f7900e60347029876ba55e8f0c4c02e89deb36b6",
NULL
};
......@@ -520,6 +534,8 @@ static const char *sha1_graphics_8_color[] =
"f3dc739da41fb299637c8660e8c46917ddcf87a8",
"eae47bf865d932f22a6e59b6fe8d041f220e1fbc",
"9ae38bb94c7b4c0c6dfebbee23d1de4db9b77488",
"678979a45126a76eb629992cd64734862f53a555",
"2f7ba8803604c032cb1a1228bc021f0f1c03e245",
NULL
};
......@@ -584,6 +600,9 @@ static const char *sha1_graphics_8_grayscale[] =
"a1a941fa270cda48c648553ed4b427e16e96f8e0",
"f30a8d9f73ca043c5bfc18d9595e299fc0a39eec",
"fb63bbb2f944fb63ed2d7399f07b168740c1034b",
"3685c9ae95118a83db3569832c29753276fa1264",
"09640bad951c33e7d70a1fced83b1869f65b3fc5",
"cb9ea8137eca1450e049879772f5c11a0e11ff0a",
NULL
};
......@@ -642,6 +661,8 @@ static const char *sha1_graphics_8[] =
"7d1bfff706b0713e53209407889f83a0da26a81d",
"31e667c2dbb81dcf81d01cb88f794e88ddb90ff2",
"31e667c2dbb81dcf81d01cb88f794e88ddb90ff2",
"465d9cd0a77ab4fcf035aa67544b2a26269e0b09",
"600d6b2713d5e4c0d90c02660245ed26c7ae3033",
NULL
};
......@@ -696,6 +717,8 @@ static const char *sha1_graphics_4[] =
"46760975993f9881b7bbe94123173e6a683d3f25",
"df5feb905a31c288008cf5e82d73ac818a160d82",
"df5feb905a31c288008cf5e82d73ac818a160d82",
"d8af3868c66c7d6dac35ec8ee0317b38a6910bb1",
"ec8e2aebfb4a1c28ebcd0e053b9e4d8638b50951",
NULL
};
......@@ -750,6 +773,8 @@ static const char *sha1_graphics_4_grayscale[] =
"5eeb56afea8040a8fb18c11f29931b836474126d",
"a3405c085fc2f2184bcd0d1edcdcc66927e33659",
"f8681c09f1abfc38d31e47622cb8798cd896a00e",
"b5ee51cfc73acb59a2f6124509ea236f8fc7f9f7",
"d374d4d92c940ae42a9b42c14d744341b68a8c14",
NULL
};
......@@ -819,6 +844,8 @@ static const char *sha1_graphics_1[] =
"a2a928de9007d765da496abec8c21b23601f8c45",
"28ded40e72d4327b9413571476b167fb28a1f420",
"23366004515f3bc46796ea505d748f8d0f97fbe1",
"88763f8e8fcf4f78fa864325791a9dd35a0bd279",
"013cee26bac8f815eadad4bfc012d9b5d01c3b7f",
NULL
};
......@@ -1018,6 +1045,16 @@ static const BITMAPINFOHEADER dib_brush_header_8 = {sizeof(BITMAPINFOHEADER),
static const BITMAPINFOHEADER dib_brush_header_4 = {sizeof(BITMAPINFOHEADER), 16, -16, 1, 4, BI_RGB, 0, 0, 0, 0, 0};
static const BITMAPINFOHEADER dib_brush_header_1 = {sizeof(BITMAPINFOHEADER), 16, -16, 1, 1, BI_RGB, 0, 0, 0, 0, 0};
static const BYTE rle8_data[20] = { 0x03, 0x02, 0x04, 0xf0, 0x00, 0x00, /* 2, 2, 2, f0, f0, f0, f0, <eol> */
0x00, 0x03, 0x04, 0x05, 0x06, 0x00, /* 4, 5, 6, <pad> */
0x00, 0x02, 0x01, 0x02, 0x05, 0x80, /* dx=1, dy=2, 80, 80, 80, 80, (80) */
0x00, 0x01 }; /* <eod> */
static const DWORD four_by_four_data[16] = { 0x000000, 0xff0000, 0x00ff00, 0x0000ff,
0xffffff, 0x00ffff, 0xff00ff, 0xffff00,
0x000000, 0xff0000, 0x00ff00, 0x0000ff,
0xffffff, 0x00ffff, 0xff00ff, 0xffff00 };
static void draw_graphics(HDC hdc, BITMAPINFO *bmi, BYTE *bits, const char ***sha1)
{
DWORD dib_size = get_dib_size(bmi);
......@@ -1033,6 +1070,7 @@ static void draw_graphics(HDC hdc, BITMAPINFO *bmi, BYTE *bits, const char ***sh
BITMAPINFO *brush_bi = (BITMAPINFO*)dib_brush_buf;
BYTE *brush_bits, *src_bits;
BOOL ret, dib_is_1bpp = (bmi->bmiHeader.biBitCount == 1);
BOOL dib_is_8bpp_gray = (bmi->bmiHeader.biBitCount == 8 && bmi->bmiColors[1].rgbRed == 1);
BLENDFUNCTION blend;
blend.BlendOp = AC_SRC_OVER;
......@@ -1821,6 +1859,75 @@ static void draw_graphics(HDC hdc, BITMAPINFO *bmi, BYTE *bits, const char ***sh
DeleteDC( src_dc );
DeleteObject( bmp );
/* RLE StretchDIBits */
src_bi->bmiHeader.biSize = sizeof(src_bi->bmiHeader);
src_bi->bmiHeader.biWidth = 8;
src_bi->bmiHeader.biHeight = 8;
src_bi->bmiHeader.biPlanes = 1;
src_bi->bmiHeader.biBitCount = 8;
src_bi->bmiHeader.biCompression = BI_RLE8;
src_bi->bmiHeader.biClrUsed = 0;
src_bi->bmiHeader.biSizeImage = sizeof(rle8_data);
for (i = 0; i < 256; i++)
{
src_bi->bmiColors[i].rgbRed = i;
src_bi->bmiColors[i].rgbGreen = i;
src_bi->bmiColors[i].rgbBlue = i;
src_bi->bmiColors[i].rgbReserved = 0;
}
StretchDIBits( hdc, 10, 10, 7, 7, 0, 0, 7, 7, rle8_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
StretchDIBits( hdc, 100, 10, 7, 7, 0, 0, 7, 7, rle8_data, src_bi, DIB_RGB_COLORS, SRCAND );
StretchDIBits( hdc, 200, 10, 7, 7, 0, 1, 7, 7, rle8_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
StretchDIBits( hdc, 300, 10, 7, 7, 1, 0, 7, 7, rle8_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
StretchDIBits( hdc, 400, 10, 16, 16, 0, 0, 8, 8, rle8_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
compare_hash_broken_todo( bmi, bits, sha1, "rle stretchdibits", 0, dib_is_1bpp );
memset(bits, 0xcc, dib_size);
/* 32 bpp StretchDIBits */
src_bi->bmiHeader.biWidth = 4;
src_bi->bmiHeader.biHeight = 4;
src_bi->bmiHeader.biPlanes = 1;
src_bi->bmiHeader.biBitCount = 32;
src_bi->bmiHeader.biCompression = BI_RGB;
src_bi->bmiHeader.biClrUsed = 0;
src_bi->bmiHeader.biSizeImage = 0;
ret = StretchDIBits( hdc, 10, 10, 4, 4, 0, 0, 4, 4, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
ok(ret == 4, "got %d\n", ret);
ret = StretchDIBits( hdc, 20, 10, 4, 4, 0, 0, 4, 4, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCAND );
ok(ret == 4, "got %d\n", ret);
ret = StretchDIBits( hdc, 30, 10, 3, 3, 1, 1, 3, 3, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
ok(ret == 4, "got %d\n", ret);
ret = StretchDIBits( hdc, 40, 10, 3, 3, 1, 1, 3, 3, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCAND );
ok(ret == 4, "got %d\n", ret);
ret = StretchDIBits( hdc, 50, 10, -2, -2, 2, 3, -2, -2, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
ok(ret == 4, "got %d\n", ret);
ret = StretchDIBits( hdc, 60, 10, -2, -2, 2, 3, -2, -2, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCAND );
ok(ret == 4, "got %d\n", ret);
src_bi->bmiHeader.biHeight = -4;
ret = StretchDIBits( hdc, 10, 100, 4, 4, 0, 0, 4, 4, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
ok(ret == 4, "got %d\n", ret);
ret = StretchDIBits( hdc, 20, 100, 4, 4, 0, 0, 4, 4, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCAND );
ok(ret == -4, "got %d\n", ret);
ret = StretchDIBits( hdc, 30, 100, 3, 3, 1, 1, 3, 3, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
ok(ret == 4, "got %d\n", ret);
ret = StretchDIBits( hdc, 40, 100, 3, 3, 1, 1, 3, 3, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCAND );
ok(ret == -4, "got %d\n", ret);
ret = StretchDIBits( hdc, 50, 100, -2, -2, 2, 3, -2, -2, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
ok(ret == 4, "got %d\n", ret);
ret = StretchDIBits( hdc, 60, 100, -2, -2, 2, 3, -2, -2, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCAND );
ok(ret == -4, "got %d\n", ret);
compare_hash_broken_todo( bmi, bits, sha1, "stretchdibits", dib_is_8bpp_gray ? 1 : 0, dib_is_8bpp_gray );
memset(bits, 0xcc, dib_size);
SelectObject(hdc, orig_brush);
SelectObject(hdc, orig_pen);
DeleteObject(hrgn);
......
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