Commit b4d58fe5 authored by Andrew Nguyen's avatar Andrew Nguyen Committed by Alexandre Julliard

winex11.drv: Report a non-zero COLORRES capability value.

parent 5f7bbb2a
...@@ -556,6 +556,45 @@ static void test_boundsrect_invalid(void) ...@@ -556,6 +556,45 @@ static void test_boundsrect_invalid(void)
DeleteDC(hdc); 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) START_TEST(dc)
{ {
test_savedc(); test_savedc();
...@@ -565,4 +604,5 @@ START_TEST(dc) ...@@ -565,4 +604,5 @@ START_TEST(dc)
test_DC_bitmap(); test_DC_bitmap();
test_DeleteDC(); test_DeleteDC();
test_boundsrect_invalid(); test_boundsrect_invalid();
test_desktop_colorres();
} }
...@@ -235,6 +235,15 @@ INT CDECL X11DRV_GetDeviceCaps( X11DRV_PDEVICE *physDev, INT cap ) ...@@ -235,6 +235,15 @@ INT CDECL X11DRV_GetDeviceCaps( X11DRV_PDEVICE *physDev, INT cap )
return text_caps; return text_caps;
case CLIPCAPS: case CLIPCAPS:
return CP_REGION; 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: case RASTERCAPS:
return (RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 | RC_DI_BITMAP | return (RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 | RC_DI_BITMAP |
RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS | RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS |
...@@ -258,7 +267,6 @@ INT CDECL X11DRV_GetDeviceCaps( X11DRV_PDEVICE *physDev, INT cap ) ...@@ -258,7 +267,6 @@ INT CDECL X11DRV_GetDeviceCaps( X11DRV_PDEVICE *physDev, INT cap )
case SIZEPALETTE: case SIZEPALETTE:
return palette_size; return palette_size;
case NUMRESERVED: case NUMRESERVED:
case COLORRES:
case PHYSICALWIDTH: case PHYSICALWIDTH:
case PHYSICALHEIGHT: case PHYSICALHEIGHT:
case PHYSICALOFFSETX: case PHYSICALOFFSETX:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment