2030{
2031
2032 static const BYTE bmp_bits_1[16 * 2] =
2033 {
2034 0xff,0xff, 0,0, 0xff,0xff, 0,0,
2035 0xff,0xff, 0,0, 0xff,0xff, 0,0,
2036 0xff,0xff, 0,0, 0xff,0xff, 0,0,
2037 0xff,0xff, 0,0, 0xff,0xff, 0,0
2038 };
2039
2040 static const BYTE dib_bits_1[16 * 4] =
2041 {
2042 0,0,0,0, 0xff,0xff,0,0, 0,0,0,0, 0xff,0xff,0,0,
2043 0,0,0,0, 0xff,0xff,0,0, 0,0,0,0, 0xff,0xff,0,0,
2044 0,0,0,0, 0xff,0xff,0,0, 0,0,0,0, 0xff,0xff,0,0,
2045 0,0,0,0, 0xff,0xff,0,0, 0,0,0,0, 0xff,0xff,0,0
2046 };
2047
2048 static const BYTE bmp_bits_24[16 * 16*3] =
2049 {
2050 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2051 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2052 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2053 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2054 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2055 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2056 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2057 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2058 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2059 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2060 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2061 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2062 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2063 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2064 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2065 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2066 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2067 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2068 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2069 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2070 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2071 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2072 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2073 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2074 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2075 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2076 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2077 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2078 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2079 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2080 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2081 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2082 };
2083
2084 static const BYTE dib_bits_24[16 * 16*3] =
2085 {
2086 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2087 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2088 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2089 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2090 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2091 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2092 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2093 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2094 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2095 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2096 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2097 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2098 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2099 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2100 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2101 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2102 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2103 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2104 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2105 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2106 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2107 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2108 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2109 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2110 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2111 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2112 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2113 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2114 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2115 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2116 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2117 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
2118 };
2128
2130
2131
2133 ok(
hbmp != 0,
"CreateBitmap failed\n");
2134
2135 memset(&bm, 0xAA,
sizeof(bm));
2137 ok(
bytes ==
sizeof(bm),
"GetObject returned %d\n",
bytes);
2145
2147 ok(
bytes ==
sizeof(bmp_bits_1),
"expected 16*2 got %d bytes\n",
bytes);
2149 ok(
bytes ==
sizeof(bmp_bits_1),
"expected 16*2 got %d bytes\n",
bytes);
2150 ok(!
memcmp(
buf, bmp_bits_1,
sizeof(bmp_bits_1)),
"bitmap bits don't match\n");
2151
2152
2153 memset(bi, 0,
sizeof(*bi));
2165 ok(
lines == 0,
"GetDIBits copied %d lines with hdc = 0\n",
lines);
2172
2176 ok(
lines == bm.
bmHeight,
"GetDIBits copied %d lines of %d, error %lu\n",
2180
2181
2182 ok(colors[0].rgbRed == 0 && colors[0].rgbGreen == 0 &&
2183 colors[0].rgbBlue == 0 && colors[0].rgbReserved == 0,
2184 "expected bmiColors[0] 0,0,0,0 - got %x %x %x %x\n",
2185 colors[0].rgbRed, colors[0].rgbGreen, colors[0].rgbBlue, colors[0].rgbReserved);
2186 ok(colors[1].rgbRed == 0xff && colors[1].rgbGreen == 0xff &&
2187 colors[1].rgbBlue == 0xff && colors[1].rgbReserved == 0,
2188 "expected bmiColors[0] 0xff,0xff,0xff,0 - got %x %x %x %x\n",
2189 colors[1].rgbRed, colors[1].rgbGreen, colors[1].rgbBlue, colors[1].rgbReserved);
2190 for (
i = 2;
i < 256;
i++)
2191 {
2192 ok(colors[
i].rgbRed == 0xAA && colors[
i].rgbGreen == 0xAA &&
2193 colors[
i].rgbBlue == 0xAA && colors[
i].rgbReserved == 0xAA,
2194 "expected bmiColors[%d] 0xAA,0xAA,0xAA,0xAA - got %x %x %x %x\n",
i,
2195 colors[
i].rgbRed, colors[
i].rgbGreen, colors[
i].rgbBlue, colors[
i].rgbReserved);
2196 }
2197
2198
2199 ok(!
memcmp(
buf, dib_bits_1,
sizeof(dib_bits_1)),
"DIB bits don't match\n");
2200
2201
2205 ok(((
WORD*)colors)[0] == 0,
"Color 0 is %d\n", ((
WORD*)colors)[0]);
2206 ok(((
WORD*)colors)[1] == 1,
"Color 1 is %d\n", ((
WORD*)colors)[1]);
2207 for (
i = 2;
i < 256;
i++)
2208 ok(((
WORD*)colors)[
i] == 0xAAAA,
"Color %d is %d\n",
i, ((
WORD*)colors)[1]);
2209
2210
2211 memset(bi, 0,
sizeof(*bi));
2224 ok(
lines == bm.
bmHeight,
"GetDIBits copied %d lines of %d, error %lu\n",
2228
2229
2230 for (
i = 0;
i < 256;
i++)
2231 {
2232 ok(colors[
i].rgbRed == 0xAA && colors[
i].rgbGreen == 0xAA &&
2233 colors[
i].rgbBlue == 0xAA && colors[
i].rgbReserved == 0xAA,
2234 "expected bmiColors[%d] 0xAA,0xAA,0xAA,0xAA - got %x %x %x %x\n",
i,
2235 colors[
i].rgbRed, colors[
i].rgbGreen, colors[
i].rgbBlue, colors[
i].rgbReserved);
2236 }
2237
2238
2239 ok(!
memcmp(
buf, dib_bits_24,
sizeof(dib_bits_24)),
"DIB bits don't match\n");
2241
2242
2244 ok(
hbmp != 0,
"CreateBitmap failed\n");
2248 ok(
lines == bm.
bmHeight,
"SetDIBits copied %d lines of %d, error %lu\n",
2250
2251 memset(&bm, 0xAA,
sizeof(bm));
2253 ok(
bytes ==
sizeof(bm),
"GetObject returned %d\n",
bytes);
2261
2267
2268
2269 memset(bi, 0,
sizeof(*bi));
2282 ok(
lines == bm.
bmHeight,
"GetDIBits copied %d lines of %d, error %lu\n",
2286
2287
2288 ok(colors[0].rgbRed == 0 && colors[0].rgbGreen == 0 &&
2289 colors[0].rgbBlue == 0 && colors[0].rgbReserved == 0,
2290 "expected bmiColors[0] 0,0,0,0 - got %x %x %x %x\n",
2291 colors[0].rgbRed, colors[0].rgbGreen, colors[0].rgbBlue, colors[0].rgbReserved);
2292 ok(colors[1].rgbRed == 0xff && colors[1].rgbGreen == 0xff &&
2293 colors[1].rgbBlue == 0xff && colors[1].rgbReserved == 0,
2294 "expected bmiColors[0] 0xff,0xff,0xff,0 - got %x %x %x %x\n",
2295 colors[1].rgbRed, colors[1].rgbGreen, colors[1].rgbBlue, colors[1].rgbReserved);
2296 for (
i = 2;
i < 256;
i++)
2297 {
2298 ok(colors[
i].rgbRed == 0xAA && colors[
i].rgbGreen == 0xAA &&
2299 colors[
i].rgbBlue == 0xAA && colors[
i].rgbReserved == 0xAA,
2300 "expected bmiColors[%d] 0xAA,0xAA,0xAA,0xAA - got %x %x %x %x\n",
i,
2301 colors[
i].rgbRed, colors[
i].rgbGreen, colors[
i].rgbBlue, colors[
i].rgbReserved);
2302 }
2303
2304
2305 ok(!
memcmp(
buf, dib_bits_1,
sizeof(dib_bits_1)),
"DIB bits don't match\n");
2306
2307
2311 ok(((
WORD*)colors)[0] == 0,
"Color 0 is %d\n", ((
WORD*)colors)[0]);
2312 ok(((
WORD*)colors)[1] == 1,
"Color 1 is %d\n", ((
WORD*)colors)[1]);
2313 for (
i = 2;
i < 256;
i++)
2314 ok(((
WORD*)colors)[
i] == 0xAAAA,
"Color %d is %d\n",
i, ((
WORD*)colors)[
i]);
2315
2316
2317 memset(bi, 0,
sizeof(*bi));
2330 ok(
lines == bm.
bmHeight,
"GetDIBits copied %d lines of %d, error %lu\n",
2333
2335
2336 for (
i = 0;
i < 16;
i++)
2337 {
2340
2343
2348
2350 "expected bmiColors[%d] %x %x %x %x - got %x %x %x %x\n",
i,
2352 colors[
i].rgbRed, colors[
i].rgbGreen, colors[
i].rgbBlue, colors[
i].rgbReserved);
2353 }
2354
2355
2356 memset(bi, 0,
sizeof(*bi));
2369 ok(
lines == bm.
bmHeight,
"GetDIBits copied %d lines of %d, error %lu\n",
2372
2374
2375 for (
i = 0;
i < 256;
i++)
2376 {
2378
2379 if (i < 10 || i >= 246)
2380 {
2385 }
2386 else
2387 {
2388 expect.rgbRed = (
i & 0x07) << 5;
2389 expect.rgbGreen = (
i & 0x38) << 2;
2391 }
2393
2395 "expected bmiColors[%d] %x %x %x %x - got %x %x %x %x\n",
i,
2397 colors[
i].rgbRed, colors[
i].rgbGreen, colors[
i].rgbBlue, colors[
i].rgbReserved);
2398 }
2399
2400
2401 memset(bi, 0,
sizeof(*bi));
2414 ok(
lines == bm.
bmHeight,
"GetDIBits copied %d lines of %d, error %lu\n",
2418
2419
2420 for (
i = 0;
i < 256;
i++)
2421 {
2422 ok(colors[
i].rgbRed == 0xAA && colors[
i].rgbGreen == 0xAA &&
2423 colors[
i].rgbBlue == 0xAA && colors[
i].rgbReserved == 0xAA,
2424 "expected bmiColors[%d] 0xAA,0xAA,0xAA,0xAA - got %x %x %x %x\n",
i,
2425 colors[
i].rgbRed, colors[
i].rgbGreen, colors[
i].rgbBlue, colors[
i].rgbReserved);
2426 }
2427
2428
2429 ok(!
memcmp(
buf, dib_bits_24,
sizeof(dib_bits_24)),
"DIB bits don't match\n");
2431
2433}
static unsigned char bytes[4]
UINT WINAPI GetPaletteEntries(HPALETTE hpal, UINT iStartIndex, UINT cEntries, LPPALETTEENTRY ppe)