cursoricon.c:1039: Test failed: Overlaying Mask 0 on Color 00A0B0C0 with DrawIcon. Expected 00003163 (modern), or 00003868 (legacy). Got 000020B8 from line 1109 cursoricon.c:1039: Test failed: Overlaying Mask 1 on Color 00A0B0C0 with DrawIcon. Expected 00FFCE9C (modern), or 00FFD0A0 (legacy). Got 00FFE850 from line 1110 cursoricon.c:1039: Test failed: Overlaying Mask 0 on Color FFA0B0C0 with DrawIcon. Expected 00003163 (modern), or 00003868 (legacy). Got 000020B8 from line 1112 cursoricon.c:1039: Test failed: Overlaying Mask 1 on Color FFA0B0C0 with DrawIcon. Expected 00FFCE9C (modern), or 00FFD0A0 (legacy). Got 00FFE850 from line 1113 cursoricon.c:1039: Test failed: Overlaying Mask 0 on Color 80A0B0C0 with DrawIcon. Expected 00003163 (modern), or 00003868 (legacy). Got 000020B8 from line 1114 cursoricon.c:1039: Test failed: Overlaying Mask 1 on Color 80A0B0C0 with DrawIcon. Expected 00FFCE9C (modern), or 00FFD0A0 (legacy). Got 00FFE850 from line 1115 cursoricon.c:1171: Test failed: Overlaying Mask 0 on Color 00A0B0C0 with DrawIconEx flags 00000003. Expected 00003163 (modern) or 00003868 (legacy). Got 000020B8 from line 1256 cursoricon.c:1171: Test failed: Overlaying Mask 1 on Color 00A0B0C0 with DrawIconEx flags 00000003. Expected 00FFCE9C (modern) or 00FFD0A0 (legacy). Got 00FFE850 from line 1257 cursoricon.c:1171: Test failed: Overlaying Mask 0 on Color FFA0B0C0 with DrawIconEx flags 00000003. Expected 00003163 (modern) or 00003868 (legacy). Got 000020B8 from line 1259 cursoricon.c:1171: Test failed: Overlaying Mask 1 on Color FFA0B0C0 with DrawIconEx flags 00000003. Expected 00FFCE9C (modern) or 00FFD0A0 (legacy). Got 00FFE850 from line 1260 cursoricon.c:1171: Test failed: Overlaying Mask 0 on Color 80A0B0C0 with DrawIconEx flags 00000003. Expected 00003163 (modern) or 00003868 (legacy). Got 000020B8 from line 1261 cursoricon.c:1171: Test failed: Overlaying Mask 1 on Color 80A0B0C0 with DrawIconEx flags 00000003. Expected 00FFCE9C (modern) or 00FFD0A0 (legacy). Got 00FFE850 from line 1262
I've tracked down the problems with an NT4 VM. The problem comes when screen depth is set to less than 32-bit. Even though I'm drawing from an icon made from 32-bit bitmaps, and making DrawIcon draw to a 32-bit DIB section, old versions of windows don't respect that, and will truncate the color data. In 16-bit only the top 5 bits of a color channels emerge ungarbled, and in 8-bit and less, the colors go via the palette (logical palette?), which knocks them completely off.
The most obvious solution would be something like this as a color test:
const int screen_bpp = GetDeviceCaps(hdc, BITSPIXEL);
ok (result == modern_expected || /* Windows 2000 and up */ broken(result == legacy_expected) || /* Windows NT 4.0, 9X and below */ broken((result & 0x00F8F8F8) == (legacy_expected & 0x00F8F8F8) && screen_bpp == 16) || broken(result != legacy_expected && screen_bpp <= 8),
How acceptable would that be?
Joel Holdsworth joel@airwebreathe.org.uk writes:
The most obvious solution would be something like this as a color test:
const int screen_bpp = GetDeviceCaps(hdc, BITSPIXEL);
ok (result == modern_expected || /* Windows 2000 and up */ broken(result == legacy_expected) || /* Windows NT 4.0, 9X and below */ broken((result & 0x00F8F8F8) == (legacy_expected & 0x00F8F8F8) && screen_bpp == 16) || broken(result != legacy_expected && screen_bpp <= 8),
How acceptable would that be?
I don't think you need such a complex test, we don't really care about the exact reason why it's broken. Also I think you should be using the relaxed color matching everywhere, even for the working cases. We may want to round things differently in Wine too, and there's no reason to require exact pixel values, testing a few high bits should be enough to determine that blending has taken place.
I don't think you need such a complex test, we don't really care about the exact reason why it's broken.
Agreed. Fielding all the different deviations is getting quite convoluted. The modern/legacy stuff will need to remain because in some of these tests windows has made step changes - e.g. adding alpha support in 2000 and later.
Also I think you should be using the relaxed color matching everywhere, even for the working cases. We may want to round things differently in Wine too, and there's no reason to require exact pixel values, testing a few high bits should be enough to determine that blending has taken place.
I agree with you on this as well, exact pixel values are fragile, and 5-bit accuracy seems an acceptable margin of error. However, this still doesn't deal with the case in old windows, at 8-bit or less, the bitmap is rendered via the logical palette. In this case I found that even 2-bit accuracy sometimes wasn't sufficient - palette matching often caused channel variances of over 25%!
Taking this into account would yield:
ok ((result & 0x00F8F8F8) == (modern_expected & 0x00F8F8F8) || /* Windows 2000 and up */ broken((result & 0x00F8F8F8) == (legacy_expected & 0x00F8F8F8)) || /* Windows NT 4.0, 9X and below */ broken(GetDeviceCaps(hdc, BITSPIXEL) <= 8), ... /* Windows NT 4.0, 9X and below at 8bpp or less*/
What do you think?
Joel
Joel Holdsworth joel@airwebreathe.org.uk writes:
Taking this into account would yield:
ok ((result & 0x00F8F8F8) == (modern_expected & 0x00F8F8F8) || /* Windows 2000 and up */ broken((result & 0x00F8F8F8) == (legacy_expected & 0x00F8F8F8)) || /* Windows NT 4.0, 9X and below */ broken(GetDeviceCaps(hdc, BITSPIXEL) <= 8), ... /* Windows NT 4.0, 9X and below at 8bpp or less*/
What do you think?
You can just skip the whole test on 8-bit displays. And please add some sort of color_match() function for the comparison, don't hardcode 0x00F8F8F8 all over the place.