2026{
2027
2028 static const BYTE bmp_bits_1[16 * 2] =
2029 {
2030 0xff,0xff, 0,0, 0xff,0xff, 0,0,
2031 0xff,0xff, 0,0, 0xff,0xff, 0,0,
2032 0xff,0xff, 0,0, 0xff,0xff, 0,0,
2033 0xff,0xff, 0,0, 0xff,0xff, 0,0
2034 };
2035
2036 static const BYTE dib_bits_1[16 * 4] =
2037 {
2038 0,0,0,0, 0xff,0xff,0,0, 0,0,0,0, 0xff,0xff,0,0,
2039 0,0,0,0, 0xff,0xff,0,0, 0,0,0,0, 0xff,0xff,0,0,
2040 0,0,0,0, 0xff,0xff,0,0, 0,0,0,0, 0xff,0xff,0,0,
2041 0,0,0,0, 0xff,0xff,0,0, 0,0,0,0, 0xff,0xff,0,0
2042 };
2043
2044 static const BYTE bmp_bits_24[16 * 16*3] =
2045 {
2046 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2047 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2048 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2049 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
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 };
2079
2080 static const BYTE dib_bits_24[16 * 16*3] =
2081 {
2082 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2083 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
2084 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
2085 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
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 };
2124
2126
2127
2129 ok(
hbmp != 0,
"CreateBitmap failed\n");
2130
2131 memset(&bm, 0xAA,
sizeof(bm));
2133 ok(
bytes ==
sizeof(bm),
"GetObject returned %d\n",
bytes);
2134 ok(bm.bmType == 0,
"wrong bmType %d\n", bm.bmType);
2135 ok(bm.bmWidth == 16,
"wrong bmWidth %d\n", bm.bmWidth);
2136 ok(bm.bmHeight == 16,
"wrong bmHeight %d\n", bm.bmHeight);
2137 ok(bm.bmWidthBytes == 2,
"wrong bmWidthBytes %d\n", bm.bmWidthBytes);
2138 ok(bm.bmPlanes == 1,
"wrong bmPlanes %u\n", bm.bmPlanes);
2139 ok(bm.bmBitsPixel == 1,
"wrong bmBitsPixel %d\n", bm.bmBitsPixel);
2140 ok(!bm.bmBits,
"wrong bmBits %p\n", bm.bmBits);
2141
2143 ok(
bytes ==
sizeof(bmp_bits_1),
"expected 16*2 got %d bytes\n",
bytes);
2145 ok(
bytes ==
sizeof(bmp_bits_1),
"expected 16*2 got %d bytes\n",
bytes);
2146 ok(!
memcmp(
buf, bmp_bits_1,
sizeof(bmp_bits_1)),
"bitmap bits don't match\n");
2147
2148
2149 memset(bi, 0,
sizeof(*bi));
2161 ok(
lines == 0,
"GetDIBits copied %d lines with hdc = 0\n",
lines);
2168
2172 ok(
lines == bm.bmHeight,
"GetDIBits copied %d lines of %d, error %u\n",
2176
2177
2178 ok(colors[0].rgbRed == 0 && colors[0].rgbGreen == 0 &&
2179 colors[0].rgbBlue == 0 && colors[0].rgbReserved == 0,
2180 "expected bmiColors[0] 0,0,0,0 - got %x %x %x %x\n",
2181 colors[0].rgbRed, colors[0].rgbGreen, colors[0].rgbBlue, colors[0].rgbReserved);
2182 ok(colors[1].rgbRed == 0xff && colors[1].rgbGreen == 0xff &&
2183 colors[1].rgbBlue == 0xff && colors[1].rgbReserved == 0,
2184 "expected bmiColors[0] 0xff,0xff,0xff,0 - got %x %x %x %x\n",
2185 colors[1].rgbRed, colors[1].rgbGreen, colors[1].rgbBlue, colors[1].rgbReserved);
2186 for (
i = 2;
i < 256;
i++)
2187 {
2188 ok(colors[
i].rgbRed == 0xAA && colors[
i].rgbGreen == 0xAA &&
2189 colors[
i].rgbBlue == 0xAA && colors[
i].rgbReserved == 0xAA,
2190 "expected bmiColors[%d] 0xAA,0xAA,0xAA,0xAA - got %x %x %x %x\n",
i,
2191 colors[
i].rgbRed, colors[
i].rgbGreen, colors[
i].rgbBlue, colors[
i].rgbReserved);
2192 }
2193
2194
2195 ok(!
memcmp(
buf, dib_bits_1,
sizeof(dib_bits_1)),
"DIB bits don't match\n");
2196
2197
2201 ok(((
WORD*)colors)[0] == 0,
"Color 0 is %d\n", ((
WORD*)colors)[0]);
2202 ok(((
WORD*)colors)[1] == 1,
"Color 1 is %d\n", ((
WORD*)colors)[1]);
2203 for (
i = 2;
i < 256;
i++)
2204 ok(((
WORD*)colors)[
i] == 0xAAAA,
"Color %d is %d\n",
i, ((
WORD*)colors)[1]);
2205
2206
2207 memset(bi, 0,
sizeof(*bi));
2220 ok(
lines == bm.bmHeight,
"GetDIBits copied %d lines of %d, error %u\n",
2224
2225
2226 for (
i = 0;
i < 256;
i++)
2227 {
2228 ok(colors[
i].rgbRed == 0xAA && colors[
i].rgbGreen == 0xAA &&
2229 colors[
i].rgbBlue == 0xAA && colors[
i].rgbReserved == 0xAA,
2230 "expected bmiColors[%d] 0xAA,0xAA,0xAA,0xAA - got %x %x %x %x\n",
i,
2231 colors[
i].rgbRed, colors[
i].rgbGreen, colors[
i].rgbBlue, colors[
i].rgbReserved);
2232 }
2233
2234
2235 ok(!
memcmp(
buf, dib_bits_24,
sizeof(dib_bits_24)),
"DIB bits don't match\n");
2237
2238
2240 ok(
hbmp != 0,
"CreateBitmap failed\n");
2244 ok(
lines == bm.bmHeight,
"SetDIBits copied %d lines of %d, error %u\n",
2246
2247 memset(&bm, 0xAA,
sizeof(bm));
2249 ok(
bytes ==
sizeof(bm),
"GetObject returned %d\n",
bytes);
2250 ok(bm.bmType == 0,
"wrong bmType %d\n", bm.bmType);
2251 ok(bm.bmWidth == 16,
"wrong bmWidth %d\n", bm.bmWidth);
2252 ok(bm.bmHeight == 16,
"wrong bmHeight %d\n", bm.bmHeight);
2253 ok(bm.bmWidthBytes ==
get_bitmap_stride(bm.bmWidth, bm.bmBitsPixel),
"wrong bmWidthBytes %d\n", bm.bmWidthBytes);
2256 ok(!bm.bmBits,
"wrong bmBits %p\n", bm.bmBits);
2257
2259 ok(
bytes == bm.bmWidthBytes * bm.bmHeight,
"expected %d got %d bytes\n", bm.bmWidthBytes * bm.bmHeight,
bytes);
2261 ok(
bytes == bm.bmWidthBytes * bm.bmHeight,
"expected %d got %d bytes\n",
2262 bm.bmWidthBytes * bm.bmHeight,
bytes);
2263
2264
2265 memset(bi, 0,
sizeof(*bi));
2278 ok(
lines == bm.bmHeight,
"GetDIBits copied %d lines of %d, error %u\n",
2282
2283
2284 ok(colors[0].rgbRed == 0 && colors[0].rgbGreen == 0 &&
2285 colors[0].rgbBlue == 0 && colors[0].rgbReserved == 0,
2286 "expected bmiColors[0] 0,0,0,0 - got %x %x %x %x\n",
2287 colors[0].rgbRed, colors[0].rgbGreen, colors[0].rgbBlue, colors[0].rgbReserved);
2288 ok(colors[1].rgbRed == 0xff && colors[1].rgbGreen == 0xff &&
2289 colors[1].rgbBlue == 0xff && colors[1].rgbReserved == 0,
2290 "expected bmiColors[0] 0xff,0xff,0xff,0 - got %x %x %x %x\n",
2291 colors[1].rgbRed, colors[1].rgbGreen, colors[1].rgbBlue, colors[1].rgbReserved);
2292 for (
i = 2;
i < 256;
i++)
2293 {
2294 ok(colors[
i].rgbRed == 0xAA && colors[
i].rgbGreen == 0xAA &&
2295 colors[
i].rgbBlue == 0xAA && colors[
i].rgbReserved == 0xAA,
2296 "expected bmiColors[%d] 0xAA,0xAA,0xAA,0xAA - got %x %x %x %x\n",
i,
2297 colors[
i].rgbRed, colors[
i].rgbGreen, colors[
i].rgbBlue, colors[
i].rgbReserved);
2298 }
2299
2300
2301 ok(!
memcmp(
buf, dib_bits_1,
sizeof(dib_bits_1)),
"DIB bits don't match\n");
2302
2303
2307 ok(((
WORD*)colors)[0] == 0,
"Color 0 is %d\n", ((
WORD*)colors)[0]);
2308 ok(((
WORD*)colors)[1] == 1,
"Color 1 is %d\n", ((
WORD*)colors)[1]);
2309 for (
i = 2;
i < 256;
i++)
2310 ok(((
WORD*)colors)[
i] == 0xAAAA,
"Color %d is %d\n",
i, ((
WORD*)colors)[
i]);
2311
2312
2313 memset(bi, 0,
sizeof(*bi));
2326 ok(
lines == bm.bmHeight,
"GetDIBits copied %d lines of %d, error %u\n",
2329
2331
2332 for (
i = 0;
i < 16;
i++)
2333 {
2336
2339
2344
2346 "expected bmiColors[%d] %x %x %x %x - got %x %x %x %x\n",
i,
2348 colors[
i].rgbRed, colors[
i].rgbGreen, colors[
i].rgbBlue, colors[
i].rgbReserved);
2349 }
2350
2351
2352 memset(bi, 0,
sizeof(*bi));
2365 ok(
lines == bm.bmHeight,
"GetDIBits copied %d lines of %d, error %u\n",
2368
2370
2371 for (
i = 0;
i < 256;
i++)
2372 {
2374
2375 if (i < 10 || i >= 246)
2376 {
2381 }
2382 else
2383 {
2384 expect.rgbRed = (
i & 0x07) << 5;
2385 expect.rgbGreen = (
i & 0x38) << 2;
2387 }
2389
2391 "expected bmiColors[%d] %x %x %x %x - got %x %x %x %x\n",
i,
2393 colors[
i].rgbRed, colors[
i].rgbGreen, colors[
i].rgbBlue, colors[
i].rgbReserved);
2394 }
2395
2396
2397 memset(bi, 0,
sizeof(*bi));
2410 ok(
lines == bm.bmHeight,
"GetDIBits copied %d lines of %d, error %u\n",
2414
2415
2416 for (
i = 0;
i < 256;
i++)
2417 {
2418 ok(colors[
i].rgbRed == 0xAA && colors[
i].rgbGreen == 0xAA &&
2419 colors[
i].rgbBlue == 0xAA && colors[
i].rgbReserved == 0xAA,
2420 "expected bmiColors[%d] 0xAA,0xAA,0xAA,0xAA - got %x %x %x %x\n",
i,
2421 colors[
i].rgbRed, colors[
i].rgbGreen, colors[
i].rgbBlue, colors[
i].rgbReserved);
2422 }
2423
2424
2425 ok(!
memcmp(
buf, dib_bits_24,
sizeof(dib_bits_24)),
"DIB bits don't match\n");
2427
2429}
static unsigned char bytes[4]
UINT WINAPI GetPaletteEntries(HPALETTE hpal, UINT iStartIndex, UINT cEntries, LPPALETTEENTRY ppe)