[GDI32_WINETEST] Sync with Wine Staging 2.9. CORE-13362
[reactos.git] / rostests / winetests / gdi32 / dib.c
1 /*
2 * DIB driver tests.
3 *
4 * Copyright 2011 Huw Davies
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #include <stdarg.h>
22 #include <stdio.h>
23 #include <math.h>
24
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wingdi.h"
28 #include "winuser.h"
29 #include "wincrypt.h"
30 #include "mmsystem.h" /* DIBINDEX */
31
32 #include "wine/test.h"
33
34 #ifndef M_PI
35 #define M_PI 3.14159265358979323846
36 #endif
37
38 static HCRYPTPROV crypt_prov;
39
40 static const DWORD rop3[256] =
41 {
42 0x000042, 0x010289, 0x020C89, 0x0300AA, 0x040C88, 0x0500A9, 0x060865, 0x0702C5,
43 0x080F08, 0x090245, 0x0A0329, 0x0B0B2A, 0x0C0324, 0x0D0B25, 0x0E08A5, 0x0F0001,
44 0x100C85, 0x1100A6, 0x120868, 0x1302C8, 0x140869, 0x1502C9, 0x165CCA, 0x171D54,
45 0x180D59, 0x191CC8, 0x1A06C5, 0x1B0768, 0x1C06CA, 0x1D0766, 0x1E01A5, 0x1F0385,
46 0x200F09, 0x210248, 0x220326, 0x230B24, 0x240D55, 0x251CC5, 0x2606C8, 0x271868,
47 0x280369, 0x2916CA, 0x2A0CC9, 0x2B1D58, 0x2C0784, 0x2D060A, 0x2E064A, 0x2F0E2A,
48 0x30032A, 0x310B28, 0x320688, 0x330008, 0x3406C4, 0x351864, 0x3601A8, 0x370388,
49 0x38078A, 0x390604, 0x3A0644, 0x3B0E24, 0x3C004A, 0x3D18A4, 0x3E1B24, 0x3F00EA,
50 0x400F0A, 0x410249, 0x420D5D, 0x431CC4, 0x440328, 0x450B29, 0x4606C6, 0x47076A,
51 0x480368, 0x4916C5, 0x4A0789, 0x4B0605, 0x4C0CC8, 0x4D1954, 0x4E0645, 0x4F0E25,
52 0x500325, 0x510B26, 0x5206C9, 0x530764, 0x5408A9, 0x550009, 0x5601A9, 0x570389,
53 0x580785, 0x590609, 0x5A0049, 0x5B18A9, 0x5C0649, 0x5D0E29, 0x5E1B29, 0x5F00E9,
54 0x600365, 0x6116C6, 0x620786, 0x630608, 0x640788, 0x650606, 0x660046, 0x6718A8,
55 0x6858A6, 0x690145, 0x6A01E9, 0x6B178A, 0x6C01E8, 0x6D1785, 0x6E1E28, 0x6F0C65,
56 0x700CC5, 0x711D5C, 0x720648, 0x730E28, 0x740646, 0x750E26, 0x761B28, 0x7700E6,
57 0x7801E5, 0x791786, 0x7A1E29, 0x7B0C68, 0x7C1E24, 0x7D0C69, 0x7E0955, 0x7F03C9,
58 0x8003E9, 0x810975, 0x820C49, 0x831E04, 0x840C48, 0x851E05, 0x8617A6, 0x8701C5,
59 0x8800C6, 0x891B08, 0x8A0E06, 0x8B0666, 0x8C0E08, 0x8D0668, 0x8E1D7C, 0x8F0CE5,
60 0x900C45, 0x911E08, 0x9217A9, 0x9301C4, 0x9417AA, 0x9501C9, 0x960169, 0x97588A,
61 0x981888, 0x990066, 0x9A0709, 0x9B07A8, 0x9C0704, 0x9D07A6, 0x9E16E6, 0x9F0345,
62 0xA000C9, 0xA11B05, 0xA20E09, 0xA30669, 0xA41885, 0xA50065, 0xA60706, 0xA707A5,
63 0xA803A9, 0xA90189, 0xAA0029, 0xAB0889, 0xAC0744, 0xAD06E9, 0xAE0B06, 0xAF0229,
64 0xB00E05, 0xB10665, 0xB21974, 0xB30CE8, 0xB4070A, 0xB507A9, 0xB616E9, 0xB70348,
65 0xB8074A, 0xB906E6, 0xBA0B09, 0xBB0226, 0xBC1CE4, 0xBD0D7D, 0xBE0269, 0xBF08C9,
66 0xC000CA, 0xC11B04, 0xC21884, 0xC3006A, 0xC40E04, 0xC50664, 0xC60708, 0xC707AA,
67 0xC803A8, 0xC90184, 0xCA0749, 0xCB06E4, 0xCC0020, 0xCD0888, 0xCE0B08, 0xCF0224,
68 0xD00E0A, 0xD1066A, 0xD20705, 0xD307A4, 0xD41D78, 0xD50CE9, 0xD616EA, 0xD70349,
69 0xD80745, 0xD906E8, 0xDA1CE9, 0xDB0D75, 0xDC0B04, 0xDD0228, 0xDE0268, 0xDF08C8,
70 0xE003A5, 0xE10185, 0xE20746, 0xE306EA, 0xE40748, 0xE506E5, 0xE61CE8, 0xE70D79,
71 0xE81D74, 0xE95CE6, 0xEA02E9, 0xEB0849, 0xEC02E8, 0xED0848, 0xEE0086, 0xEF0A08,
72 0xF00021, 0xF10885, 0xF20B05, 0xF3022A, 0xF40B0A, 0xF50225, 0xF60265, 0xF708C5,
73 0xF802E5, 0xF90845, 0xFA0089, 0xFB0A09, 0xFC008A, 0xFD0A0A, 0xFE02A9, 0xFF0062
74 };
75
76 static inline BOOL rop_uses_src(DWORD rop)
77 {
78 return (((rop & 0xcc0000) >> 2) != (rop & 0x330000));
79 }
80
81 static const char *sha1_graphics_a8r8g8b8[] =
82 {
83 "a3cadd34d95d3d5cc23344f69aab1c2e55935fcf",
84 "2426172d9e8fec27d9228088f382ef3c93717da9",
85 "9e8f27ca952cdba01dbf25d07c34e86a7820c012",
86 "664fac17803859a4015c6ae29e5538e314d5c827",
87 "17b2c177bdce5e94433574a928bda5c94a8cdfa5",
88 "fe6cc678fb13a3ead67839481bf22348adc69f52",
89 "d51bd330cec510cdccf5394328bd8e5411901e9e",
90 "df4aebf98d91f11be560dd232123b3ae327303d7",
91 "f2af53dd073a09b1031d0032d28da35c82adc566",
92 "eb5a963a6f7b25533ddfb8915e70865d037bd156",
93 "c387917268455017aa0b28bed73aa6554044bbb3",
94 "dcae44fee010dbf7a107797a503923fd8b1abe2e",
95 "6c530622a025d872a642e8f950867884d7b136cb",
96 "7c07d91b8f68fb31821701b3dcb96de018bf0c66",
97 "b2261353decda2712b83538ab434a49ce21f3172",
98 "35f731c0f6356b8f30651bb3cbe0d922c49deba5",
99 "9b9874c1c1d92afa554137e191d34ea33acc322f",
100 "c311dd74325e8cebfc8529a6d24a6fa4ecb7137e",
101 "d7398de15b2837a58a62a701ca1b3384625afec4",
102 "a78b28472bb7ff480ddedd06b9cf2daa775fa7ae",
103 "5246ef357e7317b9d141a3294d300c195da76cb7",
104 "87f6b6a19f021ca5912d285e14ce2ff9474d79f3",
105 "3d8244b665ecdb104087bad171b0b0f83545133c",
106 "e2a8eef4aeda3a0f6c950075acba38f1f9e0814d",
107 "8b66f14d51ecdeea12bc993302bb9b7d3ec085a1",
108 "7da9dd3d40d44d92deb9883fb7110443c2d5769a",
109 "e358efb1c11172e40855de620bdb8a8e545cd790",
110 "58806549380c964e7a53ad54821d2eb86fa5b9ce",
111 "7fc30d3058c235ce39088de0a598b8c7fe7ca61f",
112 "52a6c769c227f2bb1949097c4c87fed5ee0cbcb1",
113 "8a010d4c5af51fcc34d51be3197878782bdf63e7",
114 "c84c2c33e22eb7e5c4a2faad3b3b99a359d77528",
115 "41bcc1f57c60bdec3c4d1e749084a12867f91224",
116 "94645300d6eb51020a7ef8261dee2941cd51b5df",
117 "c56f5bdc9cac4f0bc81c33295d9aed8eaf4cb1f2",
118 "21cdfde38ac7edbb241ec83d82f31286e90c4629",
119 "0e6fc62522b0d6d2019f826ac0b586b91bd0d4fe",
120 "68c18db6abfda626cab12d198298d4c39264bfbc",
121 "6b59ae6c20749020ad43175e05110dc33b6a59b5",
122 "39c31de73aafcfcadf0bf414da4495be9de54417",
123 "132949f59bfeb88dc2047e6eaecb8512aea3d9ab",
124 "f6a6d765bf23726329f96020ba8c5e3c0897aafa",
125 "a7aa311cdc6137f15b9ef9cb1a92ac54ec02f058",
126 "e71d6bb9bd38eea5719f8ba57177997910e2d841",
127 "3d2ccbe51408232a04769546b1bdd74f84558a41",
128 "a1fe9aa885584a0f713d7c6f76c89830fbf28563",
129 "d7085333becdec7759a5229e5fe9ba1e11db0c22",
130 "aaf62842bb98d8a2945c4f643baf50afaeea9307",
131 "d7e34fa02db7ad52327f80389bd1ba1b72b6c692",
132 "d7dd4700f49808541bba99244b7eb5840e0a2439",
133 "00b4e9b243a36a7210a48bcb7c2d410d9cd8c8c7",
134 "8eb1f99d21a84153e88e7958707049d517ab7641",
135 "af99228aa4cfbd1f61bd824db046144a3c6c2ed7",
136 "568f87f0194ca19b69a5b2bcdef795d89c5721ce",
137 "a37810f46dee8741fe5adbb3f1f2e87012ffc929",
138 "50a09678c49c208f71d40452daca5411279aa674",
139 "e462052a03dbe4ec3814db7700e166d00d4d686f",
140 "a27917d4db49ce77989fae246015aeb2a28520ee",
141 "657514a4ca1f2b6ca7a125ad58dfed82099a37d1",
142 "5e0549fdcf0fc7c50054dccc51d37fc734ab8134",
143 "eca1998a4d79fb81b2a4103f79e3b846a864eaaf",
144 "e4acfcf2d001fbc431d9af59ab3d3ca7c2d965e5",
145 "2b3198bd5c0a87db5dab13df8bbe14363d02acec",
146 "aebb1b3baa4fd5213bf80a5ad7a50d54de8fdba4",
147 "5dca709c60e0cd50fa85274a2836aec9eb6168e3",
148 "cc4e1372ddf6e303a7fd159090c9d3a1f8ec2a89",
149 NULL
150 };
151
152 static const char *sha1_graphics_a8r8g8b8_bitfields[] =
153 {
154 "a3cadd34d95d3d5cc23344f69aab1c2e55935fcf",
155 "2426172d9e8fec27d9228088f382ef3c93717da9",
156 "9e8f27ca952cdba01dbf25d07c34e86a7820c012",
157 "664fac17803859a4015c6ae29e5538e314d5c827",
158 "17b2c177bdce5e94433574a928bda5c94a8cdfa5",
159 "fe6cc678fb13a3ead67839481bf22348adc69f52",
160 "d51bd330cec510cdccf5394328bd8e5411901e9e",
161 "df4aebf98d91f11be560dd232123b3ae327303d7",
162 "f2af53dd073a09b1031d0032d28da35c82adc566",
163 "eb5a963a6f7b25533ddfb8915e70865d037bd156",
164 "c387917268455017aa0b28bed73aa6554044bbb3",
165 "dcae44fee010dbf7a107797a503923fd8b1abe2e",
166 "6c530622a025d872a642e8f950867884d7b136cb",
167 "7c07d91b8f68fb31821701b3dcb96de018bf0c66",
168 "b2261353decda2712b83538ab434a49ce21f3172",
169 "35f731c0f6356b8f30651bb3cbe0d922c49deba5",
170 "9b9874c1c1d92afa554137e191d34ea33acc322f",
171 "c311dd74325e8cebfc8529a6d24a6fa4ecb7137e",
172 "d7398de15b2837a58a62a701ca1b3384625afec4",
173 "a78b28472bb7ff480ddedd06b9cf2daa775fa7ae",
174 "5246ef357e7317b9d141a3294d300c195da76cb7",
175 "87f6b6a19f021ca5912d285e14ce2ff9474d79f3",
176 "3d8244b665ecdb104087bad171b0b0f83545133c",
177 "e2a8eef4aeda3a0f6c950075acba38f1f9e0814d",
178 "8b66f14d51ecdeea12bc993302bb9b7d3ec085a1",
179 "7da9dd3d40d44d92deb9883fb7110443c2d5769a",
180 "e358efb1c11172e40855de620bdb8a8e545cd790",
181 "58806549380c964e7a53ad54821d2eb86fa5b9ce",
182 "7fc30d3058c235ce39088de0a598b8c7fe7ca61f",
183 "52a6c769c227f2bb1949097c4c87fed5ee0cbcb1",
184 "8a010d4c5af51fcc34d51be3197878782bdf63e7",
185 "c84c2c33e22eb7e5c4a2faad3b3b99a359d77528",
186 "41bcc1f57c60bdec3c4d1e749084a12867f91224",
187 "94645300d6eb51020a7ef8261dee2941cd51b5df",
188 "c56f5bdc9cac4f0bc81c33295d9aed8eaf4cb1f2",
189 "21cdfde38ac7edbb241ec83d82f31286e90c4629",
190 "0e6fc62522b0d6d2019f826ac0b586b91bd0d4fe",
191 "68c18db6abfda626cab12d198298d4c39264bfbc",
192 "6b59ae6c20749020ad43175e05110dc33b6a59b5",
193 "39c31de73aafcfcadf0bf414da4495be9de54417",
194 "132949f59bfeb88dc2047e6eaecb8512aea3d9ab",
195 "f6a6d765bf23726329f96020ba8c5e3c0897aafa",
196 "a7aa311cdc6137f15b9ef9cb1a92ac54ec02f058",
197 "e71d6bb9bd38eea5719f8ba57177997910e2d841",
198 "3d2ccbe51408232a04769546b1bdd74f84558a41",
199 "a1fe9aa885584a0f713d7c6f76c89830fbf28563",
200 "d7085333becdec7759a5229e5fe9ba1e11db0c22",
201 "aaf62842bb98d8a2945c4f643baf50afaeea9307",
202 "d7e34fa02db7ad52327f80389bd1ba1b72b6c692",
203 "d7dd4700f49808541bba99244b7eb5840e0a2439",
204 "00b4e9b243a36a7210a48bcb7c2d410d9cd8c8c7",
205 "8eb1f99d21a84153e88e7958707049d517ab7641",
206 "af99228aa4cfbd1f61bd824db046144a3c6c2ed7",
207 "568f87f0194ca19b69a5b2bcdef795d89c5721ce",
208 "a37810f46dee8741fe5adbb3f1f2e87012ffc929",
209 "50a09678c49c208f71d40452daca5411279aa674",
210 "0cda6b3297003b3ccd6d5baa17e1ca9bb7c56f08",
211 "b2c8e1ebb9435031fe068442f479d1304096e79f",
212 "657514a4ca1f2b6ca7a125ad58dfed82099a37d1",
213 "5e0549fdcf0fc7c50054dccc51d37fc734ab8134",
214 "eca1998a4d79fb81b2a4103f79e3b846a864eaaf",
215 "e4acfcf2d001fbc431d9af59ab3d3ca7c2d965e5",
216 "e4f110504dd3e4e34f960a39ba91a91c67bf26af",
217 "aebb1b3baa4fd5213bf80a5ad7a50d54de8fdba4",
218 "5dca709c60e0cd50fa85274a2836aec9eb6168e3",
219 "cc4e1372ddf6e303a7fd159090c9d3a1f8ec2a89",
220 NULL
221 };
222
223 static const char *sha1_graphics_a8b8g8r8[] =
224 {
225 "a3cadd34d95d3d5cc23344f69aab1c2e55935fcf",
226 "e0bc877697093ed440e125154e247ca9d65e933c",
227 "c6d7faf5a502299f99d59eef3f7650bd63dbe108",
228 "9d8c05c3ebd786e7d052418e905a80a64bf7853d",
229 "3da12af0a810fd993fa3dbe23328a4fcd2b6c92a",
230 "b91c8f21cc4d7994abc551feff5b6927d267a9db",
231 "d49dd2c6a37e975b6dc3d201ccc217a788b30284",
232 "ca6753f9eb44529cf8c67cd6abcd4ed1ef758904",
233 "18c3ae944e0afb6c43c21cde093ddb22a27611e4",
234 "b753ebb39d90210cc717f57b53dd439f7de6b077",
235 "38c017dd1fff26b492a57e09f3ce2c4370faf225",
236 "94368cea5033b435454daa56d55546310675131e",
237 "bf57a6a37fb107d29ed3d45695919887abcb7902",
238 "3db0f8bcca3d94920aa57be6321202b8c3c08822",
239 "1f1fc165a4dae7ba118ddccb58a279bfe3876b0a",
240 "8e09abb108e137c99527ab4c9bd07d95b9254bbb",
241 "b0178632775d29bec2b16de7b9b8287115c40d0f",
242 "ca7e859647b9498b53fdd92543ad8aea98ff46f3",
243 "3369889a67d6c79a24ee15f7d14374f9995215e4",
244 "473a1fd07df800c87a5d3286b642ace10c61c6af",
245 "10cd25a0ed5cd8f978d7d68236f81d949b938e84",
246 "b8951d2b20518fd129e5113a5f429626893913bf",
247 "e81fc45962f861d53f420e29cb5d33faf5adbec8",
248 "4851c5b7d5bc18590e787c0c218a592ef504e738",
249 "9aa506e3df33e0d5298755aa4144e10eb4b5adcf",
250 "abdf003699364fe45fab7dc61e67c606d0063b40",
251 "89abaadff4e68c738cf9251c51e3609564843381",
252 "77d0ad32938147aa4038c1eced232b7b5a5f88f3",
253 "43d36e57b702ce56eb250bf53f1ecc4680990cfe",
254 "fd6e0ebb52710ebcdd8dd69931165c83c4930b41",
255 "71b9756fdfeedce1e6db201176d21a981b881662",
256 "5319528d9af750c172ae62ee85ddb2eaef73b193",
257 "b7ce8aa3c328eedaed7306234ed9bae67708e627",
258 "19b32a0daa91201725b5e13820c343d0a84ff698",
259 "abca6a80a99b05722d2d87ce2a8b94ef1ae549e1",
260 "2ba70994d0b4ce87fdf6fbc33ada11252178061e",
261 "9b81ccc2d956d1de019085f971ba19435fe5feae",
262 "075c4cb50e2cf96ab5d132c9f7bb1c1deb4735bd",
263 "8566c1110ab5cb8f754787b47923c8bff38f790c",
264 "89e90d6159d59886bbbf0c40a7cd01293c3cfda3",
265 "3a598f1eb35c1412b0c131e9d9e36a4aef9534d2",
266 "d01071c44259adc94b89978b7d51a058b6dad665",
267 "e6d33b106bcda374e662d338c57a457dbcaa108a",
268 "27ef47377e88f5ac5ad33b19eae27d56c456ac65",
269 "339908a568f384e1f384a3e1b0dd415779203b02",
270 "88fd743d00bd37d2ed722092146795b044d08a6e",
271 "c0537ec24147e74939219213d864ee113cad9967",
272 "118bf4c5bddc206ba737f7aa8b239940cd1aadc2",
273 "eac5d164b83edf2cf85bac242686f9f617ec1fa4",
274 "86c84cc8306975edecc6d4a89a8aff29f59b55a7",
275 "698d6393e97539806351368f95be478c6fbc62b0",
276 "c272d1e0342e6089a0182dc42b37e47889116a9b",
277 "af99228aa4cfbd1f61bd824db046144a3c6c2ed7",
278 "25675c30adfe24d6cae60793b156dfdaa36ac3ba",
279 "849d4abf4b690128a5f70e9b8ac78f20c437de06",
280 "e768fc9f3167ef3144a4cfb1e20126a577f7dd5b",
281 "87f57a31253a38dbf3dc3070473328fa04b68a48",
282 "db64cc4d830fc35ed170b53943e722b2342954d4",
283 "9988ceca44dafbee247aece1f027c06c27c01652",
284 "d80d45a97bc877b50ba2c3f720d5197f2f1c5fc5",
285 "b76e0724496e471b01ef8b34f8beba69f5bde261",
286 "34201d3d3583f89ce3267d3d0c4e01c64463de4b",
287 "693f5c5fbaeaadb5928d34b035499626fecb8394",
288 "66041875232f64dbfd2d18353aa28e43e8ccb6b5",
289 "f19f5d8e2c96328f06f3985d02ff474fa37b1ea8",
290 "d26eeb6b2d345b587d4305a1234ec0842a96d4b6",
291 NULL
292 };
293
294 static const char *sha1_graphics_r10g10b10[] =
295 {
296 "a3cadd34d95d3d5cc23344f69aab1c2e55935fcf",
297 "b340b5d4750dd3dcd95d73c41b2c3a17f799210b",
298 "b1db68f35022c5fd43519ec8e98047e16bc4fff8",
299 "6e1902eb24865e74066fa9f2a7a49e6f9154f62f",
300 "35df9f4b0965fedf7bca36aa4f17b0fa20e2cd03",
301 "5652e1feb7d4f22c8a2721fd141157e0b9ef965e",
302 "22d89d5933f8b9bd60e9b22e42e7f5659269b63d",
303 "0ad27de0c916c073d0d18484fff899bbdb258db7",
304 "7c05ee5a01dad1e187537701a95382f0a3ec28dc",
305 "b00f0b4448be722d1a19ffe33aaaac4df848d397",
306 "7e5ce5c05a54e83890f022ba4e9853e4b254bf0c",
307 "2986b431a0022153e5f875da77cc792e3825ebd5",
308 "ca4b25a5459885ce1e0a36844612087893d425b1",
309 "181bd4616796d89174cedc0332fb320b65aeb0e2",
310 "6c417b1798ee319eeb404efe4aa136ed7ed37966",
311 "9a9f83e2035aa591d18101c919d1fd5b3456b46c",
312 "74ce9f5658cd8aeae4601fe72fcef07d9f75ec26",
313 "536eaaa901d652805a8977ecb2dc73f651094c5b",
314 "b8b1ac11bcc7174c5b23c18cc7919d09a04255c2",
315 "92cddcabf5365eef1e037f488af52b31669d987f",
316 "2c9c4f27bade080a2cd6f9160422762e267c2f5f",
317 "c7ce29d189dc06ba57e64f0cc32202f5a25ba48d",
318 "717778cc9ab30bcfc026a4344ea1bdef870bd247",
319 "7ac4cb547c8f4ce5079c95afad9d0e2b0cd76a0e",
320 "d578210815e27fe210eb678a71e6d22ba4b4c196",
321 "c7a027c7079dfcc831ca8bc134a509958273073c",
322 "19cf978596195b848df8709aaf637f83f92b8336",
323 "86ddf268d854f37e5b478c48792b551b57635db6",
324 "8259d388e02542207b6a08d65d553871ce1c4a09",
325 "faea73ff9436223f8c4ee76ac9861a6609ac4ae4",
326 "66f8d78d4971934794478afee28b3a50e97f1b82",
327 "b8f16334bdced439e1c6fc69704bc95f7b46b147",
328 "63798fb175afef78fa8fe8133d9de97a0cc80651",
329 "5f629ab51719dd0ca5a67d880eb2631f5b598a7b",
330 "1ceb85697f649a62b1753438daa14944af7f450c",
331 "98ce4dbc04eb48fa0f96ef813db5b4dfa1b2dd39",
332 "1cb0c7d9d89cdbce7b47d19ef0365bb6b2adc831",
333 "f00bac7e18827cfb264fae2e8a0da17b9db18d52",
334 "63c1c6c63e82f3b8bd977a1381b248e05321394d",
335 "ada202d2f526f6995f83412479891c1764b66e5a",
336 "68348e8f54883f4fe295354b024e291c85f1038f",
337 "07f55f85a5bb70de5841ea4f62a9af3d29d3d94b",
338 "e9167564031ead3459eee6a3ebb2f58f100d931f",
339 "d39315a1399639f6d4305a342c9ccf02a463b0dd",
340 "46196f50297260df2863e2fa76d2dfcf72006c23",
341 "0790585dfaef94f912b1ee81477d4ac448708708",
342 "589fb8a85d924ad19ed78409ae89475ba479c30a",
343 "43d67bc61ef54014b022891e5c024fc24b1fe797",
344 "5a713a91fd471fd331bd13b0868c994aa2ffe2b2",
345 "fc0c32afb719295f28bcfef22803bef94f798e20",
346 "bb2a421bab95f9b5420704ef44c0f3214a0b5a11",
347 "7735098af7535d8c57266190a13f92d8869e8529",
348 "36f6db4fbe2a1630a7597d3a446f2902755c96ef",
349 "d3f08946300e1700865042aed121870e292d1095",
350 "4782df8e24127e66a434b4e839adebf2dbb223fb",
351 "739707cc85ca63e0580c79618dc0bb8a4a338d95",
352 "8ea5d7e4bebc40a1d91b04b12e1c11a42c188095",
353 "317521e576801acaea62c76fe16813cdfe20f4ad",
354 "ce0fc29bb0281d6c955d64e239254ef9e6dbc06d",
355 "5ab49e7b61eddd3bab4182f362a38e1ab6a5a3b7",
356 "555b6f04ba8dec9e2a60693dcaac594227052727",
357 "c199b96a71c3aab2d49ccb5b6294bf14eb0dd1eb",
358 "4238fe9d296b5c72b0a8745cc761f308605b2094",
359 "88b6427cf71a6b9a26bfd6026103d50f721651a9",
360 "64cf929548bc5324fb14b053077bf5bc4be3e15c",
361 "1936661eee8073068506131c9e89265b2f8403e8",
362 NULL
363 };
364
365 static const char *sha1_graphics_r6g6b6[] =
366 {
367 "a3cadd34d95d3d5cc23344f69aab1c2e55935fcf",
368 "a1adb32e70188a00f82fe58156b4da74f3ef7a0a",
369 "5b9dab3d8411afb25fbbeba0313db526815ac189",
370 "6415f551e28e1b38b2d721f0a9e003b7d215f6b2",
371 "2028d1b0d1acef35dc07027135023f35fb9746b9",
372 "378713720dcb5aadb730435ad0989a68ab189114",
373 "084152773feb01a85df6006f2f4f288a1442d37a",
374 "97b824953f60fc9a91028045baacbe7b7dc82b14",
375 "f33b1931f392bd09b3494efc23cf7d0ed3071014",
376 "287d755448e72e29e4812193e2b6f8098a214d82",
377 "4059d295aa05ace77853d7ee3d74305cdcbec9f5",
378 "2557ebd4fdacc0e5bcce3dae88a46dd247654ea1",
379 "e51bcf80211cd06e7d10225534b7a79b5454be27",
380 "9bf91a547f47b29bf370e9b60eae7cd6ce987617",
381 "0b94e0a5b739ab0020130646522e53da35a149ad",
382 "eab6e532845dfd5dc2701ef90669a5f7b63e9539",
383 "90deb2e2502186b3c62a58ec9b1c9d2b7b4089c1",
384 "a4e451f76a77bbc3e224a41e9b4fa78cb841a8af",
385 "084607a5c99a84140d93db57d1b0f3a0f51afdac",
386 "2128157e601ef0d6b3636b7387d3b28e876de728",
387 "8bdcdcd463f0052279d070ac763757f4db975483",
388 "9ea0ad22d7b61598fe36e9c942242e8e07e32edb",
389 "8b6452ebd1f6d189d10ee6647e7704821559cfcb",
390 "c39a25a61c4eade48dea62a97c9fb8714c06a8af",
391 "66b130f83381957cfc4763558c5f5cddf2e3b564",
392 "d548135ce2320499277ce12b80bc35004f8a9787",
393 "85a4f3f1b4b0a170198f1bb5d225fcf77887665e",
394 "971a0b786d5bccb1bfb9cbb054740e4eb36f9b7a",
395 "e2896035f178b3d20e4f4d1accb1b3d1b4028865",
396 "defd95a10d44cad6e736542920b74efd53e9e7eb",
397 "eaccd012c0fc46e79cae1997ef101979e5654d8d",
398 "3f11a735e52030aa3d0f024d83803698293d10e5",
399 "82f45c5a34fbb9e36d947a876834d33a1f69719c",
400 "3d27002f4fe3c943468b7e3ef6985962c41ac8dc",
401 "3231c4d87faefb7ec5bd377613969c05b70343fc",
402 "00394e438e9edde978e88602c9ad2a572e965bf6",
403 "c0c41390270ba082ee8211576fee39c676813c42",
404 "996fb708ddc4b94eb8d1585bd83a5c8a1e2633ba",
405 "caa39eb482e8fc2e00f1c6737735c023ac9363ef",
406 "c1250ff2b67e6d2a8baccc5c93f8f5ad933c5c4f",
407 "3d6cf3753390a05504b1f50302f767df443f0f40",
408 "b7cf1bafe002673ae58ff50feea61ee32a1ae10a",
409 "da9e896a3a98b330980152b2e4a43cb6e686c730",
410 "0a613357e1e8ec8ff1ad956e46e527a05cab8500",
411 "bdd8ed3ca3ad107b43731ec253ecaa34750a10de",
412 "47499ad13b719de18c59c2bc9b38ed578db50b95",
413 "643e82ac67ab2b0c034a3fcfa498b072a5f2be5c",
414 "cd01f2c0a63b2229d4467d2f874d58edca32b3d4",
415 "8ad5cd520cd628b76d2e5a3f318ae1bbb6b4c994",
416 "49341c297a887186bd47d7465d827ab3147f05e3",
417 "514c07281ef6702c35e68b230e897303a8cdec81",
418 "4b41865829b50b2e29beda51b055bd1f908a649c",
419 "325279e76367200d3fd7194d81c09fd139988ece",
420 "c3def160a1e847605ff0fc7edd30397fa90635a0",
421 "2b3e87e0b705b03c7c08f403409ab82cce095ba1",
422 "45c08e11fffc78b2a3574263419e0cb7f8cd9b45",
423 "aecb242c31f31a90f071b6455ea7d808d4ea22e3",
424 "77ea86e51a94b11a8081b29696cb4115687843e3",
425 "d67b897cad72d31e75359094007b1346fd8806ea",
426 "442bcf4d94a649c9406c3b0bf2f00cb7c6a4d1d4",
427 "3d0853f4f7580d7cd5148c21c34d878ecf39a5f3",
428 "1e5a4ef7f8634847a251d1fcce298c409fd13d87",
429 "481337fbedf181d4324bf7f8299b0327197ff468",
430 "b4b9f0bf127ef11f510f25684ae21d692609c85e",
431 "5da35bad12e3e9b26a0444d30820099481281e45",
432 "045ddaf752e7ffc7ded792f36af3c7c0cfeeae42",
433 NULL
434 };
435
436 static const char *sha1_graphics_24[] =
437 {
438 "e993b15c9bd14fb45a15310450b7083c44e42665",
439 "edbd7bab3d957fbc85e89612197cf918f5f5af20",
440 "6a7efb3b6e0b49336df1bd2937ca09a11d976531",
441 "236eb5ca9da70ec7cc719cd2fd291bab14000257",
442 "f98023c7cd8c068f2d7a77ce3600004b90ea12d6",
443 "5c4cb9cea2226fc671bb4a11f8253343ee94bb4b",
444 "fd4be592483623dbc800fe28210a1f0daa71999b",
445 "788b8de98c47974fa9f232a6042ae4ca546ddb7d",
446 "a8772e6c44ba633fb384a7c4b50b435f1406107e",
447 "883bc8f305c602edca785e21cd00f488583fb13f",
448 "3bac4e80993f49dc3926e30524115fca9d7a8026",
449 "91369e35be29059a0665782541db4c8b324c6bb2",
450 "0fa8cf332a56bb6d7e14e85861fdd60f51d70501",
451 "593d694cdcc8349b3bfc8257041dbcb27e61da45",
452 "1036b91d93e31cd1d4740d0c8642e115e5a38188",
453 "1898073cdb35ca4d2b21bba933ac16a0b4297317",
454 "5068bff794553cf5a3145ae407c9a2984357844c",
455 "413a7989969c229dee4ab1798362f32f96cf0a10",
456 "0bb222e540b82720d4971e4a2fc626899af03e03",
457 "adc20832d8c43f1cf372d8392535492013cd2306",
458 "45649794dcbcabda487f66f7a80fc1bec79047a1",
459 "367c2dc1e91ff9ea0e984d6fb3000cfb4e0ae7e9",
460 "9c6afd47dd748a33c585e6655fd4ec1c28976a47",
461 "b4df692ac70a5f9f303270df4641ab014c6cbf46",
462 "8bc3128ba47891366fd7b02fde7ca19100e64b9f",
463 "e649e00efe7fea1eb8b17f7867fe089e5270c44b",
464 "a0bffbbfb0adf6f188479c88da04e25d76ab4822",
465 "b58f19c1800344a2b8e017eb784705bdb2bd8450",
466 "5747a6d5c6ce79731c55e8cf33f7da3025cd35fd",
467 "955390669afed2369b15b32fa519f2f921cdf1a0",
468 "201906f7d763b930a98c97f8eeab417f2b65e723",
469 "5313357d50c40c05a3b3a83d0d2013a138c955a1",
470 "701c5af1d0c28294ce7d804b5697643c430d22a0",
471 "b0a959745b2db1d9f449e68e4479a4f36301879c",
472 "63f764b9bd2f4876ab1ee0f3c0eb55b5a7de5212",
473 "e171f6ec77bca91d6b8559911bce296c0bac469e",
474 "33bb75c12f083d799d287fe9caddedbb3892e6fa",
475 "26e7e1c300ba0c5aaaef03eeb71d529f6def9289",
476 "b1f602d2a74095cc0115ae2ae07b642498e6c0fc",
477 "03d5eb8e3a6662e6dc183f88ee2f285065fc9c51",
478 "f4c312f9a37ddc54a27f6b1421dab1ce0cec0c27",
479 "0f79500eda467cd3cbc220abdd37b5dba695d654",
480 "8d4e3e9d81cc30aaad555ed9e27aed7c615de630",
481 "84c43a3cbd7d8c1ac9a0e9b6f07620158079b278",
482 "7d479beeb6758c164566638b5c873c188d6a91e7",
483 "80086808fca03e757d812e31d1ae576bf90dac9d",
484 "9560096f1b85ae6d939d736165c44df00a47c424",
485 "1015e0217ea13eaa62c7666b8b81aafd75f8f610",
486 "5578c80048520732557abf3a3a3fa22c85015d7d",
487 "b25ba91487ec945410deb2b51bc1156890c032a8",
488 "4c8c936372755f95051f1159b7ff65a484e1a555",
489 "bf55d4bdb26ae0f358bd67ef01932563519aab98",
490 "d347ca5c6c4b6a61389247c3b6f61564033e8c25",
491 "ee315634ed92da3a32c2675ecd1b369471c60936",
492 "099c688a920f606655b485e8f0a433dc811bc976",
493 "9c044a733335bca43766bda2b317249309155079",
494 "354b92008a8409c62d0fa1dff1532c5943aa37a2",
495 "8dc9cb7deae5c24d1eae004d53893fa6caf4723c",
496 "cf311a96d41bd98fdbdfb5dfaac4ba1ba9b7d6da",
497 "bf5ec23456efe00e1e0931c17de9040ab2092858",
498 "0bbdf0a0489428f96e3c1d3e5305f9a893820852",
499 "9d86b1b2bbce90efd3c0b9fe20d23ffa3eeecd20",
500 "8f7a0af421101952e674f37154c1e8c4646ea2d2",
501 "d12284f58daabbd173dfae6c7e55fd5d822d89b4",
502 "cc5ed4c9e925f0a457a7437fbb8054528cdd9469",
503 "48658ff76c137185c56a53f3ccf0e958d0296742",
504 NULL
505 };
506
507 static const char *sha1_graphics_r5g5b5[] =
508 {
509 "2a2ab8b3c019e70b788ade028b0e9e53ffc529ae",
510 "847005cf7371f511bcc837251cde07b1796f6113",
511 "a8f75743a930843ec14d516cd048b6e0468e5d89",
512 "d094f51ce9b9daa9c1d9594ea88be2a2db651459",
513 "cf3928e240c9149788e1635b115a4e5baea0dd8f",
514 "a9034a905daa91757b4f63345c0e40638cd53ca8",
515 "15ee915d989e49bb9bab5b834d8f355bd067cd8f",
516 "99474fecf11df7b7035c35be6b8b697be9889418",
517 "cbc2898717f97ebb07c0c7cc04abde936dc5b584",
518 "29c896b591fdf4ddd23e5c0da1818c37e4686d94",
519 "4b5b275d33c1ebfe5bdc61df2ad125e865b800fa",
520 "92df731fa1f89550d9d4f7ea36c13f2e57c4b02a",
521 "420e39ff3bdd04c4b6cc2c98e99cb7993c7a0de5",
522 "1fabf0fdd046857b1974e31c1c1764fa9d1a762f",
523 "449092689226a1172b6086ba1181d6b6d6499f26",
524 "1a92a60f190d33ef06d9decb56fd3fdd33f3af03",
525 "e61f5978c2e28c0c6d8f5eefe0f840c975586efc",
526 "897d16f4d6a6ddad685d23ed7828d4f676539b75",
527 "9d21bcfdeaf1ca5d47eb823bdefc24d7a95f4f56",
528 "6daaf945a955928c5c124c880522ca4634fb2343",
529 "12a288390d16e1efa99d4185301de48a4d433b14",
530 "ea92af2538b76f41a3a03eaa11ac395c9b6197c4",
531 "1d3af561605fd61433035600d8962cb8d266fdd0",
532 "3a50ce21b3563a604b4fc9f247a30f5a981f1ba6",
533 "d7d97e28ed316f6596c737eb83baa5948d86b673",
534 "ecc2991277d7314f55b00e0f284ae3703aeef81e",
535 "656bf3b7121bcd620a0a3ad488f0d66604824577",
536 "df5dafe96e528c2cc7fd11e4934e298f53cec34b",
537 "a49530722328ae88fd765792ac0c657efbcce75d",
538 "aa46aa2226e3121eaefa9d0836418e0b69262d69",
539 "333f3f2cf3ff15736d59f92a33c45323d3987d6d",
540 "a6fd83542c3826132e88d3f5e304d604c0056fad",
541 "a8d6a5285a927ba3a3be34b06a06c70a20d4c1b3",
542 "e428d213ad02651287894f093413949dcb369208",
543 "7df915bedcc5951a1b6f828490f7dbb93212e835",
544 "8720478d904a84c24071e97c731c1ba7882b131e",
545 "76215275593631f5900aad3616d725733dc39493",
546 "573d65665d20f00d36d9782ae2b89772140524ab",
547 "c3d4a1425e17de9e05e3f6dfc6a24c26bfd5ee12",
548 "2a66dae03890ff791eabb982949435adb19af02b",
549 "24ac219478ba406f30794550690486b14cbac5e8",
550 "2b28d20690dc92374ebecb5508f8fdc6c7581790",
551 "6c652ecce55e71fee16bc1c9b2c5ae4161bdd2ea",
552 "9b02173f424c098ea0f4cc5db9eb65f69263d127",
553 "a92942269911a88793b3460b6f2a2cd56e48eec1",
554 "059db9f0426b371e464ef3d30f1a4f4aa599e101",
555 "aa4a0a4b7f2697aaf270c89874631974bd9d7183",
556 "a7506e2c001d271593297c9eda9b984d4d894774",
557 "8f447a3820c83662086dfa836da2205b0130fd5f",
558 "2ebf37d81da3f11434652d06bf65d55e96b090aa",
559 "ace2c60bd76b11a002bee852686e8783f102eba1",
560 "dab47c9dc149e570045d699598b14a613bf319b3",
561 "2daca4d26a086ed34894693be0b0374402232809",
562 "904f1d82159bcf5485f323bd12b859dc5e83f8eb",
563 "5bd29f94844351e9a5bd01f25d85608b9b0701b2",
564 "295ec16530126046790fb734e99f86f5b3b74ed8",
565 "d98b0561010606b55a1b9b85fbc93640f681d256",
566 "1c1499051860b7caa25173b328ca9c862f01dd1a",
567 "a655512753bc90e6d4eb3848f69e96db1ad348e5",
568 "2230f36f12d4becb242e2962fa1b3694db2496ca",
569 "d81e41a765d7a2d68073f5fde3f74f09df84001d",
570 "0de013c2c6aba9f99cbcf5f8cfd3212ded7ae72a",
571 "fedc67d1b0797be5f40cd45280844f2b61d29b0a",
572 "a848b1b0293b05b3f9358a3ffcb21a2e5fdecf05",
573 "af45bf81d119be5cf6845ad41191ba52637e65e9",
574 NULL
575 };
576
577 static const char *sha1_graphics_r4g4b4[] =
578 {
579 "2a2ab8b3c019e70b788ade028b0e9e53ffc529ae",
580 "cfa0ab83ee93283ad914c3748f0532da1697af1d",
581 "8bd18697d1ef27492805667a0bc956343ac08667",
582 "e8501c830321584474654f90e40eaf27dc21e6a8",
583 "d95ab10fcfb8447b41742e89f1ae8cd297a32fc4",
584 "821177710961d2cb5f7e7dfc0e06e767b6042753",
585 "667124365ffadeea1d8791bedda77a0c7b898de8",
586 "c9f23e684b600dea17575b4b17175fbd9106c3a9",
587 "7678876e50eae35d1eaa096aae25afaa0b864bf3",
588 "fb52b0c373a5f2a60b981604b120962942d2447a",
589 "5ab8dd07436681d762fa04ad7c6d71291c488924",
590 "0167981d9e1490a2ebd396ff7582f0943aa8e1b8",
591 "115a6bd382410a4a1d3c1fa71d8bf02536863e38",
592 "65c6d1228e3b6d63d42647f14217bc1658b70d9a",
593 "25fcb75aa687aac35b8f72640889fe92413e00c5",
594 "3bddf9d53e89560b083302b146cd33791b13d941",
595 "a81504498c7a7bb46340ce74476a42f70f2730b1",
596 "e61a4f2657a444d8c49f84fb944f9f847667bf2b",
597 "32b6e0aa79b7e96cd0ab2da167f6463c011023a8",
598 "1d283aa4d2b2114f7809fe59357d590c7c779aa7",
599 "29640e2ddd2d3016da14507c3ce9b2ce32f39bb4",
600 "57ebf8becac1524543da120e88e9cc57ecfdec49",
601 "e68ef3ffd7401244cdea79781eab12d7a5e8ca18",
602 "d591232bbc2592462c819a9486750f64180518fd",
603 "0e183a4c30b3da345129cffe33fe0fc593d8666b",
604 "f14d9a4bd8a365b7c8f068a0dad481b6eb2b178b",
605 "8933450132bf949ba4bc28626968425b5ed2867d",
606 "e4a9dcc3e565cd3a6b7087dd1433f3898bb9cdb2",
607 "eca4f9b16b3bddfd0735fdd792e0ccaadfb9ba49",
608 "233e588cf660e2c9b552cf02065cf63fa6655864",
609 "0740ff74dcd259d9a644ba51ad77ff0d40348951",
610 "a3345acaf272f2e288626906e3056cd0ced70499",
611 "957a86fbe8a96dd068db65e4e624a52bcc84af46",
612 "13b0f240054dc57ba0e2dfde74048496304a2c7f",
613 "51ef267eb9c15487c9430f505e8a6c929eb2170c",
614 "60c0752f592c6426a2f4a71173b44c5c086f4f2a",
615 "9dd123938b0a02601d8d458ecbd6535ddefea724",
616 "815a1e4fc7f3a00c2990c150e87eba0b13f66811",
617 "75ae8c80af4356a1a5eebde6608fbc31e8a95372",
618 "b89ae8de2d975b8adb263ace66fd953d29165a8b",
619 "e901ab4b20bc87370609d7ba1f21aa08abd9eced",
620 "e9105c6ed8355519e0cf2d2217ed7af43cec8ba0",
621 "3cbf5fffdd73f9639f3eb34ec1ab3055bc8618fb",
622 "8e2e70ade90711c4ac01352aa0373fce36ff5dc0",
623 "8c40d6d8e0c696c31f04c896e492a2a38703d870",
624 "e13c821c236ea0b67cca64c9da7be15e88fc712f",
625 "9af4907a8144458a73dbb7471784f8c3d9aeffcf",
626 "104e85bad287a62dfe25f0e78280179f18bac765",
627 "f0acb3cfcda62e95bee5f7bc8830ffeb3dd7e5a7",
628 "fde993dfce1551ef220f5a07ce4acd66e8524ac5",
629 "a80f3df0aea1e1b30d9833039157bca658218f48",
630 "07b10c3f191d0a93e5e5694aae37dcad407e10f5",
631 "f7900e60347029876ba55e8f0c4c02e89deb36b6",
632 "f373a5f37b82e7523c64c08eb509b6191e49b173",
633 "9f0760a05190c9edf9ce2e8be6aaa5557601fe91",
634 "7587a9c87cab1eca827807f351bb67ca184d1ac5",
635 "b53ef0b5c674822e784903a9dbdd3b386d9f2350",
636 "5505d2ed20dc61ffe48832ecf5329162a5ceb734",
637 "9f72be4467219a345b1164205d1fbfda2d64271e",
638 "13d1634e03bc49cfe14a32278d9b1f5ddbb9be10",
639 "a79e4cc419b9e1735e275e2823da52875536943a",
640 "b0182002cb1f4fba9df3c21a4d046ab41ce7e9be",
641 "f571c7c4aac92491017963032194690c0fa06b42",
642 "91d50b5a604d6c38aa0d08b9af995490f8ec246b",
643 "b53cde47b0e28063770d3b1328c3cc2f774a6300",
644 NULL
645 };
646
647 static const char *sha1_graphics_8_color[] =
648 {
649 "41728d7ff2bb425b5fc06521adeabf6cc73136f3",
650 "e313bb57f699587b0bae2f17f5da5d977e6f2a61",
651 "49024d6cbdf1614327dfda9eda17675e76805f7e",
652 "63ba8ab7e7996857d52d4c2b995cfcd304daf25f",
653 "92295ae66712df050cfd6cc9fd2fd4101784c5fc",
654 "84d85009d35ae10abbc435f3913422544105cea2",
655 "eae349c2a481d6e8bfdf9a7f4f49384a14716a5f",
656 "6c51068ca1db36d948eaa34aed4a44d2cd1e8b32",
657 "f3aa8d89430748178952de56643069d80b40aad6",
658 "bd5fed74e2f1b097ef4c20bd30edfc6ee11eeccd",
659 "0546b87bf5fbe1b8168eed5d4a20649be92734a1",
660 "52b1363e821bf604d9df260bfa97e26d428c33fd",
661 "108732d9909ee5f3542a9b90b3ad96ec82446ab9",
662 "06c76c53dcf3ba5e213d483e27d841404c9aa90a",
663 "ae8fcdbdd44ba58e9bd46a4c56eb54f37483913c",
664 "89711289be6d5c55734878410e4923d5cca9aca9",
665 "8355caf57d51ad4e14275943088392e37dc75d33",
666 "5992b2e331a0e0f752598cc8d083cbecb5f4dde6",
667 "6f0570da9dea7f043f678088f8362ee458cd79fa",
668 "940db409d4c3e5640275724f9e5f7c1a0d2e21b2",
669 "242ce86967ea62fa69c1e6f597ccbcf2f0b1602c",
670 "5092b22af85a08f10a2899888bb9d552f25f828e",
671 "f5dafef807237fe72c74c0bbd47c382ace45bfde",
672 "e91973be2651eeef568700463652838d8cbba976",
673 "1df851515ecf46df5c2d3279535c1763f72353dd",
674 "b68922915ebc2797d58deecf983f7d0cf9a5efbd",
675 "359bd76088a965bb0cee7c44800bc46b2638807e",
676 "64205ccaa277e64eeea0c20e99900ac79858ca2c",
677 "2cdee35d43d62da09b4ddfddbd0948ddbb9fc48e",
678 "91f988f575338505ba8a40727865a8d3f2298624",
679 "d2b4557492ebb2e0f640a0a2f6fc3bdc8d8f36f9",
680 "421e8b608378e4f17774dd32ea6446fa0fa16f91",
681 "3b7488731da48635d86be551ab7c8c0f91c78219",
682 "4fd49cb49853ef950fd0b7e2e35718a71c8374c7",
683 "e15a355fc09bfd22267917898e2266168ff410e3",
684 "7a9c326a56a94621377a7258be70ba50042ca9a2",
685 "f994fb5019bf4c1a96eccf89af599eae0aa6b412",
686 "3a71ad6fef147067641e49a5f69b2454e3a5010d",
687 "ea10eac72830dcae19bcb16a076c2b21d844b5b6",
688 "add949d009217ef2b847e34772ba363e4be7b1b8",
689 "0b58666deb3615e912896a764e5c6475989e95e4",
690 "ea74c00c45569007383b632d7f1d2adc82645717",
691 "5ac22e1a33b0204fdc7a68d54ee94648e96079a0",
692 "9dc776c5ab8256b1301c7d1da60544a9410e6715",
693 "46f772c2832b3aad584674db666bd63e48b4f338",
694 "a9f9ca0049235db51ab7359a5fc3d21be42d2aac",
695 "f3dc739da41fb299637c8660e8c46917ddcf87a8",
696 "abd2fff80f74b311072ecdb91ce9ceba268fa6e9",
697 "9ae38bb94c7b4c0c6dfebbee23d1de4db9b77488",
698 "8269b32b4a34440f1fa37927308debc7eb85f3fa",
699 "65b2c868790806be7ab4aaa6114d445c42a31f98",
700 "678979a45126a76eb629992cd64734862f53a555",
701 "2f7ba8803604c032cb1a1228bc021f0f1c03e245",
702 "52e7c2f8b01592898c13f1e7633881e350244209",
703 "d9d5556b77301952b4caf113337720966bc8e1f5",
704 "e58d9c0acf0219d0839e1dbd162e08a765ed7f0f",
705 "34ca0f9660e1889f9f2c0deb80535d3c4f349fa4",
706 "2c07272462c68cf5944b03e2aa049475b99143c5",
707 "07ca369fb875d37b9cf855045f528af1827edec4",
708 "5e9e3e71b06c5efe20f93b3838e745b40b878471",
709 "153ae5c9fc2a31b38c4878b25d9026b9f51f132d",
710 "488341e88810d737de0b26de4e4d4fa0e78eb482",
711 "5a42b7eeff8198e7b005e4afa4282e6ffb939906",
712 "26bc25a011e2b60961ee9d6c6141d928ae24389b",
713 "6a1f6e1d494bf6b0ece7af5fa164ebaadb3a19bd",
714 NULL
715 };
716
717 static const char *sha1_graphics_8_grayscale[] =
718 {
719 "41728d7ff2bb425b5fc06521adeabf6cc73136f3",
720 "df35491dd5038187c05bac06921402ba6d7773a8",
721 "c8cd6d34e011d5f9ca4b1190eec3b416e5e68e53",
722 "66a686ac22cd0ec326f2c97ef473781cabe9690b",
723 "9bddef7b97b8b03569f07011e66ddd67fe82d787",
724 "2a4cea20974bcfb92cf40b05746fc7eb465c4b0f",
725 "0a87689ca33f888f05dbfa21ddec11c069990d8b",
726 "8d0a92e6333e1b99591962e2def9bc9121111cf5",
727 "409c9f29f6fa2e312c8e0b4b3c59acb4d84d8717",
728 "1fbc234c28a8140965ad0fe30b4b799f6681e864",
729 "1fc709d5d3e55d5f96c451c209cd73c59dbfe733",
730 "96b6a32e057d5faeae57086cbb62a8e7b3e6e86f",
731 "aa66ea7c9b7214339858b9fc9bd4720d05e8c843",
732 "114bb377b4e78a1978e1ac09388c48861b5223a3",
733 "8d0a92e6333e1b99591962e2def9bc9121111cf5",
734 "9dc511d6947fe816185cdff93bf0cfe0349b72b4",
735 "216388ddf6b563dd2058a9df65b40b6f72df1715",
736 "47f72be971bd2d3399dabd018201f4f5075e96fe",
737 "f39ab890a2b99d0c31e6e047f2315244972f5ffd",
738 "15b991814d84d6aa252696dd0c6150ef88a8db3f",
739 "1cb52f2a4d17b9b0d8375d016aa8cf0677fcd29a",
740 "9a6cfd68523e40ea1d52847d7747da912cfe2ca9",
741 "b6785a410048bb85e7ea3f0492459972103c935e",
742 "82e641ebe47d9f8cc229b82b8315e69e52f812b1",
743 "15db343049e3a9b31addc5d2ffebc3fe91b39c51",
744 "a895daf1f20371d4d1c3f93c070124cc13e341c3",
745 "3ddc872384ed8f9eaef472aa14a1d79a2c3f3b04",
746 "bd7d8c1cb4b2adc31cf8c7d39a4fa1e3ac7f2545",
747 "33fc8618ce62f5cdd9e06ad61e296f718a99899e",
748 "dcaa7fe030ae4d3029e38ca584047eeb2d17fe10",
749 "6d41e6168662e75baacf74d911d7419d54c8d73c",
750 "2404952157ba1519094a2da6bfbf2b0f1356432d",
751 "24caede65b40815a60b83c4edfa06bdc542388cd",
752 "650a51bedd1af92469d2950eb95220db35f95c6e",
753 "3f43aa11e6fccb747cc13224583fb2f951fee08c",
754 "b83f78ae85df87fc7af565db276c60c102274f20",
755 "1bd06e4e11929e5e91c3c9f20def639b20e731e8",
756 "d63a6086547e90d2ba84aaebfeae24f3ba0c04f1",
757 "85425940daf119125deb52421b2057acebe6d1cf",
758 "9869b6f088822fb423996f9968e5a931301fc2c3",
759 "a7f81cf3326fa3608acc13cfce2f573912e9d745",
760 "e9c16e43a8f589ae85289c5c3ffea6b22fba1806",
761 "84a4bc0c2c5d36d016da4df95a5d8d6c8ce3ba6f",
762 "1bd2587399006eed0d46beff397d32081f6bc58e",
763 "640a49455acabca6954a7fbb6af4e872af342d11",
764 "589e7911e09332ee090371deae17b0120ff990b5",
765 "a1a941fa270cda48c648553ed4b427e16e96f8e0",
766 "115c90df05b1ff754dbdfe2a712ef126034d952d",
767 "fb63bbb2f944fb63ed2d7399f07b168740c1034b",
768 "ae45f0d463ff916f3cb630103969fd49e8d09ef4",
769 "2becf041f83d22ac072fef5e0efd9bc1572796fd",
770 "3685c9ae95118a83db3569832c29753276fa1264",
771 "09640bad951c33e7d70a1fced83b1869f65b3fc5",
772 "5eb00252664ec39e61359adb1dade4906a87a248",
773 "ee7b9b292ea9fb559ef5ebf6a2a5586d38c7f854",
774 "dcad1a146c1d0ec2c4cc7f64bd4f45c57a604bfe",
775 "0ca8775d9a61ccc251d1e6f2e3cfd26a24ae24a2",
776 "17ae603c199a5d6695d198a7f36e6d7263990951",
777 "1918a33f59d3500204ffc573318a39e9ff754221",
778 "5449d1aef0d2d6af9ac3fd7adb32c23ddc9be1e2",
779 "55d302ece31a9b7fc4be4a07a53767ba210273e7",
780 "a6a29836291f9dbca85e25cee60f62ef5faca6d7",
781 "3494a23633405e46af96cb57715617fef1ac252e",
782 "edc1ad2704452354aa6f79fac244a55b6f509c2e",
783 "a3eac75d30f681b3898ee469d368960529634d7d",
784 "e2b393dc3f5833f7868668ea31369e90348768cd",
785 NULL
786 };
787
788 static const char *sha1_graphics_8[] =
789 {
790 "41728d7ff2bb425b5fc06521adeabf6cc73136f3",
791 "512246d4886ab889a090b167ba194577cb95272e",
792 "921e852d4564cb9e5ac15ff68b5207bebea871d1",
793 "9636b0ebefc443ea11949ccd28f6ca454277dd41",
794 "aa9050da55e6b6957c60b7d603fce539cb5c0048",
795 "e2b93aca15fb1233ac09a713dced1f4cd950b1e4",
796 "3e3a603fc26cc305aa27f88da7d2a3b0073877d8",
797 "390b2bf70daba36310683f46af9cd50b9a061396",
798 "82d21737e9a7247397a6c983a9b6d9a0452dd74d",
799 "2a8460af91675e01cbe9384eb6cd3eb2cb420960",
800 "1af53b1218ee9844fcda891b836d42f6b2f66bd5",
801 "da1cc34a9d9b779fc7849e03e214096026506464",
802 "5ba8f99ca034666effa556748c49a0f5a015125f",
803 "b67ba2f55659c75ac72c1112494461bb3086e1a4",
804 "73e2859ce849f756f954718ce3c90f02e31712b6",
805 "b1dff0f5dd233b44ee568878c5d3f8ae1d80c6d9",
806 "1f27dc1a1316fb7a4a78fe40fcd4bdae3aaad218",
807 "6e375e1485a1e45ac6ab10af49645d5fb2e76dff",
808 "cfc67c325c7cdf96d90af9b3cceb8d0504cbb3b0",
809 "7262364067e03c7fa498af1d59d228d6c63b460e",
810 "5241241a355a667ef0834049adf4218e8b3f16b8",
811 "db22d666690948eb966f75b796c72c7150a5c4b9",
812 "af21fb2645b568b049549de375584c4aa3055143",
813 "1f13ea0034db4b0ffa4ddcff9664fd892058f9cd",
814 "3caf512cfddfd463d0750cfe3cadb58548eb2ae8",
815 "4e5e7d5fd64818b2b3d3e793c88f603b699d2f0f",
816 "c4efce8f7ed2d380ea5dc6fe1ef8448a27827532",
817 "d599bf210423fe3adbb4f1de87d9360de97827d0",
818 "bae7c8b789e4e9b336c03c4daee3bce63fe039d9",
819 "cc01f17928f7780cefd423ea653b072eea723a1b",
820 "c005662a47f14c2f1b7c7fb3b0ef0fc390c6ea6a",
821 "675cde16a6ad2bcd8d7e72780b07a0ccd8d0393a",
822 "ea39ac62ca2f815a1d029340c6465994b6f03cb0",
823 "9a603513cd81acf70cf8b27b0d544e7f672e9d40",
824 "f4a334e69535de74ee5ed54be93a75120a66e54a",
825 "f751a55fb738b63b6fd7c229c33ef92605d0c9c1",
826 "61907a6685bba93077da40cfb28cf2ab74552fd2",
827 "122015e5e17c1c317c6e51c0e207826b606a4077",
828 "c21851589a5f8a45ea5f9bb3e72f4f88d0a6697d",
829 "eb2ce16a6ae251f4965135ee776776b5fc02c42c",
830 "acead2745fec0b6c817fa601353bdf2d197b64f7",
831 "1f1379089d7c6e8d733aaa4eaffbe02db6255b61",
832 "d83adc669c0dea0dc4812b93f998514b6f02d805",
833 "9e8ceb7c3cd68e043b6d875c8c84a1e394962412",
834 "9e996fc74eeef53f0a6c31aabb2edce6e103f189",
835 "6b8abd1785304d6531c1e4cc65c1ffcdcb2196a5",
836 "7d1bfff706b0713e53209407889f83a0da26a81d",
837 "5a1d8f9ea978b820edbc5c9e1c6f1cac022620ad",
838 "31e667c2dbb81dcf81d01cb88f794e88ddb90ff2",
839 "c404446958788fac00ee1eff571d682bc21dd7ac",
840 "95060f3dc9e6d01ada42f09a871b69f0699cb77c",
841 "465d9cd0a77ab4fcf035aa67544b2a26269e0b09",
842 "600d6b2713d5e4c0d90c02660245ed26c7ae3033",
843 "0025a440866a404523a8a20e79a8891e45a2ff56",
844 "c04d335933895f836f0a28c1e3f7f444352c3b8e",
845 "bd28d77cd85b20a2384d6b25082cfd884bba683e",
846 "7e591ec8ae9bb61c3a443c93f071cab2b8978394",
847 "f81c70b6ee2d4690f9f7c797c66582b176f8dcef",
848 "d3f359cac7318ce09e0531d51c8c2b316cf3a23b",
849 "293c41a7ed923a4617560481ae8815cebf83701a",
850 "ec06b56f3abe277be42650ebd49dabeaae9e756d",
851 "750c923785ba2afb9ce597516c072f90f014bf95",
852 "bde5a62a065c027561226fbec5155e938ba7f6b3",
853 "fbaa8848a1d3896469c37fd43ab44233f5b875a3",
854 "c2ac98ef716fd8a5ac8f08ce66293d9a96344337",
855 NULL
856 };
857
858 static const char *sha1_graphics_4[] =
859 {
860 "fa867e2976a549ecd3b1fa67df54963232fcef8c",
861 "256d742b4da96b373b4fa5663d0ad3b5faab5c8e",
862 "d96d8f4232b930bccd53b903b5efaf8c0bdb16f4",
863 "9401799e6116c35e5f0e5bdca07ea25316757a72",
864 "482ae2b0ef1d64752b5ef11cc7f35a33eb55d07c",
865 "dcfb3e01100b41c0f75a1c5f84b6de6b90138281",
866 "2505598845fa026ea7187582461efbf06cb6904f",
867 "3981a19363beca8f28d32a5928ac296fd22a5296",
868 "01404024ebb2c266d17d734059524d874491650f",
869 "c87bbff3f83b8ec11bb03cfa9bc9ee5166c4c7ef",
870 "f35c5d62853be78c5d39fb2f45200dc262aa8e18",
871 "46e94a55f5f58a6b915078d8ffdc725f53aab516",
872 "665bbbc749a5ffeedc0d62aef0661a5ce845b017",
873 "1f26a01730f67d40ea711a50d9d801bac15a642e",
874 "3b53d24178cfacba53103a44dfd5d072b15a6781",
875 "c52cfd57f26037723d37192722fc3a217f280c9e",
876 "e34da6500cf2e424d980714d92737cf6c31a7bda",
877 "d17f4358ae529f920960ed89e535902ee13b0033",
878 "0f44e12ecd1ea7e39433890443626d4fc35204a4",
879 "eb38683e812fd13dca971ba8f4cfd2b6820d3524",
880 "73bbc83f88f1aaa6df0158b63e70bb3165163163",
881 "0dc2690a5c58a2907a8ab06693ebfab6698172eb",
882 "df5f0d6574bdf1781754b5b9f98232a77e439e33",
883 "39c16648cf6c261be71a33cec41867f28e119b94",
884 "26ad5116562e7b58c76a26eaf521e2e40899e944",
885 "1bcc54eaf8e3c2b7c59ecccb23c240181d7ba8b8",
886 "4f827ca6927f15191588456f985bf29d2a3b3c24",
887 "6fb102d020e5554116feefc8482104f3ae2036d2",
888 "ae546ffd30b837afc7dfcb5c9ce4f01d15b35ddc",
889 "20c9eb3276c08fdce35755e349bec94b04929812",
890 "628d837163a25c6520f19c0602383176dbad528e",
891 "b5a12cff7100290ad43f5ed17a321b42de048893",
892 "b672afbeeafb44194a821f0def81a8892872937e",
893 "db0124045882b598feea192186cf7eb7a0387866",
894 "602d91471378fe24a2d0248bd8a92b624f099fea",
895 "c93a86adfe58dc2d461f2ed962883d6b90888848",
896 "21aa1ff238a2d78efed1aa658ac8fe21b1e64daa",
897 "1a579cd280422131c35e907a023ee0e80749b5a4",
898 "bbf027f506cbb80d359bf4892fcb75f816f2e446",
899 "ed44bded6b17df7fe92b191fd810d1aafbd55f52",
900 "a49bcb1ace42d548254d9e96d22088b1fe2e75b4",
901 "e2a21a965dfd0bd09f9270917f681610efc18ce7",
902 "3e411b004a5be84451860c6da6a4a1a482b77862",
903 "3b3d2f18fdc75e938ca43cc2d0b41fa67c1c5d36",
904 "7811c536a6527112b438a6413f3927f2c79086a7",
905 "525ef3615040225752a2fe646ab99ee64e360630",
906 "46760975993f9881b7bbe94123173e6a683d3f25",
907 "c644f460937107214a88d5eb9e846d27abd8c874",
908 "df5feb905a31c288008cf5e82d73ac818a160d82",
909 "4f9658dde0432a711a4d783c1b5aa3365fb7d54b",
910 "09438163dcbede3890a0e6d8e614c97a06759380",
911 "d8af3868c66c7d6dac35ec8ee0317b38a6910bb1",
912 "ec8e2aebfb4a1c28ebcd0e053b9e4d8638b50951",
913 "ccf8d11b1e81895e9781f17c227c821228d8714b",
914 "f751e26578193afe6a727ee2a52318c404c56555",
915 "28a6b9f7927e99e53cf46f0333d29168cb10e920",
916 "029552113292cc110fd6b7888e766628950aaeef",
917 "297f6ad15200bffbf15198324ee8f27a61a6f2d4",
918 "70cfa427a1a0d6f2232b1fd544905d48af69cb98",
919 "287ea7db721e641439888cb9f4bac3a5f16124eb",
920 "dd9eaa5325cdf250e89162ac84207978ebb6458e",
921 "42466aab11852741d937c1ff6f3bb711e58415a6",
922 "3024fa38333f83a639b0f0e6ac6d4b9868231157",
923 "7ae780dcc7cf04dda50648bfc07cc6a7a2f2189e",
924 "9ab46e0c42f82dc73df8a55cbf881abd72397cec",
925 NULL
926 };
927
928 static const char *sha1_graphics_4_grayscale[] =
929 {
930 "fa867e2976a549ecd3b1fa67df54963232fcef8c",
931 "6611ea6cb24bcf34c5f3688d57e2874aecb39c24",
932 "5ab1d3f8f5938c5d20a2fa3237e319077b21e716",
933 "1c201d149c0bd886ff8a427ad513f15a70991174",
934 "44646e67842a4d055bea1fad0434e6e4a0eb5465",
935 "315189097a02024d2eae61d524c4de07a396aee7",
936 "73ac786015dea36ac466a6524dba757d5d238ece",
937 "6e328cc4d53627f034b23706d8bf26afe18512ae",
938 "3c5b90cfeafdc1c99c8c62317d07276fdf66803e",
939 "95e6f509bb1cf9981efc47a0878ab0bd983eb349",
940 "2e1bc3b00e4ecc62b03785533dc0faeeda38d53f",
941 "6448226859cab61a61c95d3ed5ed5f216b1bb120",
942 "7f1cb06597b14edbea03b860aec3cebc4ebc3d62",
943 "ec3879342b5a44f6de6efe946243ae5ade00980d",
944 "6e328cc4d53627f034b23706d8bf26afe18512ae",
945 "51b50968a3a0570d5ed690fe44ba1a78a4d62ce2",
946 "d5bab61f78ac3355aa2e0776b2d5d9d71d61e77b",
947 "fa47c5195405f6a0eefba3e3a60ad463c7ee94c7",
948 "b2bda683edef912957845a33edc055902a801fed",
949 "b067f0421cb2c83b218b8ab6edbede2ff5723b57",
950 "c8de76f9c0900e5f86c7584fe94d5749376b7b49",
951 "43ee3e187dda14b86aef12371041ae70313b5a65",
952 "7fab79b7f1a5cb2ec31ed8eeaf213b3d8dcde4d8",
953 "d4930552a7845111ffd9db57260be1ab97967c06",
954 "afdf41fca7951c6dd6193320de1295f2c68fe52a",
955 "f2f1f331fe6b1b31d7c9ddd37793b375fc01d3d4",
956 "f0af0f1edcb837bdf1535c1f5e9988c21ae9bfd1",
957 "71c4577baaf35f12f6707b1e2f78a1e8c0d41d0b",
958 "9b7d6b12385bb9e1cd881758aff342bd5427432b",
959 "6fdd5aa022da2a8af6f1d02b6072ebc068b4b600",
960 "643fab30f1a59dc37f1e0f1a6006076fbf90a5fe",
961 "6edbc0b95e9ae3348ce7d12c44f9c8082b5f2aa9",
962 "9c0da52c4ceaa8fdfcff7351328dd520bb57e985",
963 "f8224430462f6a93f85ef33b8aa7299525990708",
964 "1cf93cecc942b41ab8fae21ea18418a6d64873e5",
965 "71a1705ee14068ee8c6c6680c1bd99703fb6abd7",
966 "94438c82b8812fe81a69d5d1429c5967cdbfed7a",
967 "764ea26f10fe11f7bdb538a26fc33d44b3a95d6d",
968 "94ad53c578f6034dfc5c666e363203cdfb00f2cc",
969 "8cd7b0ba8426db344b4cb8820890603020ed65e9",
970 "ad96132f25ca14e1aeb17c86f8d187febf6401c9",
971 "027b05bc82ce4f897c4bf812610a641547368939",
972 "3f131e855ba1611d8fb0f16a6979f8f56aacc7f3",
973 "ae64d1dc52dcfa8c644f953c4601fa2fbefec37b",
974 "2f3fb1bd8f416198d70e06f6d519571cd5eb4ef4",
975 "cc96ccaf6b99f60a49b03017515f83cba22b4c40",
976 "5eeb56afea8040a8fb18c11f29931b836474126d",
977 "30c256a783c4874261667bb31307eb282ab9470e",
978 "f8681c09f1abfc38d31e47622cb8798cd896a00e",
979 "0ba7e5d68419702605739acb52fcc01c96cb63d4",
980 "f8d2f196ba8a16f54acb934e61a759ab7d3f2f05",
981 "b5ee51cfc73acb59a2f6124509ea236f8fc7f9f7",
982 "d374d4d92c940ae42a9b42c14d744341b68a8c14",
983 "06a6a224be0f5cdc51ac4704f9f57fc1f3813d6f",
984 "c47c2dc806b6b8ff28f300949695d013a46c0083",
985 "ada3b7c34946e584dcdf4203e07cfa3dad02bc63",
986 "c2f61571b067a44b30f56b4658c9606f0edfc0f3",
987 "58f400c9bb78e49a879276fb049edfc9c981740a",
988 "cb3794f676d6e9502f27172ac7d79a12ca2ba32c",
989 "aa89612798fbc4e11a73b6233c0ac4832e6af2f9",
990 "c96a998be5c1d588ef1243cfd2610d056d16947e",
991 "68bee638d59a373f33f308751471b3ef41849582",
992 "8fa37e26cdae406c2d1c81b1175dcf0311cf60c9",
993 "2d5123e757cf00e423a89160d7dc4997c3688829",
994 "36dfdad9f3f5cfde6add3cef23368c343d30469a",
995 NULL
996 };
997
998 static const char *sha1_graphics_1[] =
999 {
1000 "23366004515f3bc46796ea505d748f8d0f97fbe1",
1001 "61ade9054d4477fb89cf830539a5e8b4e45f0688",
1002 "ac530c5dbaf837e15b2337347e974184fad73643",
1003 "95fdcda26262d5948a9ade77d83fd698e0031050",
1004 "1dd5cee06af78d026e5da8bfe3f45e1cf51faa13",
1005 "f6b61ecf03ad11752775faca1d4404c6bb5065f5",
1006 "d7ad44d6f377598268e9968333ae2cf23a0715ca",
1007 "5871339cd7e6cee12d4dc45934a89071c73efe6b",
1008 "69e9b85b34caf736069ba91e57a5c3fa7c891653",
1009 "21d5d9e47bb07de2cf7bc99b7725390d03a6cde6",
1010 "f69ee65ea25676429a28eea79b5b9cb9206b8d01",
1011 "39ff81f77ef4ee772367ed1a63785987c060126e",
1012 "4c686508a994ca4c7a0a73b8c0fe52423c180d9c",
1013 "b0cc1f5e244ae0c0835a9866a46abdfcd56d1cb1",
1014 "7ddf19df5bbdf4475b6ec1bc042425e382502864",
1015 "144c9a846e5e37ac6efd5ed3a97ec231479e8fca",
1016 "400a21caa01e015096ee1afcf1b54e7f8ec515bd",
1017 "144c9a846e5e37ac6efd5ed3a97ec231479e8fca",
1018 "a4964d8bbf80fe785f906bc0f7c5b113242a58fc",
1019 "adb2818f6d3845dd140bc0f9abdbaa89d2a8c3de",
1020 "13cc63972aee4f6ae27091a8af18de01f1d3a5da",
1021 "4d95c3d1e170f004c80aa8c52feafb8e0e90760e",
1022 "ef2db9fb75a672f69bab88e5d08fe64f50ec2bc4",
1023 "d1e6091caa4482d3142df3b958606c41ebf4698e",
1024 "07c1116d8286fb665a1005de220eadc3d5999aaf",
1025 "4afb0649488f6e6f7d3a2b8bf438d82f2c88f4d1",
1026 "f2fe295317e795a88edd0b2c52618b8cb0e7f2ce",
1027 "c86eeaeed09871dee4b43722ba512d2d3af7f4d0",
1028 "24b1a6241c81dbb950cfbe5da6798fd59eb36266",
1029 "1007d3b531b4bc3553d4547bc88443fc1f497cf6",
1030 "b71ca46be287598f716bb04fac0a52ad139c70db",
1031 "6589e48498e30ab036fbfe94d73427b2b1238a69",
1032 "4dce919117d2e41df9f5d4d0de14f97ae650046d",
1033 "22c2e078f69d73b7a5cb3f7dcbb8fbaa007ef3ac",
1034 "be36cda370650e6d5fb0570aeb8ced491d0c2b1c",
1035 "4c34cb8e47f9ff4b4348aa2d40cce7cb54d65cb0",
1036 "18f4497e43903e8df5b27da4ceebf62b15550a87",
1037 "399e988c922b7fad1c8f6907541c5dda65e60408",
1038 "2fcd25c2d19a01fa631fd19135d9f28b26b86259",
1039 "655cfadeb157233c804d42b58195569c8846e3c1",
1040 "65c8811c609203fd424f5ed5f92ca2268a1dca54",
1041 "a45b297d709e297584eb0f2985294ec0ab53d8ad",
1042 "0d180c37bc26d83a1a11f66168757f3de2493243",
1043 "b362ba4790def178c236c0ae7b0093dbba47cf24",
1044 "d1d2ecf71a37d9eda58fa09454aa871971428ace",
1045 "6672da4e016b6e9de0ca218f8307cce7d48d62c4",
1046 "ee22f43ea867228c6ff937d39e1826e285a107e8",
1047 "832c3c3afd056e5d1cdfb2f466f27225c4adcc6c",
1048 "a2a928de9007d765da496abec8c21b23601f8c45",
1049 "41a417c1f25f2619301afa44bfcde85198985792",
1050 "23366004515f3bc46796ea505d748f8d0f97fbe1",
1051 "ba682eb15c0ddffb942e6086e0ccad2353ed7241",
1052 "58273e1fbf961ff2c772d57160d60170e258d3fe",
1053 "88763f8e8fcf4f78fa864325791a9dd35a0bd279",
1054 "013cee26bac8f815eadad4bfc012d9b5d01c3b7f",
1055 "44a28536466dc895feb824b23dfd4a47c6948af8",
1056 "17468a3789f0a6d65c302bda735a01dc2c1a74d9",
1057 "781d8c5cbc28591fd48fce06f984c502fdc6b363",
1058 "df510792a7790cc699532b1420d43c6d4da2ae2f",
1059 "55c26d22f11d80b73383fa57d0fac552d705b092",
1060 "14443b33a9879bf829ed3b06e1aef0d7dcf662cc",
1061 "53ab1fcccd09fa5cbff77497f36a70a3b3cb8b81",
1062 "4842a30dd7fdf38ddc3ddec85c08efe13a0e2e0b",
1063 "cc76db6da5ba1776f20240a5ad97a26a9cdf96b0",
1064 "9ab50a663b74577b656e9849484a909d7ac52eeb",
1065 "8d34215487088b5d4ef63062270ce25c2862643d",
1066 "bbabe686a6955402c90530e7c67f1428868369b3",
1067 NULL
1068 };
1069
1070 static const RECT graphics_bounds[] =
1071 {
1072 { 0, 0, 0, 0 },
1073 { 10, 3, 219, 101 },
1074 { 100, 100, 301, 301 },
1075 { 0, 0, 201, 201 },
1076 { 10, 10, 110, 320 },
1077 { 10, 99, 300, 200 },
1078 { 99, 12, 201, 200 },
1079 { 90, 110, 300, 200 },
1080 { 90, 90, 210, 200 },
1081 { 10, 99, 300, 200 },
1082 { 10, 99, 300, 200 },
1083 { 99, 12, 201, 200 },
1084 { 99, 11, 201, 200 },
1085 { 90, 110, 300, 200 },
1086 { 90, 110, 300, 200 },
1087 { 10, 10, 365, 405 },
1088 { 10, 10, 365, 405 },
1089 { 10, 10, 365, 405 },
1090 { 10, 10, 365, 405 },
1091 { 10, 10, 365, 405 },
1092 { 10, 10, 365, 405 },
1093 { 10, 10, 365, 405 },
1094 { 10, 10, 365, 405 },
1095 { 10, 10, 350, 251 },
1096 { 10, 10, 300, 200 },
1097 { 300, 10, 9, 260 },
1098 { 10, 10, 435, 405 },
1099 { 10, 10, 120, 120 },
1100 { 10, 10, 110, 110 },
1101 { 10, 10, 120, 110 },
1102 { 10, 10, 110, 120 },
1103 { 10, 10, 120, 120 },
1104 { 10, 10, 110, 110 },
1105 { 10, 10, 120, 110 },
1106 { 10, 10, 110, 120 },
1107 { 0, 4, 356, 356 },
1108 { 100, 100, 356, 356 },
1109 { 50, 50, 306, 306 },
1110 { 100, 100, 356, 356 },
1111 { 100, 100, 356, 356 },
1112 { 100, 100, 356, 356 },
1113 { 100, 100, 356, 356 },
1114 { 100, 100, 356, 356 },
1115 { 100, 100, 356, 356 },
1116 { 100, 100, 356, 356 },
1117 { 100, 100, 356, 356 },
1118 { 100, 100, 356, 356 },
1119 { 10, 10, 356, 356 },
1120 { 100, 100, 356, 356 },
1121 { 0, 0, 260, 39 },
1122 { 0, 0, 16, 16 },
1123 { 10, 10, 416, 26 },
1124 { 10, 8, 60, 104 },
1125 { 0, 10, 511, 306 },
1126 { 0, 10, 512, 306 },
1127 { 1, 1, 300, 512 },
1128 { 0, 0, 500, 512 },
1129 { 5, 5, 206, 206 },
1130 { 45, 45, 256, 256 },
1131 { 86, 86, 215, 215 },
1132 { 45, 45, 256, 256 },
1133 { 8, 0, 392, 231 },
1134 { 8, 0, 392, 231 },
1135 { 0, 0, 60, 20 },
1136 { 0, 0, 512, 512 },
1137 { -1, -1, -1, -1 } /* the end */
1138 };
1139
1140 static const char **current_sha1;
1141 static const RECT *current_bounds;
1142 static const char *dst_format;
1143
1144 static inline DWORD get_stride(const BITMAPINFO *bmi)
1145 {
1146 return ((bmi->bmiHeader.biBitCount * bmi->bmiHeader.biWidth + 31) >> 3) & ~3;
1147 }
1148
1149 static inline DWORD get_dib_size(const BITMAPINFO *bmi)
1150 {
1151 return get_stride(bmi) * abs(bmi->bmiHeader.biHeight);
1152 }
1153
1154 static char *hash_dib(const BITMAPINFO *bmi, const void *bits)
1155 {
1156 DWORD dib_size = get_dib_size(bmi);
1157 HCRYPTHASH hash;
1158 char *buf;
1159 BYTE hash_buf[20];
1160 DWORD hash_size = sizeof(hash_buf);
1161 int i;
1162 static const char *hex = "0123456789abcdef";
1163
1164 if(!crypt_prov) return NULL;
1165
1166 if(!CryptCreateHash(crypt_prov, CALG_SHA1, 0, 0, &hash)) return NULL;
1167
1168 CryptHashData(hash, bits, dib_size, 0);
1169
1170 CryptGetHashParam(hash, HP_HASHVAL, NULL, &hash_size, 0);
1171 if(hash_size != sizeof(hash_buf)) return NULL;
1172
1173 CryptGetHashParam(hash, HP_HASHVAL, hash_buf, &hash_size, 0);
1174 CryptDestroyHash(hash);
1175
1176 buf = HeapAlloc(GetProcessHeap(), 0, hash_size * 2 + 1);
1177
1178 for(i = 0; i < hash_size; i++)
1179 {
1180 buf[i * 2] = hex[hash_buf[i] >> 4];
1181 buf[i * 2 + 1] = hex[hash_buf[i] & 0xf];
1182 }
1183 buf[i * 2] = '\0';
1184
1185 return buf;
1186 }
1187
1188 static void reset_bounds( HDC hdc )
1189 {
1190 current_bounds = graphics_bounds;
1191 SetBoundsRect( hdc, NULL, DCB_RESET | DCB_ENABLE );
1192 }
1193
1194 static void compare_bounds( HDC hdc, const char *info )
1195 {
1196 RECT rect;
1197
1198 GetBoundsRect( hdc, &rect, DCB_RESET );
1199
1200 if (current_bounds->left == -1 &&
1201 current_bounds->top == -1 &&
1202 current_bounds->right == -1 &&
1203 current_bounds->bottom == -1)
1204 {
1205 ok( 0, "missing bounds, got %s,\n", wine_dbgstr_rect( &rect ));
1206 return;
1207 }
1208
1209 ok( EqualRect( current_bounds, &rect ), "%s: %s: expected bounds %s got %s\n", dst_format, info,
1210 wine_dbgstr_rect( current_bounds ), wine_dbgstr_rect( &rect ));
1211 current_bounds++;
1212 }
1213
1214 static void compare_hash_broken_todo(HDC hdc, const BITMAPINFO *bmi, BYTE *bits, const char *info, int num_broken, BOOL todo)
1215 {
1216 char *hash = hash_dib(bmi, bits);
1217 BOOL ok_cond;
1218 int i;
1219
1220 /* reset the bits for the next test */
1221 memset( bits, 0xcc, get_dib_size(bmi) );
1222
1223 if(!hash)
1224 {
1225 skip("SHA1 hashing unavailable on this platform\n");
1226 return;
1227 }
1228
1229 for(i = 0; i <= num_broken; i++)
1230 {
1231 if(current_sha1[i] == NULL)
1232 {
1233 ok(current_sha1[i] != NULL, "missing hash, got \"%s\",\n", hash);
1234 HeapFree(GetProcessHeap(), 0, hash);
1235 return;
1236 }
1237 }
1238
1239 ok_cond = !strcmp(hash, *current_sha1);
1240
1241 for(i = 1; i <= num_broken; i++)
1242 ok_cond = ok_cond || broken( !strcmp(hash, current_sha1[i]) );
1243
1244 todo_wine_if(todo)
1245 ok( ok_cond, "%s: %s: expected hash %s got %s\n",
1246 dst_format, info, *current_sha1, hash );
1247
1248 current_sha1 += num_broken + 1;
1249
1250 HeapFree(GetProcessHeap(), 0, hash);
1251
1252 compare_bounds( hdc, info );
1253 }
1254
1255 static void compare_hash(HDC hdc, const BITMAPINFO *bmi, BYTE *bits, const char *info)
1256 {
1257 compare_hash_broken_todo(hdc, bmi, bits, info, 0, FALSE);
1258 }
1259
1260 static const RECT bias_check[] =
1261 {
1262 {100, 100, 200, 150},
1263 {100, 100, 150, 200},
1264 {100, 100, 50, 200},
1265 {100, 100, 0, 150},
1266 {100, 100, 0, 50},
1267 {100, 100, 50, 0},
1268 {100, 100, 150, 0},
1269 {100, 100, 200, 50}
1270 };
1271
1272 static const RECT hline_clips[] =
1273 {
1274 {120, 120, 140, 120}, /* unclipped */
1275 {100, 122, 140, 122}, /* l edgecase */
1276 { 99, 124, 140, 124}, /* l edgecase clipped */
1277 {120, 126, 200, 126}, /* r edgecase */
1278 {120, 128, 201, 128}, /* r edgecase clipped */
1279 { 99, 130, 201, 130}, /* l and r clipped */
1280 {120, 100, 140, 100}, /* t edgecase */
1281 {120, 99, 140, 99}, /* t edgecase clipped */
1282 {120, 199, 140, 199}, /* b edgecase */
1283 {120, 200, 140, 200}, /* b edgecase clipped */
1284 {120, 132, 310, 132}, /* inside two clip rects */
1285 { 10, 134, 101, 134}, /* r end on l edgecase */
1286 { 10, 136, 100, 136}, /* r end on l edgecase clipped */
1287 {199, 138, 220, 138}, /* l end on r edgecase */
1288 {200, 140, 220, 140} /* l end on r edgecase clipped */
1289 };
1290
1291 static const RECT vline_clips[] =
1292 {
1293 {120, 120, 120, 140}, /* unclipped */
1294 {100, 120, 100, 140}, /* l edgecase */
1295 { 99, 120, 99, 140}, /* l edgecase clipped */
1296 {199, 120, 199, 140}, /* r edgecase */
1297 {200, 120, 200, 140}, /* r edgecase clipped */
1298 {122, 99, 122, 201}, /* t and b clipped */
1299 {124, 100, 124, 140}, /* t edgecase */
1300 {126, 99, 126, 140}, /* t edgecase clipped */
1301 {128, 120, 128, 200}, /* b edgecase */
1302 {130, 120, 130, 201}, /* b edgecase clipped */
1303 {132, 12, 132, 140}, /* inside two clip rects */
1304 {134, 90, 134, 101}, /* b end on t edgecase */
1305 {136, 90, 136, 100}, /* b end on t edgecase clipped */
1306 {138, 199, 138, 220}, /* t end on b edgecase */
1307 {140, 200, 140, 220} /* t end on b edgecase clipped */
1308 };
1309
1310 static const RECT line_clips[] =
1311 {
1312 { 90, 110, 310, 120},
1313 { 90, 120, 295, 130},
1314 { 90, 190, 110, 240}, /* totally clipped, moving outcodes */
1315 { 90, 130, 100, 135}, /* totally clipped, end pt on l edge */
1316 { 90, 132, 101, 137}, /* end pt just inside l edge */
1317 {200, 140, 210, 141}, /* totally clipped, start pt on r edge */
1318 {199, 142, 210, 143} /* start pt just inside r edge */
1319 };
1320
1321 static const RECT wide_lines[] =
1322 {
1323 {100, 10, 200, 10},
1324 {100, 21, 200, 21},
1325 {200, 40, 100, 40},
1326 {200, 61, 100, 61},
1327 { 10, 100, 10, 200},
1328 { 21, 100, 21, 200},
1329 { 40, 200, 40, 100},
1330 { 61, 200, 61, 100},
1331 };
1332
1333 static const POINT poly_lines[] =
1334 {
1335 {100, 100}, {200, 100}, {200, 200}, {100, 200}
1336 };
1337
1338 static const POINT polypoly_lines[] =
1339 {
1340 {100, 100}, {200, 100}, {200, 100}, {200, 200}
1341 };
1342
1343 static const DWORD polypoly_counts[] =
1344 {
1345 sizeof(polypoly_lines)/sizeof(polypoly_lines[0])
1346 };
1347
1348 static const RECT patblt_clips[] =
1349 {
1350 {120, 120, 140, 126}, /* unclipped */
1351 {100, 130, 140, 136}, /* l edgecase */
1352 { 99, 140, 140, 146}, /* l edgecase clipped */
1353 {180, 130, 200, 136}, /* r edgecase */
1354 {180, 140, 201, 146}, /* r edgecase clipped */
1355 {120, 100, 130, 110}, /* t edgecase */
1356 {140, 99, 150, 110}, /* t edgecase clipped */
1357 {120, 180, 130, 200}, /* b edgecase */
1358 {140, 180, 150, 201}, /* b edgecase */
1359 {199, 150, 210, 156}, /* l edge on r edgecase */
1360 {200, 160, 210, 166}, /* l edge on r edgecase clipped */
1361 { 90, 150, 101, 156}, /* r edge on l edgecase */
1362 { 90, 160, 100, 166}, /* r edge on l edgecase clipped */
1363 {160, 90, 166, 101}, /* b edge on t edgecase */
1364 {170, 90, 176, 101}, /* b edge on t edgecase clipped */
1365 {160, 199, 166, 210}, /* t edge on b edgecase */
1366 {170, 200, 176, 210}, /* t edge on b edgecase clipped */
1367 };
1368
1369 static const RECT rectangles[] =
1370 {
1371 {10, 11, 100, 101},
1372 {250, 100, 350, 10},
1373 {120, 10, 120, 20}, /* zero width */
1374 {120, 10, 130, 10}, /* zero height */
1375 {120, 40, 121, 41}, /* 1 x 1 */
1376 {130, 50, 132, 52}, /* 2 x 2 */
1377 {140, 60, 143, 63}, /* 3 x 3 */
1378 {150, 70, 154, 74}, /* 4 x 4 */
1379 {120, 20, 121, 30}, /* width == 1 */
1380 {130, 20, 132, 30}, /* width == 2 */
1381 {140, 20, 143, 30}, /* width == 3 */
1382 {200, 20, 210, 21}, /* height == 1 */
1383 {200, 30, 210, 32}, /* height == 2 */
1384 {200, 40, 210, 43} /* height == 3 */
1385 };
1386
1387 static const BITMAPINFOHEADER dib_brush_header_8888 = {sizeof(BITMAPINFOHEADER), 16, -16, 1, 32, BI_RGB, 0, 0, 0, 0, 0};
1388 static const BITMAPINFOHEADER dib_brush_header_24 = {sizeof(BITMAPINFOHEADER), 16, -16, 1, 24, BI_RGB, 0, 0, 0, 0, 0};
1389 static const BITMAPINFOHEADER dib_brush_header_555 = {sizeof(BITMAPINFOHEADER), 16, -16, 1, 16, BI_RGB, 0, 0, 0, 0, 0};
1390 static const BITMAPINFOHEADER dib_brush_header_8 = {sizeof(BITMAPINFOHEADER), 16, -16, 1, 8, BI_RGB, 0, 0, 0, 0, 0};
1391 static const BITMAPINFOHEADER dib_brush_header_4 = {sizeof(BITMAPINFOHEADER), 16, -16, 1, 4, BI_RGB, 0, 0, 0, 0, 0};
1392 static const BITMAPINFOHEADER dib_brush_header_1 = {sizeof(BITMAPINFOHEADER), 16, -16, 1, 1, BI_RGB, 0, 0, 0, 0, 0};
1393
1394 static const BYTE rle8_data[20] = { 0x03, 0x02, 0x04, 0xf0, 0x00, 0x00, /* 2, 2, 2, f0, f0, f0, f0, <eol> */
1395 0x00, 0x03, 0x04, 0x05, 0x06, 0x00, /* 4, 5, 6, <pad> */
1396 0x00, 0x02, 0x01, 0x02, 0x05, 0x80, /* dx=1, dy=2, 80, 80, 80, 80, (80) */
1397 0x00, 0x01 }; /* <eod> */
1398
1399 static const DWORD four_by_four_data[16] = { 0x000000, 0xff0000, 0x00ff00, 0x0000ff,
1400 0xffffff, 0x00ffff, 0xff00ff, 0xffff00,
1401 0x000000, 0xff0000, 0x00ff00, 0x0000ff,
1402 0xffffff, 0x00ffff, 0xff00ff, 0xffff00 };
1403
1404 static const DWORD ddb_brush_bits[8] = { 0x11112222, 0x33334444, 0x55556666, 0x77778888,
1405 0xaaaaaaaa, 0x00000000, 0x98765432, 0xabcdef00 };
1406
1407 static const RGBQUAD default_palette_1[2] =
1408 {
1409 { 0x00, 0x00, 0x00 }, { 0xff, 0xff, 0xff }
1410 };
1411
1412 static const RGBQUAD default_palette_4[16] =
1413 {
1414 { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x80 }, { 0x00, 0x80, 0x00 }, { 0x00, 0x80, 0x80 },
1415 { 0x80, 0x00, 0x00 }, { 0x80, 0x00, 0x80 }, { 0x80, 0x80, 0x00 }, { 0x80, 0x80, 0x80 },
1416 { 0xc0, 0xc0, 0xc0 }, { 0x00, 0x00, 0xff }, { 0x00, 0xff, 0x00 }, { 0x00, 0xff, 0xff },
1417 { 0xff, 0x00, 0x00 }, { 0xff, 0x00, 0xff }, { 0xff, 0xff, 0x00 }, { 0xff, 0xff, 0xff },
1418 };
1419
1420 static const RGBQUAD default_palette_8[256] =
1421 {
1422 { 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0x80 }, { 0x00, 0x80, 0x00 }, { 0x00, 0x80, 0x80 },
1423 { 0x80, 0x00, 0x00 }, { 0x80, 0x00, 0x80 }, { 0x80, 0x80, 0x00 }, { 0xc0, 0xc0, 0xc0 },
1424 { 0xc0, 0xdc, 0xc0 }, { 0xf0, 0xca, 0xa6 }, { 0x00, 0x20, 0x40 }, { 0x00, 0x20, 0x60 },
1425 { 0x00, 0x20, 0x80 }, { 0x00, 0x20, 0xa0 }, { 0x00, 0x20, 0xc0 }, { 0x00, 0x20, 0xe0 },
1426 { 0x00, 0x40, 0x00 }, { 0x00, 0x40, 0x20 }, { 0x00, 0x40, 0x40 }, { 0x00, 0x40, 0x60 },
1427 { 0x00, 0x40, 0x80 }, { 0x00, 0x40, 0xa0 }, { 0x00, 0x40, 0xc0 }, { 0x00, 0x40, 0xe0 },
1428 { 0x00, 0x60, 0x00 }, { 0x00, 0x60, 0x20 }, { 0x00, 0x60, 0x40 }, { 0x00, 0x60, 0x60 },
1429 { 0x00, 0x60, 0x80 }, { 0x00, 0x60, 0xa0 }, { 0x00, 0x60, 0xc0 }, { 0x00, 0x60, 0xe0 },
1430 { 0x00, 0x80, 0x00 }, { 0x00, 0x80, 0x20 }, { 0x00, 0x80, 0x40 }, { 0x00, 0x80, 0x60 },
1431 { 0x00, 0x80, 0x80 }, { 0x00, 0x80, 0xa0 }, { 0x00, 0x80, 0xc0 }, { 0x00, 0x80, 0xe0 },
1432 { 0x00, 0xa0, 0x00 }, { 0x00, 0xa0, 0x20 }, { 0x00, 0xa0, 0x40 }, { 0x00, 0xa0, 0x60 },
1433 { 0x00, 0xa0, 0x80 }, { 0x00, 0xa0, 0xa0 }, { 0x00, 0xa0, 0xc0 }, { 0x00, 0xa0, 0xe0 },
1434 { 0x00, 0xc0, 0x00 }, { 0x00, 0xc0, 0x20 }, { 0x00, 0xc0, 0x40 }, { 0x00, 0xc0, 0x60 },
1435 { 0x00, 0xc0, 0x80 }, { 0x00, 0xc0, 0xa0 }, { 0x00, 0xc0, 0xc0 }, { 0x00, 0xc0, 0xe0 },
1436 { 0x00, 0xe0, 0x00 }, { 0x00, 0xe0, 0x20 }, { 0x00, 0xe0, 0x40 }, { 0x00, 0xe0, 0x60 },
1437 { 0x00, 0xe0, 0x80 }, { 0x00, 0xe0, 0xa0 }, { 0x00, 0xe0, 0xc0 }, { 0x00, 0xe0, 0xe0 },
1438 { 0x40, 0x00, 0x00 }, { 0x40, 0x00, 0x20 }, { 0x40, 0x00, 0x40 }, { 0x40, 0x00, 0x60 },
1439 { 0x40, 0x00, 0x80 }, { 0x40, 0x00, 0xa0 }, { 0x40, 0x00, 0xc0 }, { 0x40, 0x00, 0xe0 },
1440 { 0x40, 0x20, 0x00 }, { 0x40, 0x20, 0x20 }, { 0x40, 0x20, 0x40 }, { 0x40, 0x20, 0x60 },
1441 { 0x40, 0x20, 0x80 }, { 0x40, 0x20, 0xa0 }, { 0x40, 0x20, 0xc0 }, { 0x40, 0x20, 0xe0 },
1442 { 0x40, 0x40, 0x00 }, { 0x40, 0x40, 0x20 }, { 0x40, 0x40, 0x40 }, { 0x40, 0x40, 0x60 },
1443 { 0x40, 0x40, 0x80 }, { 0x40, 0x40, 0xa0 }, { 0x40, 0x40, 0xc0 }, { 0x40, 0x40, 0xe0 },
1444 { 0x40, 0x60, 0x00 }, { 0x40, 0x60, 0x20 }, { 0x40, 0x60, 0x40 }, { 0x40, 0x60, 0x60 },
1445 { 0x40, 0x60, 0x80 }, { 0x40, 0x60, 0xa0 }, { 0x40, 0x60, 0xc0 }, { 0x40, 0x60, 0xe0 },
1446 { 0x40, 0x80, 0x00 }, { 0x40, 0x80, 0x20 }, { 0x40, 0x80, 0x40 }, { 0x40, 0x80, 0x60 },
1447 { 0x40, 0x80, 0x80 }, { 0x40, 0x80, 0xa0 }, { 0x40, 0x80, 0xc0 }, { 0x40, 0x80, 0xe0 },
1448 { 0x40, 0xa0, 0x00 }, { 0x40, 0xa0, 0x20 }, { 0x40, 0xa0, 0x40 }, { 0x40, 0xa0, 0x60 },
1449 { 0x40, 0xa0, 0x80 }, { 0x40, 0xa0, 0xa0 }, { 0x40, 0xa0, 0xc0 }, { 0x40, 0xa0, 0xe0 },
1450 { 0x40, 0xc0, 0x00 }, { 0x40, 0xc0, 0x20 }, { 0x40, 0xc0, 0x40 }, { 0x40, 0xc0, 0x60 },
1451 { 0x40, 0xc0, 0x80 }, { 0x40, 0xc0, 0xa0 }, { 0x40, 0xc0, 0xc0 }, { 0x40, 0xc0, 0xe0 },
1452 { 0x40, 0xe0, 0x00 }, { 0x40, 0xe0, 0x20 }, { 0x40, 0xe0, 0x40 }, { 0x40, 0xe0, 0x60 },
1453 { 0x40, 0xe0, 0x80 }, { 0x40, 0xe0, 0xa0 }, { 0x40, 0xe0, 0xc0 }, { 0x40, 0xe0, 0xe0 },
1454 { 0x80, 0x00, 0x00 }, { 0x80, 0x00, 0x20 }, { 0x80, 0x00, 0x40 }, { 0x80, 0x00, 0x60 },
1455 { 0x80, 0x00, 0x80 }, { 0x80, 0x00, 0xa0 }, { 0x80, 0x00, 0xc0 }, { 0x80, 0x00, 0xe0 },
1456 { 0x80, 0x20, 0x00 }, { 0x80, 0x20, 0x20 }, { 0x80, 0x20, 0x40 }, { 0x80, 0x20, 0x60 },
1457 { 0x80, 0x20, 0x80 }, { 0x80, 0x20, 0xa0 }, { 0x80, 0x20, 0xc0 }, { 0x80, 0x20, 0xe0 },
1458 { 0x80, 0x40, 0x00 }, { 0x80, 0x40, 0x20 }, { 0x80, 0x40, 0x40 }, { 0x80, 0x40, 0x60 },
1459 { 0x80, 0x40, 0x80 }, { 0x80, 0x40, 0xa0 }, { 0x80, 0x40, 0xc0 }, { 0x80, 0x40, 0xe0 },
1460 { 0x80, 0x60, 0x00 }, { 0x80, 0x60, 0x20 }, { 0x80, 0x60, 0x40 }, { 0x80, 0x60, 0x60 },
1461 { 0x80, 0x60, 0x80 }, { 0x80, 0x60, 0xa0 }, { 0x80, 0x60, 0xc0 }, { 0x80, 0x60, 0xe0 },
1462 { 0x80, 0x80, 0x00 }, { 0x80, 0x80, 0x20 }, { 0x80, 0x80, 0x40 }, { 0x80, 0x80, 0x60 },
1463 { 0x80, 0x80, 0x80 }, { 0x80, 0x80, 0xa0 }, { 0x80, 0x80, 0xc0 }, { 0x80, 0x80, 0xe0 },
1464 { 0x80, 0xa0, 0x00 }, { 0x80, 0xa0, 0x20 }, { 0x80, 0xa0, 0x40 }, { 0x80, 0xa0, 0x60 },
1465 { 0x80, 0xa0, 0x80 }, { 0x80, 0xa0, 0xa0 }, { 0x80, 0xa0, 0xc0 }, { 0x80, 0xa0, 0xe0 },
1466 { 0x80, 0xc0, 0x00 }, { 0x80, 0xc0, 0x20 }, { 0x80, 0xc0, 0x40 }, { 0x80, 0xc0, 0x60 },
1467 { 0x80, 0xc0, 0x80 }, { 0x80, 0xc0, 0xa0 }, { 0x80, 0xc0, 0xc0 }, { 0x80, 0xc0, 0xe0 },
1468 { 0x80, 0xe0, 0x00 }, { 0x80, 0xe0, 0x20 }, { 0x80, 0xe0, 0x40 }, { 0x80, 0xe0, 0x60 },
1469 { 0x80, 0xe0, 0x80 }, { 0x80, 0xe0, 0xa0 }, { 0x80, 0xe0, 0xc0 }, { 0x80, 0xe0, 0xe0 },
1470 { 0xc0, 0x00, 0x00 }, { 0xc0, 0x00, 0x20 }, { 0xc0, 0x00, 0x40 }, { 0xc0, 0x00, 0x60 },
1471 { 0xc0, 0x00, 0x80 }, { 0xc0, 0x00, 0xa0 }, { 0xc0, 0x00, 0xc0 }, { 0xc0, 0x00, 0xe0 },
1472 { 0xc0, 0x20, 0x00 }, { 0xc0, 0x20, 0x20 }, { 0xc0, 0x20, 0x40 }, { 0xc0, 0x20, 0x60 },
1473 { 0xc0, 0x20, 0x80 }, { 0xc0, 0x20, 0xa0 }, { 0xc0, 0x20, 0xc0 }, { 0xc0, 0x20, 0xe0 },
1474 { 0xc0, 0x40, 0x00 }, { 0xc0, 0x40, 0x20 }, { 0xc0, 0x40, 0x40 }, { 0xc0, 0x40, 0x60 },
1475 { 0xc0, 0x40, 0x80 }, { 0xc0, 0x40, 0xa0 }, { 0xc0, 0x40, 0xc0 }, { 0xc0, 0x40, 0xe0 },
1476 { 0xc0, 0x60, 0x00 }, { 0xc0, 0x60, 0x20 }, { 0xc0, 0x60, 0x40 }, { 0xc0, 0x60, 0x60 },
1477 { 0xc0, 0x60, 0x80 }, { 0xc0, 0x60, 0xa0 }, { 0xc0, 0x60, 0xc0 }, { 0xc0, 0x60, 0xe0 },
1478 { 0xc0, 0x80, 0x00 }, { 0xc0, 0x80, 0x20 }, { 0xc0, 0x80, 0x40 }, { 0xc0, 0x80, 0x60 },
1479 { 0xc0, 0x80, 0x80 }, { 0xc0, 0x80, 0xa0 }, { 0xc0, 0x80, 0xc0 }, { 0xc0, 0x80, 0xe0 },
1480 { 0xc0, 0xa0, 0x00 }, { 0xc0, 0xa0, 0x20 }, { 0xc0, 0xa0, 0x40 }, { 0xc0, 0xa0, 0x60 },
1481 { 0xc0, 0xa0, 0x80 }, { 0xc0, 0xa0, 0xa0 }, { 0xc0, 0xa0, 0xc0 }, { 0xc0, 0xa0, 0xe0 },
1482 { 0xc0, 0xc0, 0x00 }, { 0xc0, 0xc0, 0x20 }, { 0xc0, 0xc0, 0x40 }, { 0xc0, 0xc0, 0x60 },
1483 { 0xc0, 0xc0, 0x80 }, { 0xc0, 0xc0, 0xa0 }, { 0xf0, 0xfb, 0xff }, { 0xa4, 0xa0, 0xa0 },
1484 { 0x80, 0x80, 0x80 }, { 0x00, 0x00, 0xff }, { 0x00, 0xff, 0x00 }, { 0x00, 0xff, 0xff },
1485 { 0xff, 0x00, 0x00 }, { 0xff, 0x00, 0xff }, { 0xff, 0xff, 0x00 }, { 0xff, 0xff, 0xff }
1486 };
1487
1488 static HPALETTE create_default_palette( int bpp )
1489 {
1490 char pal_buffer[sizeof(LOGPALETTE) + 255 * sizeof(PALETTEENTRY)];
1491 LOGPALETTE *pal = (LOGPALETTE *)pal_buffer;
1492 PALETTEENTRY *entries = pal->palPalEntry;
1493 int i;
1494
1495 pal->palVersion = 0x300;
1496 pal->palNumEntries = 1 << bpp;
1497 switch (bpp)
1498 {
1499 case 1:
1500 for (i = 0; i < 2; i++)
1501 {
1502 entries[i].peRed = default_palette_1[i].rgbRed;
1503 entries[i].peGreen = default_palette_1[i].rgbGreen;
1504 entries[i].peBlue = default_palette_1[i].rgbBlue;
1505 entries[i].peFlags = 0;
1506 }
1507 break;
1508 case 4:
1509 for (i = 0; i < 16; i++)
1510 {
1511 entries[i].peRed = default_palette_4[i].rgbRed;
1512 entries[i].peGreen = default_palette_4[i].rgbGreen;
1513 entries[i].peBlue = default_palette_4[i].rgbBlue;
1514 entries[i].peFlags = 0;
1515 }
1516 break;
1517 case 8:
1518 for (i = 0; i < 256; i++)
1519 {
1520 entries[i].peRed = default_palette_8[i].rgbRed;
1521 entries[i].peGreen = default_palette_8[i].rgbGreen;
1522 entries[i].peBlue = default_palette_8[i].rgbBlue;
1523 entries[i].peFlags = 0;
1524 }
1525 break;
1526 }
1527 return CreatePalette( pal );
1528 }
1529
1530 static inline void solid_patblt( HDC hdc, int x, int y, int width, int height, COLORREF color )
1531 {
1532 HBRUSH brush = CreateSolidBrush( color );
1533 brush = SelectObject( hdc, brush );
1534 PatBlt( hdc, x, y, width, height, PATCOPY );
1535 DeleteObject( SelectObject( hdc, brush ) );
1536 }
1537
1538 static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
1539 {
1540 char pal_buffer[sizeof(LOGPALETTE) + 255 * sizeof(PALETTEENTRY)];
1541 LOGPALETTE *pal = (LOGPALETTE *)pal_buffer;
1542 PALETTEENTRY *entries = pal->palPalEntry;
1543 HPEN solid_pen, dashed_pen, wide_pen, orig_pen;
1544 LOGBRUSH log_brush;
1545 HBRUSH solid_brush, dib_brush, hatch_brush, orig_brush;
1546 HBITMAP bmp;
1547 INT i, j, x, y, hatch_style;
1548 HDC src_dc;
1549 HRGN hrgn, hrgn2;
1550 BYTE dib_src_buf[sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD)];
1551 BYTE dib_brush_buf[sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD) + 16 * 16 * sizeof(DWORD)]; /* Enough for 16 x 16 at 32 bpp */
1552 BITMAPINFO *src_bi = (BITMAPINFO*)dib_src_buf;
1553 BITMAPINFO *brush_bi = (BITMAPINFO*)dib_brush_buf;
1554 RGBQUAD *brush_colors = brush_bi->bmiColors;
1555 BYTE *brush_bits, *src_bits;
1556 BOOL ret, dib_is_1bpp = (bmi->bmiHeader.biBitCount == 1);
1557 BOOL dib_is_8bpp_gray = (bmi->bmiHeader.biBitCount == 8 && bmi->bmiColors[1].rgbRed == 1);
1558 BLENDFUNCTION blend;
1559 COLORREF old_text, old_bkgnd;
1560 HPALETTE hpal, old_hpal;
1561
1562 blend.BlendOp = AC_SRC_OVER;
1563 blend.BlendFlags = 0;
1564
1565 reset_bounds( hdc );
1566
1567 memset(bits, 0xcc, get_dib_size(bmi));
1568 compare_hash(hdc, bmi, bits, "empty");
1569
1570 src_dc = CreateCompatibleDC( 0 );
1571 solid_pen = CreatePen(PS_SOLID, 1, RGB(0, 0, 0xff));
1572 orig_pen = SelectObject(hdc, solid_pen);
1573 SetBrushOrgEx(hdc, 0, 0, NULL);
1574
1575 /* horizontal and vertical lines */
1576 for(i = 1; i <= 16; i++)
1577 {
1578 SetROP2(hdc, i);
1579 MoveToEx(hdc, 10, i * 3, NULL);
1580 LineTo(hdc, 100, i * 3); /* l -> r */
1581 MoveToEx(hdc, 100, 50 + i * 3, NULL);
1582 LineTo(hdc, 10, 50 + i * 3); /* r -> l */
1583 MoveToEx(hdc, 120 + i * 3, 10, NULL);
1584 LineTo(hdc, 120 + i * 3, 100); /* t -> b */
1585 MoveToEx(hdc, 170 + i * 3, 100, NULL);
1586 LineTo(hdc, 170 + i * 3, 10); /* b -> t */
1587 }
1588 compare_hash(hdc, bmi, bits, "h and v solid lines");
1589
1590 /* diagonal lines */
1591 SetROP2(hdc, R2_COPYPEN);
1592 for(i = 0; i < 16; i++)
1593 {
1594 double s = sin(M_PI * i / 8.0);
1595 double c = cos(M_PI * i / 8.0);
1596
1597 MoveToEx(hdc, 200.5 + 10 * c, 200.5 + 10 * s, NULL);
1598 LineTo(hdc, 200.5 + 100 * c, 200.5 + 100 * s);
1599 }
1600 compare_hash(hdc, bmi, bits, "diagonal solid lines");
1601
1602 for(i = 0; i < sizeof(bias_check) / sizeof(bias_check[0]); i++)
1603 {
1604 MoveToEx(hdc, bias_check[i].left, bias_check[i].top, NULL);
1605 LineTo(hdc, bias_check[i].right, bias_check[i].bottom);
1606 }
1607 compare_hash(hdc, bmi, bits, "more diagonal solid lines");
1608
1609 /* solid brush PatBlt */
1610 solid_brush = CreateSolidBrush(RGB(0x33, 0xaa, 0xff));
1611 orig_brush = SelectObject(hdc, solid_brush);
1612
1613 for(i = 0, y = 10; i < 256; i++)
1614 {
1615 ret = PatBlt(hdc, 10, y, 100, 10, rop3[i]);
1616
1617 if(rop_uses_src(rop3[i]))
1618 ok(ret == FALSE, "got TRUE for %x\n", rop3[i]);
1619 else
1620 {
1621 ok(ret, "got FALSE for %x\n", rop3[i]);
1622 y += 20;
1623 }
1624
1625 }
1626 compare_hash(hdc, bmi, bits, "solid patblt");
1627
1628 /* clipped lines */
1629 hrgn = CreateRectRgn(10, 10, 200, 20);
1630 hrgn2 = CreateRectRgn(100, 100, 200, 200);
1631 CombineRgn(hrgn, hrgn, hrgn2, RGN_OR);
1632 SetRectRgn(hrgn2, 290, 100, 300, 200);
1633 CombineRgn(hrgn, hrgn, hrgn2, RGN_OR);
1634 ExtSelectClipRgn(hdc, hrgn, RGN_COPY);
1635 DeleteObject(hrgn2);
1636
1637 for(i = 0; i < sizeof(hline_clips)/sizeof(hline_clips[0]); i++)
1638 {
1639 MoveToEx(hdc, hline_clips[i].left, hline_clips[i].top, NULL);
1640 LineTo(hdc, hline_clips[i].right, hline_clips[i].bottom);
1641 }
1642 compare_hash(hdc, bmi, bits, "clipped solid hlines");
1643
1644 for(i = 0; i < sizeof(vline_clips)/sizeof(vline_clips[0]); i++)
1645 {
1646 MoveToEx(hdc, vline_clips[i].left, vline_clips[i].top, NULL);
1647 LineTo(hdc, vline_clips[i].right, vline_clips[i].bottom);
1648 }
1649 compare_hash(hdc, bmi, bits, "clipped solid vlines");
1650
1651 for(i = 0; i < sizeof(line_clips)/sizeof(line_clips[0]); i++)
1652 {
1653 MoveToEx(hdc, line_clips[i].left, line_clips[i].top, NULL);
1654 LineTo(hdc, line_clips[i].right, line_clips[i].bottom);
1655 }
1656 compare_hash(hdc, bmi, bits, "clipped solid diagonal lines");
1657
1658 /* clipped PatBlt */
1659 for(i = 0; i < sizeof(patblt_clips) / sizeof(patblt_clips[0]); i++)
1660 {
1661 PatBlt(hdc, patblt_clips[i].left, patblt_clips[i].top,
1662 patblt_clips[i].right - patblt_clips[i].left,
1663 patblt_clips[i].bottom - patblt_clips[i].top, PATCOPY);
1664 }
1665 compare_hash(hdc, bmi, bits, "clipped patblt");
1666
1667 /* clipped dashed lines */
1668 dashed_pen = CreatePen(PS_DASH, 1, RGB(0xff, 0, 0));
1669 SelectObject(hdc, dashed_pen);
1670 SetBkMode(hdc, TRANSPARENT);
1671 SetBkColor(hdc, RGB(0, 0xff, 0));
1672
1673 for(i = 0; i < sizeof(hline_clips)/sizeof(hline_clips[0]); i++)
1674 {
1675 MoveToEx(hdc, hline_clips[i].left, hline_clips[i].top, NULL);
1676 LineTo(hdc, hline_clips[i].right, hline_clips[i].bottom);
1677 }
1678 compare_hash(hdc, bmi, bits, "clipped dashed hlines");
1679
1680 for(i = 0; i < sizeof(hline_clips)/sizeof(hline_clips[0]); i++)
1681 {
1682 MoveToEx(hdc, hline_clips[i].right - 1, hline_clips[i].bottom, NULL);
1683 LineTo(hdc, hline_clips[i].left - 1, hline_clips[i].top);
1684 }
1685 compare_hash(hdc, bmi, bits, "clipped dashed hlines r -> l");
1686
1687 for(i = 0; i < sizeof(vline_clips)/sizeof(vline_clips[0]); i++)
1688 {
1689 MoveToEx(hdc, vline_clips[i].left, vline_clips[i].top, NULL);
1690 LineTo(hdc, vline_clips[i].right, vline_clips[i].bottom);
1691 }
1692 compare_hash(hdc, bmi, bits, "clipped dashed vlines");
1693
1694 for(i = 0; i < sizeof(vline_clips)/sizeof(vline_clips[0]); i++)
1695 {
1696 MoveToEx(hdc, vline_clips[i].right, vline_clips[i].bottom - 1, NULL);
1697 LineTo(hdc, vline_clips[i].left, vline_clips[i].top - 1);
1698 }
1699 compare_hash(hdc, bmi, bits, "clipped dashed vlines b -> t");
1700
1701 for(i = 0; i < sizeof(line_clips)/sizeof(line_clips[0]); i++)
1702 {
1703 MoveToEx(hdc, line_clips[i].left, line_clips[i].top, NULL);
1704 LineTo(hdc, line_clips[i].right, line_clips[i].bottom);
1705 }
1706 compare_hash(hdc, bmi, bits, "clipped dashed diagonal lines");
1707
1708 SetBkMode(hdc, OPAQUE);
1709
1710 for(i = 0; i < sizeof(line_clips)/sizeof(line_clips[0]); i++)
1711 {
1712 MoveToEx(hdc, line_clips[i].left, line_clips[i].top, NULL);
1713 LineTo(hdc, line_clips[i].right, line_clips[i].bottom);
1714 }
1715 compare_hash(hdc, bmi, bits, "clipped opaque dashed diagonal lines");
1716
1717 ExtSelectClipRgn(hdc, NULL, RGN_COPY);
1718
1719 /* 8888 DIB pattern brush */
1720
1721 brush_bi->bmiHeader = dib_brush_header_8888;
1722 brush_bits = (BYTE*)brush_bi + sizeof(BITMAPINFOHEADER);
1723 memset(brush_bits, 0, 16 * 16 * sizeof(DWORD));
1724 brush_bits[2] = 0xff;
1725 brush_bits[6] = 0xff;
1726 brush_bits[14] = 0xff;
1727 brush_bits[65] = 0xff;
1728 brush_bits[69] = 0xff;
1729 brush_bits[72] = 0xff;
1730
1731 dib_brush = CreateDIBPatternBrushPt(brush_bi, DIB_RGB_COLORS);
1732
1733 SelectObject(hdc, dib_brush);
1734 SetBrushOrgEx(hdc, 1, 1, NULL);
1735
1736 for(i = 0, y = 10; i < 256; i++)
1737 {
1738 if(!rop_uses_src(rop3[i]))
1739 {
1740 ret = PatBlt(hdc, 10 + i, y, 100, 20, rop3[i]);
1741 ok(ret, "got FALSE for %x\n", rop3[i]);
1742 y += 25;
1743 }
1744 }
1745 compare_hash_broken_todo(hdc, bmi, bits, "top-down 8888 dib brush patblt", 0, dib_is_1bpp);
1746
1747 SelectObject(hdc, orig_brush);
1748 DeleteObject(dib_brush);
1749
1750 /* 8888 bottom-up DIB pattern brush */
1751
1752 brush_bi->bmiHeader.biHeight = -brush_bi->bmiHeader.biHeight;
1753
1754 dib_brush = CreateDIBPatternBrushPt(brush_bi, DIB_RGB_COLORS);
1755
1756 SelectObject(hdc, dib_brush);
1757
1758 /* This used to set the x origin to 100 as well, but
1759 there's a Windows bug for 24 bpp where the brush's x offset
1760 is incorrectly calculated for rops that involve both D and P */
1761 SetBrushOrgEx(hdc, 4, 100, NULL);
1762
1763 for(i = 0, y = 10; i < 256; i++)
1764 {
1765 if(!rop_uses_src(rop3[i]))
1766 {
1767 ret = PatBlt(hdc, 10 + i, y, 100, 20, rop3[i]);
1768 ok(ret, "got FALSE for %x\n", rop3[i]);
1769 y += 25;
1770 }
1771 }
1772 compare_hash(hdc, bmi, bits, "bottom-up 8888 dib brush patblt");
1773
1774 SelectObject(hdc, orig_brush);
1775 DeleteObject(dib_brush);
1776
1777 /* 24 bpp dib pattern brush */
1778
1779 brush_bi->bmiHeader = dib_brush_header_24;
1780 brush_bits = (BYTE*)brush_bi + sizeof(BITMAPINFOHEADER);
1781 memset(brush_bits, 0, 16 * 16 * 3);
1782 brush_bits[0] = brush_bits[3] = brush_bits[6] = brush_bits[8] = 0xff;
1783 brush_bits[49] = brush_bits[52] = 0xff;
1784
1785 dib_brush = CreateDIBPatternBrushPt(brush_bi, DIB_RGB_COLORS);
1786
1787 SelectObject(hdc, dib_brush);
1788 SetBrushOrgEx(hdc, 1, 1, NULL);
1789
1790 for(i = 0, y = 10; i < 256; i++)
1791 {
1792 if(!rop_uses_src(rop3[i]))
1793 {
1794 ret = PatBlt(hdc, 10 + i, y, 100, 20, rop3[i]);
1795 ok(ret, "got FALSE for %x\n", rop3[i]);
1796 y += 25;
1797 }
1798 }
1799 compare_hash(hdc, bmi, bits, "top-down 24 bpp brush patblt");
1800
1801 SelectObject(hdc, orig_brush);
1802 DeleteObject(dib_brush);
1803
1804 /* 555 dib pattern brush */
1805
1806 brush_bi->bmiHeader = dib_brush_header_555;
1807 brush_bits = (BYTE*)brush_bi + sizeof(BITMAPINFOHEADER);
1808 memset(brush_bits, 0, 16 * 16 * sizeof(WORD));
1809 brush_bits[0] = brush_bits[1] = 0xff;
1810 brush_bits[32] = brush_bits[34] = 0x7c;
1811
1812 dib_brush = CreateDIBPatternBrushPt(brush_bi, DIB_RGB_COLORS);
1813
1814 SelectObject(hdc, dib_brush);
1815 SetBrushOrgEx(hdc, 1, 1, NULL);
1816
1817 for(i = 0, y = 10; i < 256; i++)
1818 {
1819 if(!rop_uses_src(rop3[i]))
1820 {
1821 ret = PatBlt(hdc, 10 + i, y, 100, 20, rop3[i]);
1822 ok(ret, "got FALSE for %x\n", rop3[i]);
1823 y += 25;
1824 }
1825 }
1826 compare_hash_broken_todo(hdc, bmi, bits, "top-down 555 dib brush patblt", 0, dib_is_1bpp);
1827
1828 SelectObject(hdc, orig_brush);
1829 DeleteObject(dib_brush);
1830
1831 SetBrushOrgEx(hdc, 0, 0, NULL);
1832
1833 /* 8 bpp dib pattern brush */
1834
1835 brush_bi->bmiHeader = dib_brush_header_8;
1836 brush_bi->bmiHeader.biClrUsed = 3;
1837 memset(brush_colors, 0, brush_bi->bmiHeader.biClrUsed * sizeof(RGBQUAD));
1838 brush_colors[0].rgbRed = 0xff;
1839 brush_colors[1].rgbRed = 0xff;
1840 brush_colors[1].rgbGreen = 0xff;
1841 brush_colors[1].rgbBlue = 0xff;
1842
1843 brush_bits = (BYTE*)brush_bi + sizeof(BITMAPINFOHEADER) + brush_bi->bmiHeader.biClrUsed * sizeof(RGBQUAD);
1844 memset(brush_bits, 0, 16 * 16 * sizeof(BYTE));
1845 brush_bits[0] = brush_bits[1] = 1;
1846 brush_bits[16] = brush_bits[17] = 2;
1847 brush_bits[32] = brush_bits[33] = 6;
1848
1849 dib_brush = CreateDIBPatternBrushPt(brush_bi, DIB_RGB_COLORS);
1850
1851 SelectObject(hdc, dib_brush);
1852 SetBrushOrgEx(hdc, 1, 1, NULL);
1853
1854 for(i = 0, y = 10; i < 256; i++)
1855 {
1856 if(!rop_uses_src(rop3[i]))
1857 {
1858 ret = PatBlt(hdc, 10 + i, y, 100, 20, rop3[i]);
1859 ok(ret, "got FALSE for %x\n", rop3[i]);
1860 y += 25;
1861 }
1862 }
1863 compare_hash_broken_todo(hdc, bmi, bits, "top-down 8 bpp dib brush patblt", 0, dib_is_1bpp);
1864
1865 SelectObject(hdc, orig_brush);
1866 DeleteObject(dib_brush);
1867
1868 /* 4 bpp dib pattern brush */
1869
1870 brush_bi->bmiHeader = dib_brush_header_4;
1871 dib_brush = CreateDIBPatternBrushPt(brush_bi, DIB_RGB_COLORS);
1872
1873 SelectObject(hdc, dib_brush);
1874 SetBrushOrgEx(hdc, 1, 1, NULL);
1875
1876 for(i = 0, y = 10; i < 256; i++)
1877 {
1878 if(!rop_uses_src(rop3[i]))
1879 {
1880 ret = PatBlt(hdc, 10 + i, y, 100, 20, rop3[i]);
1881 ok(ret, "got FALSE for %x\n", rop3[i]);
1882 y += 25;
1883 }
1884 }
1885 compare_hash_broken_todo(hdc, bmi, bits, "top-down 4 bpp dib brush patblt", 0, dib_is_1bpp);
1886
1887 SelectObject(hdc, orig_brush);
1888 DeleteObject(dib_brush);
1889
1890 /* 1 bpp dib pattern brush */
1891
1892 brush_bi->bmiHeader = dib_brush_header_1;
1893 brush_bi->bmiHeader.biClrUsed = 2;
1894 memset(brush_bits, 0, 16 * 4);
1895 brush_bits[0] = 0xf0;
1896 brush_bits[4] = 0xf0;
1897 brush_bits[8] = 0xf0;
1898
1899 dib_brush = CreateDIBPatternBrushPt(brush_bi, DIB_RGB_COLORS);
1900 SelectObject(hdc, dib_brush);
1901 for(i = 0, y = 10; i < 256; i++)
1902 {
1903 if(!rop_uses_src(rop3[i]))
1904 {
1905 ret = PatBlt(hdc, 10 + i, y, 100, 20, rop3[i]);
1906 ok(ret, "got FALSE for %x\n", rop3[i]);
1907 y += 25;
1908 }
1909 }
1910
1911 compare_hash_broken_todo(hdc, bmi, bits, "top-down 1 bpp dib brush patblt", 0, dib_is_1bpp);
1912
1913 SelectObject(hdc, orig_brush);
1914 DeleteObject(dib_brush);
1915
1916 /* 1 bpp ddb pattern brush */
1917
1918 old_text = GetTextColor( hdc );
1919 old_bkgnd = GetBkColor( hdc );
1920 bmp = CreateBitmap( 16, 16, 1, 1, ddb_brush_bits );
1921 dib_brush = CreatePatternBrush( bmp );
1922 SelectObject(hdc, dib_brush);
1923 for(i = 0, y = 10; i < 256; i++)
1924 {
1925 SetTextColor(hdc, RGB( i, 2*i, 255 - i ) );
1926 SetBkColor(hdc, RGB( 255 - i, i / 3, i ) );
1927 if(!rop_uses_src(rop3[i]))
1928 {
1929 ret = PatBlt(hdc, 10 + i, y, 100, 20, rop3[i]);
1930 ok(ret, "got FALSE for %x\n", rop3[i]);
1931 y += 25;
1932 }
1933 }
1934
1935 compare_hash_broken_todo(hdc, bmi, bits, "1 bpp ddb brush patblt", 0, dib_is_1bpp);
1936
1937 DeleteObject(bmp);
1938 SelectObject(hdc, orig_brush);
1939 DeleteObject( dib_brush );
1940 SetBrushOrgEx(hdc, 0, 0, NULL);
1941 SetTextColor(hdc, old_text);
1942 SetBkColor(hdc, old_bkgnd);
1943
1944 /* Rectangle */
1945
1946 SelectObject(hdc, solid_pen);
1947 SelectObject(hdc, solid_brush);
1948
1949 for(i = 0; i < sizeof(rectangles)/sizeof(rectangles[0]); i++)
1950 {
1951 Rectangle(hdc, rectangles[i].left, rectangles[i].top, rectangles[i].right, rectangles[i].bottom);
1952 }
1953
1954 SelectObject(hdc, dashed_pen);
1955 for(i = 0; i < sizeof(rectangles)/sizeof(rectangles[0]); i++)
1956 {
1957 Rectangle(hdc, rectangles[i].left, rectangles[i].top + 150, rectangles[i].right, rectangles[i].bottom + 150);
1958 }
1959
1960 compare_hash(hdc, bmi, bits, "rectangles");
1961 SelectObject(hdc, solid_pen);
1962
1963 /* PaintRgn */
1964
1965 PaintRgn(hdc, hrgn);
1966 compare_hash(hdc, bmi, bits, "PaintRgn");
1967
1968 /* RTL rectangles */
1969
1970 SetLayout(hdc, LAYOUT_RTL);
1971 PaintRgn(hdc, hrgn);
1972 PatBlt(hdc, 10, 250, 10, 10, PATCOPY);
1973 Rectangle(hdc, 100, 250, 110, 260);
1974 compare_hash(hdc, bmi, bits, "rtl");
1975 SetLayout(hdc, LAYOUT_LTR);
1976 DeleteObject( hrgn );
1977
1978 for(i = 0, y = 10; i < 256; i++)
1979 {
1980 if(!rop_uses_src(rop3[i]))
1981 {
1982 for(hatch_style = HS_HORIZONTAL; hatch_style <= HS_DIAGCROSS; hatch_style++)
1983 {
1984 hatch_brush = CreateHatchBrush(hatch_style, RGB(0xff, 0, 0));
1985 SelectObject(hdc, hatch_brush);
1986 ret = PatBlt(hdc, 10 + i + 30 * hatch_style, y, 20, 20, rop3[i]);
1987 ok(ret, "got FALSE for %x\n", rop3[i]);
1988 SelectObject(hdc, orig_brush);
1989 DeleteObject(hatch_brush);
1990 }
1991 y += 25;
1992 }
1993 }
1994
1995 compare_hash(hdc, bmi, bits, "hatch brushes");
1996
1997 /* overlapping blits */
1998
1999 orig_brush = SelectObject(hdc, solid_brush);
2000
2001 Rectangle(hdc, 10, 10, 100, 100);
2002 Rectangle(hdc, 20, 15, 30, 40);
2003 Rectangle(hdc, 15, 15, 20, 20);
2004 Rectangle(hdc, 15, 20, 50, 45);
2005 BitBlt( hdc, 20, 20, 100, 100, hdc, 10, 10, SRCCOPY );
2006 compare_hash(hdc, bmi, bits, "overlapping BitBlt SRCCOPY +x, +y");
2007
2008 Rectangle(hdc, 10, 10, 100, 100);
2009 Rectangle(hdc, 20, 15, 30, 40);
2010 Rectangle(hdc, 15, 15, 20, 20);
2011 Rectangle(hdc, 15, 20, 50, 45);
2012 BitBlt( hdc, 10, 10, 100, 100, hdc, 20, 20, SRCCOPY );
2013 if (bmi->bmiHeader.biBitCount == 1) /* Windows gets this one wrong */
2014 compare_hash_broken_todo(hdc, bmi, bits, "overlapping BitBlt SRCCOPY -x, -y",1, FALSE);
2015 else
2016 compare_hash(hdc, bmi, bits, "overlapping BitBlt SRCCOPY -x, -y");
2017
2018 Rectangle(hdc, 10, 10, 100, 100);
2019 Rectangle(hdc, 20, 15, 30, 40);
2020 Rectangle(hdc, 15, 15, 20, 20);
2021 Rectangle(hdc, 15, 20, 50, 45);
2022 BitBlt( hdc, 20, 10, 100, 100, hdc, 10, 20, SRCCOPY );
2023 compare_hash(hdc, bmi, bits, "overlapping BitBlt SRCCOPY +x, -y");
2024
2025 Rectangle(hdc, 10, 10, 100, 100);
2026 Rectangle(hdc, 20, 15, 30, 40);
2027 Rectangle(hdc, 15, 15, 20, 20);
2028 Rectangle(hdc, 15, 20, 50, 45);
2029 BitBlt( hdc, 10, 20, 100, 100, hdc, 20, 10, SRCCOPY );
2030 if (bmi->bmiHeader.biBitCount == 1) /* Windows gets this one wrong */
2031 compare_hash_broken_todo(hdc, bmi, bits, "overlapping BitBlt SRCCOPY -x, +y", 1, FALSE );
2032 else
2033 compare_hash(hdc, bmi, bits, "overlapping BitBlt SRCCOPY -x, +y" );
2034
2035 Rectangle(hdc, 10, 10, 100, 100);
2036 Rectangle(hdc, 20, 15, 30, 40);
2037 Rectangle(hdc, 15, 15, 20, 20);
2038 Rectangle(hdc, 15, 20, 50, 45);
2039 BitBlt( hdc, 20, 20, 100, 100, hdc, 10, 10, PATPAINT );
2040 compare_hash(hdc, bmi, bits, "overlapping BitBlt PATPAINT +x, +y");
2041
2042 Rectangle(hdc, 10, 10, 100, 100);
2043 Rectangle(hdc, 20, 15, 30, 40);
2044 Rectangle(hdc, 15, 15, 20, 20);
2045 Rectangle(hdc, 15, 20, 50, 45);
2046 BitBlt( hdc, 10, 10, 100, 100, hdc, 20, 20, PATPAINT );
2047 compare_hash(hdc, bmi, bits, "overlapping BitBlt PATPAINT -x, -y");
2048
2049 Rectangle(hdc, 10, 10, 100, 100);
2050 Rectangle(hdc, 20, 15, 30, 40);
2051 Rectangle(hdc, 15, 15, 20, 20);
2052 Rectangle(hdc, 15, 20, 50, 45);
2053 BitBlt( hdc, 20, 10, 100, 100, hdc, 10, 20, PATPAINT );
2054 if (bmi->bmiHeader.biBitCount >= 24) /* Windows gets this one wrong */
2055 compare_hash_broken_todo(hdc, bmi, bits, "overlapping BitBlt PATPAINT +x, -y", 1, FALSE);
2056 else
2057 compare_hash(hdc, bmi, bits, "overlapping BitBlt PATPAINT +x, -y");
2058
2059 Rectangle(hdc, 10, 10, 100, 100);
2060 Rectangle(hdc, 20, 15, 30, 40);
2061 Rectangle(hdc, 15, 15, 20, 20);
2062 Rectangle(hdc, 15, 20, 50, 45);
2063 BitBlt( hdc, 10, 20, 100, 100, hdc, 20, 10, PATPAINT );
2064 compare_hash(hdc, bmi, bits, "overlapping BitBlt PATPAINT -x, +y" );
2065
2066 /* blitting with 32-bpp BI_RGB source */
2067
2068 memset( dib_src_buf, 0, sizeof(dib_src_buf) );
2069 src_bi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
2070 src_bi->bmiHeader.biHeight = 256;
2071 src_bi->bmiHeader.biWidth = 256;
2072 src_bi->bmiHeader.biBitCount = 32;
2073 src_bi->bmiHeader.biPlanes = 1;
2074 src_bi->bmiHeader.biCompression = BI_RGB;
2075 bmp = CreateDIBSection(0, src_bi, DIB_RGB_COLORS, (void**)&src_bits, NULL, 0);
2076 SelectObject( src_dc, bmp );
2077 for (y = 0; y < 256; y++)
2078 for (x = 0; x < 256; x++)
2079 {
2080 BYTE a = (x + y) * 2;
2081 BYTE r = (BYTE)(y + 2 * x) * a / 255;
2082 BYTE g = (BYTE)(x + y / 3) * a / 255;
2083 BYTE b = (BYTE)(x / 3 + 2 * y) * a / 255;
2084 ((DWORD *)src_bits)[y * 256 + x] = (a << 24) | RGB( r, g, b );
2085 }
2086
2087 BitBlt( hdc, 100, 100, 256, 256, src_dc, 0, 0, SRCCOPY );
2088
2089 /* Interesting cases for 1-bpp dst */
2090 BitBlt( hdc, 1, 4, 2, 2, src_dc, 0, 0, SRCCOPY );
2091 BitBlt( hdc, 1, 8, 16, 2, src_dc, 0, 0, SRCCOPY );
2092 BitBlt( hdc, 1, 12, 15, 2, src_dc, 0, 0, SRCCOPY );
2093 BitBlt( hdc, 0, 16, 8, 2, src_dc, 0, 0, SRCCOPY );
2094 BitBlt( hdc, 0, 20, 9, 2, src_dc, 0, 0, SRCCOPY );
2095 BitBlt( hdc, 7, 24, 1, 2, src_dc, 0, 0, SRCCOPY );
2096 BitBlt( hdc, 7, 28, 2, 2, src_dc, 0, 0, SRCCOPY );
2097 BitBlt( hdc, 7, 32, 9, 2, src_dc, 0, 0, SRCCOPY );
2098 BitBlt( hdc, 7, 36, 10, 2, src_dc, 0, 0, SRCCOPY );
2099 compare_hash(hdc, bmi, bits, "BitBlt src 32-bpp SRCCOPY" );
2100
2101 blend.SourceConstantAlpha = 0xd0;
2102 blend.AlphaFormat = 0;
2103 GdiAlphaBlend( hdc, 100, 100, 256, 256, src_dc, 0, 0, 256, 256, blend );
2104 compare_hash_broken_todo(hdc, bmi, bits, "AlphaBlend src 32-bpp no alpha", 0, dib_is_1bpp );
2105
2106 blend.SourceConstantAlpha = 0xb0;
2107 blend.AlphaFormat = AC_SRC_ALPHA;
2108 GdiAlphaBlend( hdc, 50, 50, 256, 256, src_dc, 0, 0, 256, 256, blend );
2109 compare_hash_broken_todo(hdc, bmi, bits, "AlphaBlend src 32-bpp alpha", 0, dib_is_1bpp );
2110
2111 /* blitting with 32-bpp r10g10b10 source */
2112
2113 src_bi->bmiHeader.biBitCount = 32;
2114 src_bi->bmiHeader.biCompression = BI_BITFIELDS;
2115 ((DWORD *)src_bi->bmiColors)[0] = 0x3ff00000;
2116 ((DWORD *)src_bi->bmiColors)[1] = 0x000ffc00;
2117 ((DWORD *)src_bi->bmiColors)[2] = 0x000003ff;
2118 bmp = CreateDIBSection(0, src_bi, DIB_RGB_COLORS, (void**)&src_bits, NULL, 0);
2119 SelectObject( src_dc, bmp );
2120 for (y = 0; y < 256; y++)
2121 for (x = 0; x < 256; x++)
2122 {
2123 WORD r = (7 * x + 3 * y) % 1024;
2124 WORD g = (11 * x + y / 3) % 1024;
2125 WORD b = (x / 3 + 9 * y) % 1024;
2126 ((DWORD *)src_bits)[y * 256 + x] = r << 20 | g << 10 | b;
2127 }
2128
2129 BitBlt( hdc, 100, 100, 256, 256, src_dc, 0, 0, SRCCOPY );
2130 compare_hash(hdc, bmi, bits, "BitBlt src 32-bpp r10g10b10 SRCCOPY" );
2131
2132 /* blitting with 32-bpp b6g6r6 source */
2133
2134 src_bi->bmiHeader.biBitCount = 32;
2135 src_bi->bmiHeader.biCompression = BI_BITFIELDS;
2136 ((DWORD *)src_bi->bmiColors)[0] = 0x00003f;
2137 ((DWORD *)src_bi->bmiColors)[1] = 0x000fc0;
2138 ((DWORD *)src_bi->bmiColors)[2] = 0x03f000;
2139 bmp = CreateDIBSection(0, src_bi, DIB_RGB_COLORS, (void**)&src_bits, NULL, 0);
2140 SelectObject( src_dc, bmp );
2141 for (y = 0; y < 256; y++)
2142 for (x = 0; x < 256; x++)
2143 {
2144 BYTE r = (y + 2 * x) % 64;
2145 BYTE g = (x + y / 3) % 64;
2146 BYTE b = (x / 3 + 2 * y) % 64;
2147 ((DWORD *)src_bits)[y * 256 + x] = r | g << 6 | b << 12;
2148 }
2149
2150 BitBlt( hdc, 100, 100, 256, 256, src_dc, 0, 0, SRCCOPY );
2151 compare_hash(hdc, bmi, bits, "BitBlt src 32-bpp b6g6r6 SRCCOPY" );
2152
2153 /* blitting with 24-bpp source */
2154
2155 src_bi->bmiHeader.biBitCount = 24;
2156 src_bi->bmiHeader.biCompression = BI_RGB;
2157 bmp = CreateDIBSection(0, src_bi, DIB_RGB_COLORS, (void**)&src_bits, NULL, 0);
2158 DeleteObject( SelectObject( src_dc, bmp ) );
2159 for (y = 0; y < 256; y++)
2160 for (x = 0; x < 256; x++)
2161 {
2162 src_bits[(y * 256 + x) * 3 + 0] = x + 3 * y;
2163 src_bits[(y * 256 + x) * 3 + 1] = 2 * x + 7 * y;
2164 src_bits[(y * 256 + x) * 3 + 2] = 5 * x + 12 * y;
2165 }
2166
2167 BitBlt( hdc, 100, 100, 256, 256, src_dc, 0, 0, SRCCOPY );
2168 compare_hash(hdc, bmi, bits, "BitBlt src 24-bpp SRCCOPY" );
2169
2170 blend.SourceConstantAlpha = 0xe0;
2171 blend.AlphaFormat = 0;
2172 GdiAlphaBlend( hdc, 100, 100, 256, 256, src_dc, 0, 0, 256, 256, blend );
2173 compare_hash_broken_todo(hdc, bmi, bits, "AlphaBlend src 24-bpp", 0, dib_is_1bpp );
2174
2175 /* blitting with 16-bpp BI_RGB source */
2176
2177 src_bi->bmiHeader.biBitCount = 16;
2178 src_bi->bmiHeader.biCompression = BI_RGB;
2179 bmp = CreateDIBSection(0, src_bi, DIB_RGB_COLORS, (void**)&src_bits, NULL, 0);
2180 DeleteObject( SelectObject( src_dc, bmp ) );
2181 for (y = 0; y < 256; y++)
2182 for (x = 0; x < 256; x++)
2183 ((WORD *)src_bits)[y * 256 + x] = x | x << 4 | x << 8 | y << 3 | y << 7;
2184
2185 BitBlt( hdc, 100, 100, 256, 256, src_dc, 0, 0, SRCCOPY );
2186 compare_hash(hdc, bmi, bits, "BitBlt src 16-bpp SRCCOPY" );
2187
2188 /* blitting with 16-bpp b4g4r4 source */
2189
2190 src_bi->bmiHeader.biBitCount = 16;
2191 src_bi->bmiHeader.biCompression = BI_BITFIELDS;
2192 ((DWORD *)src_bi->bmiColors)[0] = 0x00000f;
2193 ((DWORD *)src_bi->bmiColors)[1] = 0x0000f0;
2194 ((DWORD *)src_bi->bmiColors)[2] = 0x000f00;
2195 bmp = CreateDIBSection(0, src_bi, DIB_RGB_COLORS, (void**)&src_bits, NULL, 0);
2196 DeleteObject( SelectObject( src_dc, bmp ) );
2197 for (y = 0; y < 256; y++)
2198 for (x = 0; x < 256; x++)
2199 ((WORD *)src_bits)[y * 256 + x] = x | x << 4 | x << 8 | y << 3 | y << 7;
2200
2201 BitBlt( hdc, 100, 100, 256, 256, src_dc, 0, 0, SRCCOPY );
2202 compare_hash(hdc, bmi, bits, "BitBlt src 16-bpp b4g4r4 SRCCOPY" );
2203
2204 /* blitting with 8-bpp source */
2205
2206 src_bi->bmiHeader.biBitCount = 8;
2207 src_bi->bmiHeader.biCompression = BI_RGB;
2208 src_bi->bmiHeader.biClrUsed = 160;
2209 for (i = 0; i < 256; i++) ((DWORD *)src_bi->bmiColors)[i] = i | (i * 3) << 8 | (i / 2) << 16;
2210 bmp = CreateDIBSection(0, src_bi, DIB_RGB_COLORS, (void**)&src_bits, NULL, 0);
2211 DeleteObject( SelectObject( src_dc, bmp ) );
2212 for (y = 0; y < 256; y++)
2213 for (x = 0; x < 256; x++)
2214 src_bits[y * 256 + x] = 3 * x + 5 * y;
2215
2216 BitBlt( hdc, 100, 100, 256, 256, src_dc, 0, 0, SRCCOPY );
2217 compare_hash(hdc, bmi, bits, "BitBlt src 8-bpp SRCCOPY" );
2218
2219 blend.SourceConstantAlpha = 0xd0;
2220 blend.AlphaFormat = 0;
2221 GdiAlphaBlend( hdc, 100, 100, 256, 256, src_dc, 0, 0, 256, 256, blend );
2222 compare_hash_broken_todo(hdc, bmi, bits, "AlphaBlend src 8-bpp", 0, dib_is_1bpp );
2223
2224 /* blitting with 4-bpp source */
2225
2226 src_bi->bmiHeader.biBitCount = 4;
2227 src_bi->bmiHeader.biClrUsed = 12;
2228 for (i = 0; i < 16; i++) ((DWORD *)src_bi->bmiColors)[i] = i | (i * 5) << 8 | (i * 19) << 16;
2229 bmp = CreateDIBSection(0, src_bi, DIB_RGB_COLORS, (void**)&src_bits, NULL, 0);
2230 DeleteObject( SelectObject( src_dc, bmp ) );
2231 for (y = 0; y < 256; y++)
2232 for (x = 0; x < 256; x += 2)
2233 src_bits[(y * 256 + x) / 2] = 7 * x + 3 * y;
2234
2235 BitBlt( hdc, 100, 100, 256, 256, src_dc, 0, 0, SRCCOPY );
2236 compare_hash(hdc, bmi, bits, "BitBlt src 4-bpp SRCCOPY" );
2237
2238 /* blitting with 1-bpp source */
2239
2240 src_bi->bmiHeader.biBitCount = 1;
2241 src_bi->bmiHeader.biClrUsed = 0;
2242 for (i = 0; i < 2; i++) ((DWORD *)src_bi->bmiColors)[i] = (i + 37) | (i * 91) << 8 | (i * 53) << 16;
2243 bmp = CreateDIBSection(0, src_bi, DIB_RGB_COLORS, (void**)&src_bits, NULL, 0);
2244 DeleteObject( SelectObject( src_dc, bmp ) );
2245 for (y = 0; y < 256; y++)
2246 for (x = 0; x < 256; x += 8)
2247 src_bits[(y * 256 + x) / 8] = 7 * x + 3 * y;
2248
2249 BitBlt( hdc, 100, 100, 256, 256, src_dc, 0, 0, SRCCOPY );
2250 /* Some interesting src co-ords */
2251 BitBlt( hdc, 10, 10, 3, 10, src_dc, 0, 0, SRCCOPY );
2252 BitBlt( hdc, 20, 10, 3, 10, src_dc, 2, 0, SRCCOPY );
2253 BitBlt( hdc, 30, 10, 3, 10, src_dc, 5, 0, SRCCOPY );
2254 BitBlt( hdc, 40, 10, 3, 10, src_dc, 6, 0, SRCCOPY );
2255 BitBlt( hdc, 50, 10, 20, 10, src_dc, 6, 0, SRCCOPY );
2256 compare_hash(hdc, bmi, bits, "BitBlt src 1-bpp SRCCOPY" );
2257
2258 blend.SourceConstantAlpha = 0x90;
2259 blend.AlphaFormat = 0;
2260 GdiAlphaBlend( hdc, 100, 100, 256, 256, src_dc, 0, 0, 256, 256, blend );
2261 compare_hash(hdc, bmi, bits, "AlphaBlend src 1-bpp" );
2262
2263 /* blitting with 1-bpp ddb source */
2264
2265 bmp = CreateBitmap( 16, 16, 1, 1, ddb_brush_bits );
2266 DeleteObject( SelectObject( src_dc, bmp ) );
2267
2268 old_text = GetTextColor( hdc );
2269 old_bkgnd = GetBkColor( hdc );
2270 for (i = 0; i < 256; i += 13)
2271 {
2272 SetTextColor(hdc, RGB( i, 2*i, 255 - i ) );
2273 SetBkColor(hdc, RGB( 255 - i, i / 3, i ) );
2274 BitBlt( hdc, i, 0, 13, 13, src_dc, 0, 0, SRCCOPY );
2275 }
2276 for (i = 0; i < 256; i += 13)
2277 {
2278 SetTextColor(hdc, PALETTEINDEX( i ));
2279 SetBkColor(hdc, PALETTEINDEX( i + 3 ));
2280 BitBlt( hdc, i, 13, 13, 13, src_dc, 0, 0, SRCCOPY );
2281 }
2282 for (i = 0; i < 256; i += 13)
2283 {
2284 SetTextColor(hdc, DIBINDEX( i ));
2285 SetBkColor(hdc, DIBINDEX( i + 3 ));
2286 BitBlt( hdc, i, 26, 13, 13, src_dc, 0, 0, SRCCOPY );
2287 }
2288 SetTextColor( hdc, old_text );
2289 SetBkColor( hdc, old_bkgnd );
2290 compare_hash(hdc, bmi, bits, "BitBlt src 1-bpp ddb SRCCOPY" );
2291
2292 DeleteObject( bmp );
2293
2294 /* blitting to 1-bpp ddb dest */
2295
2296 bmp = CreateBitmap( 16, 16, 1, 1, ddb_brush_bits );
2297 DeleteObject( SelectObject( src_dc, bmp ) );
2298
2299 for (y = 0; y < 16; y++)
2300 for (x = 0; x < 16; x++)
2301 SetPixel( hdc, x, y, RGB( 16 * x, 16 * y, 8 * (x + y)) );
2302 PatBlt( hdc, 15, 15, 1, 1, WHITENESS );
2303 /* source colors are ignored */
2304 SetTextColor( src_dc, 0xbeef );
2305 SetBkColor( src_dc, RGB( 16 * 2, 16 * 3, 8 * (2 + 3) ));
2306 /* destination text color is also ignored */
2307 SetTextColor( hdc, 0xbedead );
2308
2309 i = 16;
2310 SetBkColor( hdc, 0xffffff );
2311 BitBlt( src_dc, 0, 0, 16, 16, hdc, 0, 0, SRCCOPY );
2312 GetBitmapBits( bmp, 32, bits + get_stride(bmi) * i++ );
2313 StretchDIBits( src_dc, 0, 0, 16, 16, 0,
2314 bmi->bmiHeader.biHeight - 16, 16, 16, bits, bmi, DIB_RGB_COLORS, SRCCOPY );
2315 GetBitmapBits( bmp, 32, bits + get_stride(bmi) * i++ );
2316 SetBkColor( hdc, 0 );
2317 BitBlt( src_dc, 0, 0, 16, 16, hdc, 0, 0, SRCCOPY );
2318 GetBitmapBits( bmp, 32, bits + get_stride(bmi) * i++ );
2319 StretchDIBits( src_dc, 0, 0, 16, 16, 0,
2320 bmi->bmiHeader.biHeight - 16, 16, 16, bits, bmi, DIB_RGB_COLORS, SRCCOPY );
2321 GetBitmapBits( bmp, 32, bits + get_stride(bmi) * i++ );
2322 SetBkColor( hdc, RGB( 16 * 2, 16 * 3, 8 * (2 + 3) ));
2323 BitBlt( src_dc, 0, 0, 16, 16, hdc, 0, 0, SRCCOPY );
2324 GetBitmapBits( bmp, 32, bits + get_stride(bmi) * i++ );
2325 StretchDIBits( src_dc, 0, 0, 16, 16, 0,
2326 bmi->bmiHeader.biHeight - 16, 16, 16, bits, bmi, DIB_RGB_COLORS, SRCCOPY );
2327 GetBitmapBits( bmp, 32, bits + get_stride(bmi) * i++ );
2328 SetBkColor( hdc, RGB( 16 * 13, 16 * 14, 8 * (13 + 14) ));
2329 BitBlt( src_dc, 0, 0, 16, 16, hdc, 0, 0, SRCCOPY );
2330 GetBitmapBits( bmp, 32, bits + get_stride(bmi) * i++ );
2331 StretchDIBits( src_dc, 0, 0, 16, 16, 0,
2332 bmi->bmiHeader.biHeight - 16, 16, 16, bits, bmi, DIB_RGB_COLORS, SRCCOPY );
2333 GetBitmapBits( bmp, 32, bits + get_stride(bmi) * i++ );
2334 SetBkColor( hdc, PALETTEINDEX( 1 ));
2335 BitBlt( src_dc, 0, 0, 16, 16, hdc, 0, 0, SRCCOPY );
2336 GetBitmapBits( bmp, 32, bits + get_stride(bmi) * i++ );
2337 StretchDIBits( src_dc, 0, 0, 16, 16, 0,
2338 bmi->bmiHeader.biHeight - 16, 16, 16, bits, bmi, DIB_RGB_COLORS, SRCCOPY );
2339 GetBitmapBits( bmp, 32, bits + get_stride(bmi) * i++ );
2340 SetBkColor( hdc, DIBINDEX( 2 ));
2341 BitBlt( src_dc, 0, 0, 16, 16, hdc, 0, 0, SRCCOPY );
2342 GetBitmapBits( bmp, 32, bits + get_stride(bmi) * i++ );
2343 StretchDIBits( src_dc, 0, 0, 16, 16, 0,
2344 bmi->bmiHeader.biHeight - 16, 16, 16, bits, bmi, DIB_RGB_COLORS, SRCCOPY );
2345 GetBitmapBits( bmp, 32, bits + get_stride(bmi) * i++ );
2346 SetTextColor( hdc, old_text );
2347 SetBkColor( hdc, old_bkgnd );
2348 compare_hash(hdc, bmi, bits, "BitBlt dst 1-bpp ddb");
2349
2350 DeleteDC( src_dc );
2351 DeleteObject( bmp );
2352
2353 /* RLE StretchDIBits */
2354 src_bi->bmiHeader.biSize = sizeof(src_bi->bmiHeader);
2355 src_bi->bmiHeader.biWidth = 8;
2356 src_bi->bmiHeader.biHeight = 8;
2357 src_bi->bmiHeader.biPlanes = 1;
2358 src_bi->bmiHeader.biBitCount = 8;
2359 src_bi->bmiHeader.biCompression = BI_RLE8;
2360 src_bi->bmiHeader.biClrUsed = 0;
2361 src_bi->bmiHeader.biSizeImage = sizeof(rle8_data);
2362
2363 for (i = 0; i < 256; i++)
2364 {
2365 src_bi->bmiColors[i].rgbRed = i;
2366 src_bi->bmiColors[i].rgbGreen = i;
2367 src_bi->bmiColors[i].rgbBlue = i;
2368 src_bi->bmiColors[i].rgbReserved = 0;
2369 }
2370
2371 StretchDIBits( hdc, 10, 10, 7, 7, 0, 0, 7, 7, rle8_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
2372 StretchDIBits( hdc, 100, 10, 7, 7, 0, 0, 7, 7, rle8_data, src_bi, DIB_RGB_COLORS, SRCAND );
2373 StretchDIBits( hdc, 200, 10, 7, 7, 0, 1, 7, 7, rle8_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
2374 StretchDIBits( hdc, 300, 10, 7, 7, 1, 0, 7, 7, rle8_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
2375 StretchDIBits( hdc, 400, 10, 16, 16, 0, 0, 8, 8, rle8_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
2376 compare_hash_broken_todo(hdc, bmi, bits, "rle stretchdibits", 0, dib_is_1bpp );
2377
2378 /* 32 bpp StretchDIBits */
2379
2380 src_bi->bmiHeader.biWidth = 4;
2381 src_bi->bmiHeader.biHeight = 4;
2382 src_bi->bmiHeader.biPlanes = 1;
2383 src_bi->bmiHeader.biBitCount = 32;
2384 src_bi->bmiHeader.biCompression = BI_RGB;
2385 src_bi->bmiHeader.biClrUsed = 0;
2386 src_bi->bmiHeader.biSizeImage = 0;
2387
2388 ret = StretchDIBits( hdc, 10, 10, 4, 4, 0, 0, 4, 4, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
2389 ok(ret == 4, "got %d\n", ret);
2390 ret = StretchDIBits( hdc, 20, 10, 4, 4, 0, 0, 4, 4, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCAND );
2391 ok(ret == 4, "got %d\n", ret);
2392 ret = StretchDIBits( hdc, 30, 10, 3, 3, 1, 1, 3, 3, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
2393 ok(ret == 4, "got %d\n", ret);
2394 ret = StretchDIBits( hdc, 40, 10, 3, 3, 1, 1, 3, 3, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCAND );
2395 ok(ret == 4, "got %d\n", ret);
2396 ret = StretchDIBits( hdc, 50, 10, -2, -2, 2, 3, -2, -2, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
2397 ok(ret == 4, "got %d\n", ret);
2398 ret = StretchDIBits( hdc, 60, 10, -2, -2, 2, 3, -2, -2, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCAND );
2399 ok(ret == 4, "got %d\n", ret);
2400
2401 src_bi->bmiHeader.biHeight = -4;
2402
2403 ret = StretchDIBits( hdc, 10, 100, 4, 4, 0, 0, 4, 4, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
2404 ok(ret == 4, "got %d\n", ret);
2405 ret = StretchDIBits( hdc, 20, 100, 4, 4, 0, 0, 4, 4, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCAND );
2406 ok(ret == -4, "got %d\n", ret);
2407 ret = StretchDIBits( hdc, 30, 100, 3, 3, 1, 1, 3, 3, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
2408 ok(ret == 4, "got %d\n", ret);
2409 ret = StretchDIBits( hdc, 40, 100, 3, 3, 1, 1, 3, 3, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCAND );
2410 ok(ret == -4, "got %d\n", ret);
2411 ret = StretchDIBits( hdc, 50, 100, -2, -2, 2, 3, -2, -2, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCCOPY );
2412 ok(ret == 4, "got %d\n", ret);
2413 ret = StretchDIBits( hdc, 60, 100, -2, -2, 2, 3, -2, -2, four_by_four_data, src_bi, DIB_RGB_COLORS, SRCAND );
2414 ok(ret == -4, "got %d\n", ret);
2415
2416 compare_hash_broken_todo(hdc, bmi, bits, "stretchdibits", dib_is_8bpp_gray ? 1 : 0, dib_is_8bpp_gray );
2417
2418 /* Solid colors */
2419 for (i = 0; i < 256; i++)
2420 {
2421 solid_patblt( hdc, i * 2, 10, 1, 1, DIBINDEX(i) );
2422 solid_patblt( hdc, i * 2, 20, 1, 1, PALETTEINDEX(i) );
2423 solid_patblt( hdc, i * 2, 30, 1, 1, RGB( (i & 0x07) << 5, (i & 0x38) << 2, i & 0xc0 ) );
2424 solid_patblt( hdc, i * 2, 40, 1, 1, PALETTERGB( (i & 0x07) << 5, (i & 0x38) << 2, i & 0xc0 ) );
2425 for (j = 0; j < 256; j++) solid_patblt( hdc, i * 2, 50 + j, 1, 1, (j << 24) | i );
2426 }
2427
2428 /* A few extra colors that are interesting in the 1bpp case */
2429
2430 /* bk color */
2431 solid_patblt( hdc, 0, 50, 1, 1, RGB( 0, 0xff, 0 ) );
2432 solid_patblt( hdc, 2, 50, 1, 1, PALETTERGB( 0, 0xff, 0 ) );
2433
2434 /* color 0 */
2435 solid_patblt( hdc, 4, 50, 1, 1, RGB( 0, 0x1, 0xff ) );
2436 solid_patblt( hdc, 6, 50, 1, 1, PALETTERGB( 0, 0x1, 0xff ) );
2437
2438 /* color 1 */
2439 solid_patblt( hdc, 8, 50, 1, 1, RGB( 0xff, 0, 0 ) );
2440 solid_patblt( hdc, 10, 50, 1, 1, PALETTERGB( 0xff, 0, 0 ) );
2441
2442 compare_hash(hdc, bmi, bits, "Colors");
2443
2444 for (i = 0; i < 256; i++)
2445 {
2446 COLORREF s, g;
2447 s = SetPixel( hdc, i * 2, 10, DIBINDEX(i) );
2448 g = GetPixel( hdc, i * 2, 10 );
2449 ok( s == g, "got %08x and %08x\n", s, g );
2450
2451 s = SetPixel( hdc, i * 2, 20, PALETTEINDEX(i) );
2452 g = GetPixel( hdc, i * 2, 20 );
2453 ok( s == g, "got %08x and %08x\n", s, g );
2454
2455 s = SetPixel( hdc, i * 2, 30, RGB( (i & 0x07) << 5, (i & 0x38) << 2, i & 0xc0 ) );
2456 g = GetPixel( hdc, i * 2, 30 );
2457 ok( s == g, "got %08x and %08x\n", s, g );
2458
2459 s = SetPixel( hdc, i * 2, 40, PALETTERGB( (i & 0x07) << 5, (i & 0x38) << 2, i & 0xc0 ) );
2460 g = GetPixel( hdc, i * 2, 40 );
2461 ok( s == g, "got %08x and %08x\n", s, g );
2462
2463 for (j = 0; j < 256; j++)
2464 {
2465 s = SetPixel( hdc, i * 2, 50+j, (j << 24) | RGB( (i & 0x07) << 5, (i & 0x38) << 2, i & 0xc0 ));
2466 g = GetPixel( hdc, i * 2, 50+j );
2467 ok( s == g, "got %08x and %08x\n", s, g );
2468
2469 s = SetPixel( hdc, i * 2 + 1, 50+j, (j << 24) | i );
2470 g = GetPixel( hdc, i * 2 + 1, 50+j );
2471 ok( s == g, "got %08x and %08x\n", s, g );
2472 }
2473 }
2474
2475 compare_hash(hdc, bmi, bits, "SetPixel");
2476
2477 /* gradients */
2478
2479 {
2480 TRIVERTEX vrect[] =
2481 {
2482 { 1, 1, 0xff00, 0x8000, 0x0000, 0x8000 },
2483 { 200, 200, 0x0000, 0x0000, 0xff00, 0xff00 },
2484 { 180, 180, 0x1234, 0x5678, 0x9abc, 0xdef0 },
2485 { 300, 300, 0xff00, 0xff00, 0xff00, 0x0000 }
2486 };
2487 GRADIENT_RECT rect[] = { { 0, 1 }, { 2, 3 }, { 2, 1 } };
2488
2489 TRIVERTEX vtri[] =
2490 {
2491 { 250, 0, 0xff00, 0x0000, 0xff00, 0xff00 },
2492 { 500, 500, 0x0000, 0xff00, 0x0000, 0xff00 },
2493 { 0, 500, 0x0000, 0x0000, 0xff00, 0xff00 },
2494
2495 { 10, 0, 0x8000, 0x0000, 0x8000, 0x8000 },
2496 { 0, 20, 0xff00, 0xff00, 0xff00, 0x0000 },
2497 { 5, 30, 0x4000, 0xc000, 0x7000, 0x9000 },
2498
2499 { 30, 0, 0x9000, 0x8800, 0xcc00, 0xff00 },
2500 { 5, 12, 0x9900, 0xaa00, 0xbb00, 0xcc00 },
2501 { 0, 30, 0x5000, 0xd000, 0x9000, 0xbb00 },
2502
2503 { 35, 3, 0xaa00, 0x6500, 0x4300, 0x2100 },
2504 { 50, 6, 0x9800, 0x9800, 0x9800, 0x2000 },
2505 { 60, 10, 0x0100, 0x0200, 0x0300, 0x3000 },
2506
2507 { 60, 2, 0x0700, 0x0800, 0x0900, 0xff00 },
2508 { 73, 10, 0x9900, 0x8800, 0x7700, 0xff00 },
2509 { 66, 23, 0x1100, 0x2200, 0x3300, 0xff00 },
2510
2511 { 80, 1, 0xa000, 0x6000, 0x4000, 0x2000 },
2512 { 76, 9, 0x7000, 0x5000, 0x3000, 0x1000 },
2513 { 85, 23, 0x3300, 0x3300, 0x3300, 0x3300 },
2514
2515 { 90, 4, 0x4400, 0x5500, 0x6600, 0x9900 },
2516 { 95, 12, 0x4500, 0x5600, 0x6700, 0x9900 },
2517 { 85, 14, 0x4600, 0x5700, 0x6800, 0x9900 },
2518 };
2519 GRADIENT_TRIANGLE tri[] =
2520 {
2521 { 0, 1, 2 }, { 3, 4, 5 }, { 6, 7, 8 }, { 9, 10, 11 }, { 12, 13, 14 }, { 15, 16, 17 }, { 18, 19, 20 },
2522 { 2, 1, 0 }, { 3, 5, 4 }, { 7, 6, 8 }, { 10, 11, 9 }, { 14, 13, 12 }, { 17, 15, 16 }, { 19, 20, 18 }
2523 };
2524
2525 GdiGradientFill( hdc, vrect, 4, rect, 2, GRADIENT_FILL_RECT_H );
2526 for (i = 0; i < 4; i++) vrect[i].y += 250;
2527 GdiGradientFill( hdc, vrect, 4, rect, 2, GRADIENT_FILL_RECT_V );
2528 /* Wine's 8-bit dithering isn't identical to Windows */
2529 compare_hash_broken_todo(hdc, bmi, bits, "GdiGradientFill", 0, (bmi->bmiHeader.biBitCount <= 8) );
2530
2531 GdiGradientFill( hdc, vtri, 7*3, tri, 7, GRADIENT_FILL_TRIANGLE );
2532 for (i = 0; i < 7*3; i++) vtri[i].y += 100;
2533 GdiGradientFill( hdc, vtri, 7*3, tri + 7, 7, GRADIENT_FILL_TRIANGLE );
2534 /* Wine's 8-bit dithering isn't identical to Windows */
2535 compare_hash_broken_todo(hdc, bmi, bits, "GdiGradientFill", 0, (bmi->bmiHeader.biBitCount <= 8) );
2536 }
2537
2538 /* wide pen */
2539
2540 wide_pen = CreatePen( PS_SOLID, 7, RGB( 0xff, 0, 0 ) );
2541 SelectObject( hdc, wide_pen );
2542
2543 for (i = 0; i < sizeof( wide_lines ) / sizeof( wide_lines[0] ); i++)
2544 {
2545 MoveToEx( hdc, wide_lines[i].left, wide_lines[i].top, NULL );
2546 LineTo( hdc, wide_lines[i].right, wide_lines[i].bottom );
2547 }
2548
2549 compare_hash(hdc, bmi, bits, "wide pen" );
2550
2551 SelectObject( hdc, orig_pen );
2552 DeleteObject( wide_pen );
2553
2554 log_brush.lbStyle = BS_SOLID;
2555 log_brush.lbColor = RGB(0xff, 0, 0);
2556 log_brush.lbHatch = 0;
2557
2558 wide_pen = ExtCreatePen( PS_GEOMETRIC | PS_ENDCAP_FLAT | PS_JOIN_MITER | PS_SOLID,
2559 9, &log_brush, 0, NULL );
2560 SelectObject( hdc, wide_pen );
2561
2562 Polyline( hdc, poly_lines, sizeof(poly_lines) / sizeof(poly_lines[0]) );
2563 compare_hash(hdc, bmi, bits, "wide pen - flat caps, mitred" );
2564
2565 SelectObject( hdc, orig_pen );
2566 DeleteObject( wide_pen );
2567
2568 wide_pen = ExtCreatePen( PS_GEOMETRIC | PS_ENDCAP_SQUARE | PS_JOIN_BEVEL | PS_SOLID,
2569 16, &log_brush, 0, NULL );
2570 SelectObject( hdc, wide_pen );
2571
2572 Polyline( hdc, poly_lines, sizeof(poly_lines) / sizeof(poly_lines[0]) );
2573 compare_hash(hdc, bmi, bits, "wide pen - square caps, bevelled" );
2574
2575 SelectObject( hdc, orig_pen );
2576 DeleteObject( wide_pen );
2577
2578 wide_pen = ExtCreatePen( PS_GEOMETRIC | PS_ENDCAP_FLAT | PS_JOIN_MITER | PS_SOLID,
2579 9, &log_brush, 0, NULL );
2580 SelectObject( hdc, wide_pen );
2581
2582 PolyPolyline( hdc, polypoly_lines, polypoly_counts, sizeof(polypoly_counts)/sizeof(polypoly_counts[0]) );
2583 compare_hash(hdc, bmi, bits, "wide pen - empty segments" );
2584
2585 SelectObject( hdc, orig_pen );
2586 DeleteObject( wide_pen );
2587
2588 /* brushed wide pen */
2589
2590 old_text = GetTextColor( hdc );
2591 old_bkgnd = GetBkColor( hdc );
2592 bmp = CreateBitmap( 16, 16, 1, 1, ddb_brush_bits );
2593 log_brush.lbStyle = BS_PATTERN;
2594 log_brush.lbColor = 0;
2595 log_brush.lbHatch = (ULONG_PTR)bmp;
2596 wide_pen = ExtCreatePen( PS_GEOMETRIC | PS_ENDCAP_FLAT | PS_JOIN_BEVEL | PS_SOLID,
2597 12, &log_brush, 0, NULL );
2598 ok( wide_pen != 0, "failed to create pen\n" );
2599 SelectObject( hdc, wide_pen );
2600 Polyline( hdc, poly_lines, sizeof(poly_lines) / sizeof(poly_lines[0]) );
2601
2602 for (i = 1; i < 20; i++)
2603 {
2604 wide_pen = ExtCreatePen( PS_GEOMETRIC | PS_ENDCAP_FLAT | PS_JOIN_BEVEL | PS_SOLID,
2605 i, &log_brush, 0, NULL );
2606 ok( wide_pen != 0, "failed to create pen\n" );
2607 DeleteObject( SelectObject( hdc, wide_pen ));
2608 SetTextColor(hdc, RGB( 2*i, i, 255 - i ) );
2609 SetBkColor(hdc, RGB( 255 - i, i, i / 3 ) );
2610 MoveToEx( hdc, 10 * i, 10, NULL );
2611 LineTo( hdc, 10 * i, 200 + i );
2612 LineTo( hdc, 20 * i, 200 + i );
2613 }
2614 compare_hash_broken_todo(hdc, bmi, bits, "wide brushed pen", 0, dib_is_1bpp );
2615
2616 for (i = 1; i < 20; i++)
2617 {
2618 wide_pen = ExtCreatePen( PS_GEOMETRIC | PS_ENDCAP_FLAT | PS_JOIN_BEVEL | (i % 5),
2619 i, &log_brush, 0, NULL );
2620 DeleteObject( SelectObject( hdc, wide_pen ));
2621 SetTextColor(hdc, RGB( 2*i, i, 255 - i ) );
2622 SetBkColor(hdc, RGB( i, 255 - i, i / 3 ) );
2623 MoveToEx( hdc, 10 * i, 10, NULL );
2624 LineTo( hdc, 10 * i, 200 + i );
2625 LineTo( hdc, 20 * i, 200 + i );
2626 }
2627 compare_hash_broken_todo(hdc, bmi, bits, "dashed wide brushed pen", 0, dib_is_1bpp );
2628
2629 DeleteObject(bmp);
2630 SetTextColor(hdc, old_text);
2631 SetBkColor(hdc, old_bkgnd);
2632 SelectObject( hdc, orig_pen );
2633
2634 /* PALETTEINDEX */
2635
2636 solid_brush = CreateSolidBrush( PALETTEINDEX(3) );
2637 solid_pen = CreatePen( PS_DASH, 1, PALETTEINDEX(5) );
2638 SetTextColor( hdc, PALETTEINDEX(38) );
2639 SetBkColor( hdc, PALETTEINDEX(9) );
2640 SelectObject( hdc, solid_brush );
2641 SelectObject( hdc, solid_pen );
2642
2643 pal->palVersion = 0x300;
2644 pal->palNumEntries = 40;
2645 for (i = 0; i < 80; i++)
2646 {
2647 entries[i].peRed = i * 3;
2648 entries[i].peGreen = i * 7;
2649 entries[i].peBlue = 128 - i;
2650 entries[i].peFlags = 0;
2651 }
2652 hpal = CreatePalette( pal );
2653 old_hpal = SelectPalette( hdc, hpal, FALSE );
2654
2655 solid_patblt( hdc, 20, 10, 10, 10, PALETTEINDEX(15) );
2656 Rectangle( hdc, 0, 0, 10, 10 );
2657 SetPaletteEntries( hpal, 0, 40, entries + 40 );
2658 Rectangle( hdc, 10, 0, 10, 10 );
2659 SelectObject( hdc, orig_brush );
2660 DeleteObject( solid_brush );
2661
2662 solid_brush = CreateHatchBrush( HS_CROSS, PALETTEINDEX(7) );
2663 DeleteObject( SelectObject( hdc, solid_brush ));
2664 PatBlt( hdc, 20, 0, 10, 10, PATCOPY );
2665 SetPaletteEntries( hpal, 0, 40, entries );
2666 PatBlt( hdc, 30, 0, 10, 10, PATCOPY );
2667 SelectObject( hdc, orig_brush );
2668 DeleteObject( solid_brush );
2669
2670 bmp = CreateBitmap( 16, 16, 1, 1, ddb_brush_bits );
2671 dib_brush = CreatePatternBrush( bmp );
2672 SelectObject( hdc, dib_brush );
2673 PatBlt( hdc, 40, 0, 10, 10, PATCOPY );
2674 SetPaletteEntries( hpal, 0, 40, entries + 40 );
2675 PatBlt( hdc, 50, 0, 10, 10, PATCOPY );
2676 DeleteObject( bmp );
2677 SelectObject( hdc, orig_brush );
2678 DeleteObject( dib_brush );
2679
2680 SelectPalette( hdc, old_hpal, FALSE );
2681 DeleteObject( hpal );
2682
2683 compare_hash_broken_todo(hdc, bmi, bits, "PALETTEINDEX", 0, dib_is_1bpp );
2684
2685 /* ExtFloodFill */
2686
2687 solid_patblt( hdc, 0, 0, 512, 512, RGB( 0, 0, 0xff ) );
2688 solid_patblt( hdc, 10, 10, 200, 200, RGB( 0, 0xff, 0 ) );
2689 solid_patblt( hdc, 10, 50, 50, 50, RGB( 0, 0, 0xff ) );
2690 solid_patblt( hdc, 100, 160, 50, 50, RGB( 0, 0, 0xff ) );
2691 solid_patblt( hdc, 90, 160, 70, 10, RGB( 0, 0, 0xff ) );
2692
2693 /* add a vertical 'bar' to show that the clip rgn stops the flooding */
2694 hrgn = CreateRectRgn( 180, 10, 190, 210 );
2695 ExtSelectClipRgn( hdc, hrgn, RGN_DIFF );
2696 DeleteObject( hrgn );
2697
2698 solid_brush = CreateSolidBrush( RGB( 0xff, 0, 0 ) );
2699 SelectObject( hdc, solid_brush );
2700
2701 ret = ExtFloodFill( hdc, 100, 100, RGB( 0, 0xff, 0 ), FLOODFILLSURFACE );
2702 ok (ret, "got ret %d\n", ret);
2703 compare_hash(hdc, bmi, bits, "flood fill" );
2704
2705 ExtSelectClipRgn( hdc, NULL, RGN_COPY );
2706
2707 ret = ExtFloodFill( hdc, -1, -1, RGB( 0, 0xff, 0 ), FLOODFILLSURFACE );
2708 ok (!ret, "got ret %d\n", ret);
2709
2710 SelectObject(hdc, orig_brush);
2711 SelectObject(hdc, orig_pen);
2712 DeleteObject(solid_brush);
2713 DeleteObject(wide_pen);
2714 DeleteObject(dashed_pen);
2715 DeleteObject(solid_pen);
2716 }
2717
2718 static const BYTE ramp[17] =
2719 {
2720 0, 0x4d, 0x68, 0x7c,
2721 0x8c, 0x9a, 0xa7, 0xb2,
2722 0xbd, 0xc7, 0xd0, 0xd9,
2723 0xe1, 0xe9, 0xf0, 0xf8,
2724 0xff
2725 };
2726
2727 static inline void get_range(BYTE alpha, DWORD text_comp, BYTE *min_comp, BYTE *max_comp)
2728 {
2729 *min_comp = (ramp[alpha] * text_comp) / 0xff;
2730 *max_comp = ramp[16 - alpha] + ((0xff - ramp[16 - alpha]) * text_comp) / 0xff;
2731 }
2732
2733 static inline BYTE aa_comp(BYTE dst, BYTE text, BYTE alpha)
2734 {
2735 BYTE min_comp, max_comp;
2736
2737 if (alpha == 16) return text;
2738 if (alpha <= 1) return dst;
2739 if (text == dst) return dst;
2740
2741 get_range( alpha, text, &min_comp, &max_comp );
2742
2743 if (dst > text)
2744 {
2745 DWORD diff = dst - text;
2746 DWORD range = max_comp - text;
2747 dst = text + (diff * range ) / (0xff - text);
2748 return dst;
2749 }
2750 else
2751 {
2752 DWORD diff = text - dst;
2753 DWORD range = text - min_comp ;
2754 dst = text - (diff * range) / text;
2755 return dst;
2756 }
2757 }
2758
2759 static inline COLORREF aa_colorref( COLORREF dst, COLORREF text, BYTE glyph )
2760 {
2761 COLORREF ret;
2762
2763 ret = RGB( aa_comp( GetRValue(dst), GetRValue(text), glyph ),
2764 aa_comp( GetGValue(dst), GetGValue(text), glyph ),
2765 aa_comp( GetBValue(dst), GetBValue(text), glyph ) );
2766 return ret;
2767 }
2768
2769 static const BYTE masks[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
2770
2771 static void draw_text_2( HDC hdc, const BITMAPINFO *bmi, BYTE *bits, BOOL aa )
2772 {
2773 DWORD dib_size = get_dib_size(bmi), ret;
2774 LOGFONTA lf;
2775 HFONT font;
2776 GLYPHMETRICS gm;
2777 BYTE g_buf[10000];
2778 int i, stride, x, y;
2779 static const MAT2 identity = { {0,1}, {0,0}, {0,0}, {0,1} };
2780 char *eto_hash = NULL, *diy_hash = NULL;
2781 static const char str[] = "Hello Wine";
2782 POINT origin, g_org;
2783 static const BYTE vals[4] = { 0x00, 0x00, 0x00, 0x00 };
2784 TEXTMETRICA tm;
2785 COLORREF text_color;
2786
2787 for(i = 0; i < dib_size; i++)
2788 bits[i] = vals[i % 4];
2789
2790 memset( &lf, 0, sizeof(lf) );
2791 strcpy( lf.lfFaceName, "Tahoma" );
2792 lf.lfHeight = 24;
2793 lf.lfQuality = aa ? ANTIALIASED_QUALITY : NONANTIALIASED_QUALITY;
2794
2795 font = CreateFontIndirectA( &lf );
2796 font = SelectObject( hdc, font );
2797
2798 GetTextMetricsA( hdc, &tm );
2799 if (!(tm.tmPitchAndFamily & TMPF_VECTOR))
2800 {
2801 skip( "skipping as a bitmap font has been selected for Tahoma.\n" );
2802 DeleteObject( SelectObject( hdc, font ) );
2803 return;
2804 }
2805
2806 SetTextColor( hdc, RGB(0xff, 0x00, 0x00) );
2807 SetTextAlign( hdc, TA_BASELINE );
2808 SetBkMode( hdc, TRANSPARENT );
2809 origin.x = 10;
2810 origin.y = 100;
2811
2812 ExtTextOutA( hdc, origin.x, origin.y, 0, NULL, str, strlen(str), NULL );
2813 eto_hash = hash_dib( bmi, bits );
2814
2815 for(i = 0; i < dib_size; i++)
2816 bits[i] = vals[i % 4];
2817
2818 if (bmi->bmiHeader.biBitCount <= 8) aa = FALSE;
2819
2820 text_color = GetTextColor( hdc );
2821 for (i = 0; i < strlen(str); i++)
2822 {
2823 DWORD ggo_flags = aa ? GGO_GRAY4_BITMAP : GGO_BITMAP;
2824
2825 ret = GetGlyphOutlineA( hdc, str[i], ggo_flags, &gm, 0, NULL, &identity );
2826
2827 if (ret == GDI_ERROR) continue;
2828
2829 if (ret) GetGlyphOutlineA( hdc, str[i], ggo_flags, &gm, sizeof(g_buf), g_buf, &identity );
2830
2831 g_org.x = origin.x + gm.gmptGlyphOrigin.x;
2832 g_org.y = origin.y - gm.gmptGlyphOrigin.y;
2833
2834 origin.x += gm.gmCellIncX;
2835 origin.y += gm.gmCellIncY;
2836
2837 if (!ret) continue;
2838
2839 if (aa)
2840 {
2841 stride = (gm.gmBlackBoxX + 3) & ~3;
2842
2843 for (y = 0; y < gm.gmBlackBoxY; y++)
2844 {
2845 BYTE *g_ptr = g_buf + y * stride;
2846 COLORREF val;
2847
2848 for (x = 0; x < gm.gmBlackBoxX; x++)
2849 {
2850 if (g_ptr[x] <= 1) continue;
2851 if (g_ptr[x] >= 16) val = text_color;
2852 else
2853 {
2854 val = GetPixel( hdc, g_org.x + x, g_org.y + y );
2855 val = aa_colorref( val, text_color, g_ptr[x] );
2856 }
2857 SetPixel( hdc, g_org.x + x, g_org.y + y, val );
2858 }
2859 }
2860 }
2861 else
2862 {
2863 stride = ((gm.gmBlackBoxX + 31) >> 3) & ~3;
2864
2865 for (y = 0; y < gm.gmBlackBoxY; y++)
2866 {
2867 BYTE *g_ptr = g_buf + y * stride;
2868 for (x = 0; x < gm.gmBlackBoxX; x++)
2869 {
2870 if (g_ptr[x / 8] & masks[x % 8])
2871 SetPixel( hdc, g_org.x + x, g_org.y + y, text_color );
2872 }
2873 }
2874 }
2875 }
2876
2877 diy_hash = hash_dib( bmi, bits );
2878 ok( !strcmp( eto_hash, diy_hash ), "hash mismatch - aa %d\n", aa );
2879
2880 HeapFree( GetProcessHeap(), 0, diy_hash );
2881 HeapFree( GetProcessHeap(), 0, eto_hash );
2882
2883 font = SelectObject( hdc, font );
2884 DeleteObject( font );
2885 }
2886
2887 static void draw_text( HDC hdc, const BITMAPINFO *bmi, BYTE *bits )
2888 {
2889 draw_text_2( hdc, bmi, bits, FALSE );
2890
2891 /* Rounding errors make these cases hard to test */
2892 if ((bmi->bmiHeader.biCompression == BI_BITFIELDS && ((DWORD*)bmi->bmiColors)[0] == 0x3f000) ||
2893 (bmi->bmiHeader.biBitCount == 16))
2894 return;
2895
2896 draw_text_2( hdc, bmi, bits, TRUE );
2897 }
2898
2899 static void test_simple_graphics(void)
2900 {
2901 char bmibuf[sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD)];
2902 BITMAPINFO *bmi = (BITMAPINFO *)bmibuf;
2903 RGBQUAD *colors = bmi->bmiColors;
2904 DWORD *bit_fields = (DWORD*)(bmibuf + sizeof(BITMAPINFOHEADER));
2905 HDC mem_dc;
2906 BYTE *bits;
2907 HBITMAP dib, orig_bm;
2908 DIBSECTION ds;
2909 HPALETTE default_palette, old_hpal;
2910 int i;
2911
2912 mem_dc = CreateCompatibleDC(NULL);
2913
2914 /* a8r8g8b8 */
2915 trace("8888\n");
2916 memset(bmi, 0, sizeof(bmibuf));
2917 bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
2918 bmi->bmiHeader.biHeight = 512;
2919 bmi->bmiHeader.biWidth = 512;
2920 bmi->bmiHeader.biBitCount = 32;
2921 bmi->bmiHeader.biPlanes = 1;
2922 bmi->bmiHeader.biCompression = BI_RGB;
2923
2924 dib = CreateDIBSection(0, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
2925 ok(dib != NULL, "ret NULL\n");
2926 ok(GetObjectW( dib, sizeof(ds), &ds ), "GetObject failed\n");
2927 ok(ds.dsBitfields[0] == 0, "got %08x\n", ds.dsBitfields[0]);
2928 ok(ds.dsBitfields[1] == 0, "got %08x\n", ds.dsBitfields[1]);
2929 ok(ds.dsBitfields[2] == 0, "got %08x\n", ds.dsBitfields[2]);
2930 ok(ds.dsBmih.biCompression == BI_RGB, "got %x\n", ds.dsBmih.biCompression);
2931
2932 orig_bm = SelectObject(mem_dc, dib);
2933
2934 default_palette = create_default_palette( 8 );
2935 old_hpal = SelectPalette( mem_dc, default_palette, FALSE );
2936
2937 dst_format = "8888";
2938 current_sha1 = sha1_graphics_a8r8g8b8;
2939 draw_graphics(mem_dc, bmi, bits);
2940 draw_text(mem_dc, bmi, bits);
2941
2942 SelectObject(mem_dc, orig_bm);
2943 DeleteObject(dib);
2944
2945 /* a8r8g8b8 - bitfields. Should be the same as the regular 32 bit case.*/
2946 trace("8888 - bitfields\n");
2947 bmi->bmiHeader.biBitCount = 32;
2948 bmi->bmiHeader.biCompression = BI_BITFIELDS;
2949 bit_fields[0] = 0xff0000;
2950 bit_fields[1] = 0x00ff00;
2951 bit_fields[2] = 0x0000ff;
2952
2953 dib = CreateDIBSection(mem_dc, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
2954 ok(dib != NULL, "ret NULL\n");
2955 ok(GetObjectW( dib, sizeof(ds), &ds ), "GetObject failed\n");
2956 ok(ds.dsBitfields[0] == 0xff0000, "got %08x\n", ds.dsBitfields[0]);
2957 ok(ds.dsBitfields[1] == 0x00ff00, "got %08x\n", ds.dsBitfields[1]);
2958 ok(ds.dsBitfields[2] == 0x0000ff, "got %08x\n", ds.dsBitfields[2]);
2959 ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %x\n", ds.dsBmih.biCompression);
2960
2961 orig_bm = SelectObject(mem_dc, dib);
2962 SelectPalette( mem_dc, default_palette, FALSE );
2963
2964 dst_format = "8888 - bitfields";
2965 current_sha1 = sha1_graphics_a8r8g8b8_bitfields;
2966 draw_graphics(mem_dc, bmi, bits);
2967 draw_text(mem_dc, bmi, bits);
2968
2969 SelectObject(mem_dc, orig_bm);
2970 DeleteObject(dib);
2971
2972 /* a8b8g8r8. */
2973 trace("a8b8g8r8\n");
2974 bmi->bmiHeader.biBitCount = 32;
2975 bmi->bmiHeader.biCompression = BI_BITFIELDS;
2976 bit_fields[0] = 0x0000ff;
2977 bit_fields[1] = 0x00ff00;
2978 bit_fields[2] = 0xff0000;
2979
2980 dib = CreateDIBSection(mem_dc, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
2981 ok(dib != NULL, "ret NULL\n");
2982 ok(GetObjectW( dib, sizeof(ds), &ds ), "GetObject failed\n");
2983 ok(ds.dsBitfields[0] == 0x0000ff, "got %08x\n", ds.dsBitfields[0]);
2984 ok(ds.dsBitfields[1] == 0x00ff00, "got %08x\n", ds.dsBitfields[1]);
2985 ok(ds.dsBitfields[2] == 0xff0000, "got %08x\n", ds.dsBitfields[2]);
2986 ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %x\n", ds.dsBmih.biCompression);
2987
2988 orig_bm = SelectObject(mem_dc, dib);
2989
2990 dst_format = "a8b8g8r8";
2991 current_sha1 = sha1_graphics_a8b8g8r8;
2992 draw_graphics(mem_dc, bmi, bits);
2993 draw_text(mem_dc, bmi, bits);
2994
2995 SelectObject(mem_dc, orig_bm);
2996 DeleteObject(dib);
2997
2998 /* r10g10b10. */
2999 trace("r10g10b10\n");
3000 bmi->bmiHeader.biBitCount = 32;
3001 bmi->bmiHeader.biCompression = BI_BITFIELDS;
3002 bit_fields[0] = 0x3ff00000;
3003 bit_fields[1] = 0x000ffc00;
3004 bit_fields[2] = 0x000003ff;
3005
3006 dib = CreateDIBSection(mem_dc, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
3007 ok(dib != NULL, "ret NULL\n");
3008 ok(GetObjectW( dib, sizeof(ds), &ds ), "GetObject failed\n");
3009 ok(ds.dsBitfields[0] == 0x3ff00000, "got %08x\n", ds.dsBitfields[0]);
3010 ok(ds.dsBitfields[1] == 0x000ffc00, "got %08x\n", ds.dsBitfields[1]);
3011 ok(ds.dsBitfields[2] == 0x000003ff, "got %08x\n", ds.dsBitfields[2]);
3012 ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %x\n", ds.dsBmih.biCompression);
3013
3014 orig_bm = SelectObject(mem_dc, dib);
3015
3016 dst_format = "r10g10b10";
3017 current_sha1 = sha1_graphics_r10g10b10;
3018 draw_graphics(mem_dc, bmi, bits);
3019 draw_text(mem_dc, bmi, bits);
3020
3021 SelectObject(mem_dc, orig_bm);
3022 DeleteObject(dib);
3023
3024 /* r6g6b6. */
3025 trace("r6g6b6\n");
3026 bmi->bmiHeader.biBitCount = 32;
3027 bmi->bmiHeader.biCompression = BI_BITFIELDS;
3028 bit_fields[0] = 0x0003f000;
3029 bit_fields[1] = 0x00000fc0;
3030 bit_fields[2] = 0x0000003f;
3031
3032 dib = CreateDIBSection(mem_dc, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
3033 ok(dib != NULL, "ret NULL\n");
3034 ok(GetObjectW( dib, sizeof(ds), &ds ), "GetObject failed\n");
3035 ok(ds.dsBitfields[0] == 0x0003f000, "got %08x\n", ds.dsBitfields[0]);
3036 ok(ds.dsBitfields[1] == 0x00000fc0, "got %08x\n", ds.dsBitfields[1]);
3037 ok(ds.dsBitfields[2] == 0x0000003f, "got %08x\n", ds.dsBitfields[2]);
3038 ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %x\n", ds.dsBmih.biCompression);
3039
3040 orig_bm = SelectObject(mem_dc, dib);
3041
3042 dst_format = "r6g6b6";
3043 current_sha1 = sha1_graphics_r6g6b6;
3044 draw_graphics(mem_dc, bmi, bits);
3045 draw_text(mem_dc, bmi, bits);
3046
3047 SelectObject(mem_dc, orig_bm);
3048 DeleteObject(dib);
3049
3050 /* 24 */
3051 trace("24\n");
3052 bmi->bmiHeader.biBitCount = 24;
3053 bmi->bmiHeader.biCompression = BI_RGB;
3054
3055 dib = CreateDIBSection(0, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
3056 ok(dib != NULL, "ret NULL\n");
3057 orig_bm = SelectObject(mem_dc, dib);
3058
3059 dst_format = "24";
3060 current_sha1 = sha1_graphics_24;
3061 draw_graphics(mem_dc, bmi, bits);
3062 draw_text(mem_dc, bmi, bits);
3063
3064 SelectObject(mem_dc, orig_bm);
3065 DeleteObject(dib);
3066
3067 /* r5g5b5 */
3068 trace("555\n");
3069 bmi->bmiHeader.biBitCount = 16;
3070 bmi->bmiHeader.biCompression = BI_RGB;
3071
3072 dib = CreateDIBSection(0, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
3073 ok(dib != NULL, "ret NULL\n");
3074 ok(GetObjectW( dib, sizeof(ds), &ds ), "GetObject failed\n");
3075 ok(ds.dsBitfields[0] == 0x7c00, "got %08x\n", ds.dsBitfields[0]);
3076 ok(ds.dsBitfields[1] == 0x03e0, "got %08x\n", ds.dsBitfields[1]);
3077 ok(ds.dsBitfields[2] == 0x001f, "got %08x\n", ds.dsBitfields[2]);
3078 ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %x\n", ds.dsBmih.biCompression);
3079
3080 orig_bm = SelectObject(mem_dc, dib);
3081
3082 dst_format = "r5g5b5";
3083 current_sha1 = sha1_graphics_r5g5b5;
3084 draw_graphics(mem_dc, bmi, bits);
3085 draw_text(mem_dc, bmi, bits);
3086
3087 SelectObject(mem_dc, orig_bm);
3088 DeleteObject(dib);
3089
3090 /* r4g4b4 */
3091 trace("444\n");
3092 bmi->bmiHeader.biBitCount = 16;
3093 bmi->bmiHeader.biCompression = BI_BITFIELDS;
3094 bit_fields[0] = 0x0f00;
3095 bit_fields[1] = 0x00f0;
3096 bit_fields[2] = 0x000f;
3097 dib = CreateDIBSection(0, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
3098 ok(dib != NULL, "ret NULL\n");
3099 ok(GetObjectW( dib, sizeof(ds), &ds ), "GetObject failed\n");
3100 ok(ds.dsBitfields[0] == 0x0f00, "got %08x\n", ds.dsBitfields[0]);
3101 ok(ds.dsBitfields[1] == 0x00f0, "got %08x\n", ds.dsBitfields[1]);
3102 ok(ds.dsBitfields[2] == 0x000f, "got %08x\n", ds.dsBitfields[2]);
3103 ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %x\n", ds.dsBmih.biCompression);
3104
3105 orig_bm = SelectObject(mem_dc, dib);
3106
3107 dst_format = "r4g4b4";
3108 current_sha1 = sha1_graphics_r4g4b4;
3109 draw_graphics(mem_dc, bmi, bits);
3110 draw_text(mem_dc, bmi, bits);
3111
3112 SelectObject(mem_dc, orig_bm);
3113 DeleteObject(dib);
3114
3115 /* 8 color */
3116 trace("8 color\n");
3117 bmi->bmiHeader.biBitCount = 8;
3118 bmi->bmiHeader.biCompression = BI_RGB;
3119 bmi->bmiHeader.biClrUsed = 236;
3120 for (i = 0; i < 236; i++)
3121 {
3122 colors[i].rgbRed = (i & 0x07) << 5;
3123 colors[i].rgbGreen = (i & 0x38) << 2;
3124 colors[i].rgbBlue = i & 0xc0;
3125 }
3126 dib = CreateDIBSection(0, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
3127 ok(dib != NULL, "ret NULL\n");
3128
3129 orig_bm = SelectObject(mem_dc, dib);
3130
3131 dst_format = "8 color";
3132 current_sha1 = sha1_graphics_8_color;
3133 draw_graphics(mem_dc, bmi, bits);
3134 draw_text(mem_dc, bmi, bits);
3135
3136 SelectObject(mem_dc, orig_bm);
3137 DeleteObject(dib);
3138
3139 /* 8 grayscale */
3140 trace("8 grayscale\n");
3141 bmi->bmiHeader.biBitCount = 8;
3142 bmi->bmiHeader.biCompression = BI_RGB;
3143 bmi->bmiHeader.biClrUsed = 256;
3144 for (i = 0; i < 256; i++) colors[i].rgbRed = colors[i].rgbGreen = colors[i].rgbBlue = i;
3145
3146 dib = CreateDIBSection(0, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
3147 ok(dib != NULL, "ret NULL\n");
3148
3149 orig_bm = SelectObject(mem_dc, dib);
3150
3151 dst_format = "8 grayscale";
3152 current_sha1 = sha1_graphics_8_grayscale;
3153 draw_graphics(mem_dc, bmi, bits);
3154 draw_text(mem_dc, bmi, bits);
3155
3156 SelectObject(mem_dc, orig_bm);
3157 DeleteObject(dib);
3158
3159 /* 8 */
3160 trace("8\n");
3161 bmi->bmiHeader.biBitCount = 8;
3162 bmi->bmiHeader.biCompression = BI_RGB;
3163 bmi->bmiHeader.biClrUsed = 5;
3164 colors[0].rgbRed = 0xff;
3165 colors[0].rgbGreen = 0xff;
3166 colors[0].rgbBlue = 0xff;
3167 colors[1].rgbRed = 0;
3168 colors[1].rgbGreen = 0;
3169 colors[1].rgbBlue = 0;
3170 colors[2].rgbRed = 0xff;
3171 colors[2].rgbGreen = 0;
3172 colors[2].rgbBlue = 0;
3173 colors[3].rgbRed = 0;
3174 colors[3].rgbGreen = 0xff;
3175 colors[3].rgbBlue = 0;
3176 colors[4].rgbRed = 0;
3177 colors[4].rgbGreen = 0;
3178 colors[4].rgbBlue = 0xff;
3179
3180 dib = CreateDIBSection(0, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
3181 ok(dib != NULL, "ret NULL\n");
3182
3183 orig_bm = SelectObject(mem_dc, dib);
3184
3185 dst_format = "8";
3186 current_sha1 = sha1_graphics_8;
3187 draw_graphics(mem_dc, bmi, bits);
3188 draw_text(mem_dc, bmi, bits);
3189
3190 SelectObject(mem_dc, orig_bm);
3191 DeleteObject(dib);
3192
3193 /* 4 */
3194 trace("4\n");
3195 bmi->bmiHeader.biBitCount = 4;
3196
3197 dib = CreateDIBSection(0, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
3198 ok(dib != NULL, "ret NULL\n");
3199
3200 orig_bm = SelectObject(mem_dc, dib);
3201 DeleteObject( SelectPalette( mem_dc, create_default_palette(4), FALSE ));
3202
3203 dst_format = "4";
3204 current_sha1 = sha1_graphics_4;
3205 draw_graphics(mem_dc, bmi, bits);
3206 draw_text(mem_dc, bmi, bits);
3207
3208 SelectObject(mem_dc, orig_bm);
3209 DeleteObject(dib);
3210
3211 /* 4 grayscale */
3212 trace("4 grayscale\n");
3213 bmi->bmiHeader.biClrUsed = 16;
3214 for (i = 0; i < 16; i++) colors[i].rgbRed = colors[i].rgbGreen = colors[i].rgbBlue = i * 17;
3215
3216 dib = CreateDIBSection(0, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
3217 ok(dib != NULL, "ret NULL\n");
3218
3219 orig_bm = SelectObject(mem_dc, dib);
3220
3221 dst_format = "4 grayscale";
3222 current_sha1 = sha1_graphics_4_grayscale;
3223 draw_graphics(mem_dc, bmi, bits);
3224 draw_text(mem_dc, bmi, bits);
3225
3226 SelectObject(mem_dc, orig_bm);
3227 DeleteObject(dib);
3228
3229 /* 1 */
3230 trace("1\n");
3231 bmi->bmiHeader.biBitCount = 1;
3232 bmi->bmiHeader.biClrUsed = 2;
3233
3234 colors[0].rgbRed = 0x00;
3235 colors[0].rgbGreen = 0x01;
3236 colors[0].rgbBlue = 0xff;
3237 colors[1].rgbRed = 0xff;
3238 colors[1].rgbGreen = 0x00;
3239 colors[1].rgbBlue = 0x00;
3240
3241 dib = CreateDIBSection(0, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
3242 ok(dib != NULL, "ret NULL\n");
3243
3244 orig_bm = SelectObject(mem_dc, dib);
3245 DeleteObject( SelectPalette( mem_dc, create_default_palette(1), FALSE ));
3246
3247 dst_format = "1";
3248 current_sha1 = sha1_graphics_1;
3249 draw_graphics(mem_dc, bmi, bits);
3250 draw_text(mem_dc, bmi, bits);
3251
3252 DeleteObject( SelectPalette( mem_dc, old_hpal, FALSE ));
3253 SelectObject(mem_dc, orig_bm);
3254 DeleteObject(dib);
3255
3256 DeleteDC(mem_dc);
3257 }
3258
3259 START_TEST(dib)
3260 {
3261 CryptAcquireContextW(&crypt_prov, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
3262
3263 test_simple_graphics();
3264
3265 CryptReleaseContext(crypt_prov, 0);
3266 }