Andrew Nguyen : winex11.drv: Report a non-zero COLORRES capability value.
Alexandre Julliard
julliard at winehq.org
Tue Jun 15 13:46:50 CDT 2010
Module: wine
Branch: master
Commit: b4d58fe58faf960f6914a91b4f9ca0052f90689a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b4d58fe58faf960f6914a91b4f9ca0052f90689a
Author: Andrew Nguyen <anguyen at codeweavers.com>
Date: Tue Jun 15 00:26:20 2010 -0500
winex11.drv: Report a non-zero COLORRES capability value.
---
dlls/gdi32/tests/dc.c | 40 ++++++++++++++++++++++++++++++++++++++++
dlls/winex11.drv/init.c | 10 +++++++++-
2 files changed, 49 insertions(+), 1 deletions(-)
diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c
index b081376..5d56caa 100644
--- a/dlls/gdi32/tests/dc.c
+++ b/dlls/gdi32/tests/dc.c
@@ -556,6 +556,45 @@ static void test_boundsrect_invalid(void)
DeleteDC(hdc);
}
+static void test_desktop_colorres(void)
+{
+ HDC hdc = GetDC(NULL);
+ int bitspixel, colorres;
+
+ bitspixel = GetDeviceCaps(hdc, BITSPIXEL);
+ ok(bitspixel != 0, "Expected to get valid BITSPIXEL capability value\n");
+
+ colorres = GetDeviceCaps(hdc, COLORRES);
+ ok(colorres != 0 ||
+ broken(colorres == 0), /* Win9x */
+ "Expected to get valid COLORRES capability value\n");
+
+ if (colorres)
+ {
+ switch (bitspixel)
+ {
+ case 8:
+ ok(colorres == 18,
+ "Expected COLORRES to be 18, got %d\n", colorres);
+ break;
+ case 16:
+ ok(colorres == 16,
+ "Expected COLORRES to be 16, got %d\n", colorres);
+ break;
+ case 24:
+ case 32:
+ ok(colorres == 24,
+ "Expected COLORRES to be 24, got %d\n", bitspixel);
+ break;
+ default:
+ ok(0, "Got unknown BITSPIXEL %d with COLORRES %d\n", bitspixel, colorres);
+ break;
+ }
+ }
+
+ DeleteDC(hdc);
+}
+
START_TEST(dc)
{
test_savedc();
@@ -565,4 +604,5 @@ START_TEST(dc)
test_DC_bitmap();
test_DeleteDC();
test_boundsrect_invalid();
+ test_desktop_colorres();
}
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c
index ba6cc51..1462b5e 100644
--- a/dlls/winex11.drv/init.c
+++ b/dlls/winex11.drv/init.c
@@ -235,6 +235,15 @@ INT CDECL X11DRV_GetDeviceCaps( X11DRV_PDEVICE *physDev, INT cap )
return text_caps;
case CLIPCAPS:
return CP_REGION;
+ case COLORRES:
+ /* The observed correspondence between BITSPIXEL and COLORRES is:
+ * BITSPIXEL: 8 -> COLORRES: 18
+ * BITSPIXEL: 16 -> COLORRES: 16
+ * BITSPIXEL: 24 -> COLORRES: 24
+ * (note that depth_to_bpp never chooses a bpp of 24)
+ * BITSPIXEL: 32 -> COLORRES: 24 */
+ return (screen_bpp <= 8) ? 18 :
+ (screen_bpp == 32) ? 24 : screen_bpp;
case RASTERCAPS:
return (RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 | RC_DI_BITMAP |
RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS |
@@ -258,7 +267,6 @@ INT CDECL X11DRV_GetDeviceCaps( X11DRV_PDEVICE *physDev, INT cap )
case SIZEPALETTE:
return palette_size;
case NUMRESERVED:
- case COLORRES:
case PHYSICALWIDTH:
case PHYSICALHEIGHT:
case PHYSICALOFFSETX:
More information about the wine-cvs
mailing list