Ken Thomases : winemac: Fall back to the null driver for common device capabilities.
Alexandre Julliard
julliard at winehq.org
Mon May 22 15:54:03 CDT 2017
Module: wine
Branch: master
Commit: 416180a85684be1ec3bb1f0b65230ceab15e6894
URL: http://source.winehq.org/git/wine.git/?a=commit;h=416180a85684be1ec3bb1f0b65230ceab15e6894
Author: Ken Thomases <ken at codeweavers.com>
Date: Sun May 21 12:20:04 2017 -0500
winemac: Fall back to the null driver for common device capabilities.
Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winemac.drv/gdi.c | 171 +------------------------------------------------
1 file changed, 3 insertions(+), 168 deletions(-)
diff --git a/dlls/winemac.drv/gdi.c b/dlls/winemac.drv/gdi.c
index a0f4ee9..896016b 100644
--- a/dlls/winemac.drv/gdi.c
+++ b/dlls/winemac.drv/gdi.c
@@ -40,8 +40,6 @@ static inline MACDRV_PDEVICE *get_macdrv_dev(PHYSDEV dev)
/* a few dynamic device caps */
static CGRect desktop_rect; /* virtual desktop rectangle */
-static int log_pixels_x; /* pixels per logical inch in x direction */
-static int log_pixels_y; /* pixels per logical inch in y direction */
static int horz_size; /* horz. size of screen in millimeters */
static int vert_size; /* vert. size of screen in millimeters */
static int horz_res; /* width in pixels of screen */
@@ -63,52 +61,8 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
static CRITICAL_SECTION device_data_section = { &critsect_debug, -1, 0, 0, 0, 0 };
-static const WCHAR dpi_key_name[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\0'};
-static const WCHAR def_dpi_key_name[] = {'S','o','f','t','w','a','r','e','\\','F','o','n','t','s','\0'};
-static const WCHAR dpi_value_name[] = {'L','o','g','P','i','x','e','l','s','\0'};
-
static const struct gdi_dc_funcs macdrv_funcs;
-/******************************************************************************
- * get_reg_dword
- *
- * Read a DWORD value from the registry
- */
-static BOOL get_reg_dword(HKEY base, const WCHAR *key_name, const WCHAR *value_name, DWORD *value)
-{
- HKEY key;
- DWORD type, data, size = sizeof(data);
- BOOL ret = FALSE;
-
- if (RegOpenKeyW(base, key_name, &key) == ERROR_SUCCESS)
- {
- if (RegQueryValueExW(key, value_name, NULL, &type, (void *)&data, &size) == ERROR_SUCCESS &&
- type == REG_DWORD)
- {
- *value = data;
- ret = TRUE;
- }
- RegCloseKey(key);
- }
- return ret;
-}
-
-/******************************************************************************
- * get_dpi
- *
- * get the dpi from the registry
- */
-static DWORD get_dpi(void)
-{
- DWORD dpi;
-
- if (get_reg_dword(HKEY_CURRENT_USER, dpi_key_name, dpi_value_name, &dpi))
- return dpi;
- if (get_reg_dword(HKEY_CURRENT_CONFIG, def_dpi_key_name, dpi_value_name, &dpi))
- return dpi;
- return 0;
-}
-
/***********************************************************************
* compute_desktop_rect
*/
@@ -172,24 +126,6 @@ static void device_init(void)
check_retina_status();
/* Initialize device caps */
- log_pixels_x = log_pixels_y = get_dpi();
- if (!log_pixels_x)
- {
- size_t width = CGDisplayPixelsWide(mainDisplay);
- size_t height = CGDisplayPixelsHigh(mainDisplay);
-
- if (retina_on)
- {
- /* Although CGDisplayPixelsWide/High() claim to report in pixels, they
- actually report in points. */
- width *= 2;
- height *= 2;
- }
-
- log_pixels_x = MulDiv(width, 254, size_mm.width * 10);
- log_pixels_y = MulDiv(height, 254, size_mm.height * 10);
- }
-
horz_size = size_mm.width;
vert_size = size_mm.height;
@@ -319,12 +255,6 @@ static INT macdrv_GetDeviceCaps(PHYSDEV dev, INT cap)
switch(cap)
{
- case DRIVERVERSION:
- ret = 0x300;
- break;
- case TECHNOLOGY:
- ret = DT_RASDISPLAY;
- break;
case HORZSIZE:
ret = horz_size;
break;
@@ -346,109 +276,14 @@ static INT macdrv_GetDeviceCaps(PHYSDEV dev, INT cap)
case BITSPIXEL:
ret = bits_per_pixel;
break;
- case PLANES:
- ret = 1;
- break;
- case NUMBRUSHES:
- ret = -1;
- break;
- case NUMPENS:
- ret = -1;
- break;
- case NUMMARKERS:
- ret = 0;
- break;
- case NUMFONTS:
- ret = 0;
- break;
- case NUMCOLORS:
- /* MSDN: Number of entries in the device's color table, if the device has
- * a color depth of no more than 8 bits per pixel.For devices with greater
- * color depths, -1 is returned. */
- ret = (bits_per_pixel > 8) ? -1 : (1 << bits_per_pixel);
- break;
- case PDEVICESIZE:
- ret = sizeof(MACDRV_PDEVICE);
- break;
- case CURVECAPS:
- ret = (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
- CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT);
- break;
- case LINECAPS:
- ret = (LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
- LC_STYLED | LC_WIDESTYLED | LC_INTERIORS);
- break;
- case POLYGONALCAPS:
- ret = (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON | PC_SCANLINE |
- PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS);
- break;
- case TEXTCAPS:
- ret = (TC_OP_CHARACTER | TC_OP_STROKE | TC_CP_STROKE |
- TC_CR_ANY | TC_SF_X_YINDEP | TC_SA_DOUBLE | TC_SA_INTEGER |
- TC_SA_CONTIN | TC_UA_ABLE | TC_SO_ABLE | TC_RA_ABLE | TC_VA_ABLE);
- break;
- case CLIPCAPS:
- ret = CP_REGION;
- break;
- case COLORRES:
- /* The observed correspondence between BITSPIXEL and COLORRES is:
- * BITSPIXEL: 8 -> COLORRES: 18
- * BITSPIXEL: 16 -> COLORRES: 16
- * BITSPIXEL: 24 -> COLORRES: 24
- * (note that bits_per_pixel is never 24)
- * BITSPIXEL: 32 -> COLORRES: 24 */
- ret = (bits_per_pixel <= 8) ? 18 : (bits_per_pixel == 32) ? 24 : bits_per_pixel;
- break;
- case RASTERCAPS:
- ret = (RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 | RC_DI_BITMAP |
- RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS |
- (bits_per_pixel <= 8 ? RC_PALETTE : 0));
- break;
- case SHADEBLENDCAPS:
- ret = (SB_GRAD_RECT | SB_GRAD_TRI | SB_CONST_ALPHA | SB_PIXEL_ALPHA);
- break;
- case ASPECTX:
- case ASPECTY:
- ret = 36;
- break;
- case ASPECTXY:
- ret = 51;
- break;
- case LOGPIXELSX:
- ret = log_pixels_x;
- break;
- case LOGPIXELSY:
- ret = log_pixels_y;
- break;
- case CAPS1:
- FIXME("(%p): CAPS1 is unimplemented, will return 0\n", dev->hdc);
- /* please see wingdi.h for the possible bit-flag values that need
- to be returned. */
- ret = 0;
- break;
- case SIZEPALETTE:
- ret = bits_per_pixel <= 8 ? 1 << bits_per_pixel : 0;
- break;
- case NUMRESERVED:
- case PHYSICALWIDTH:
- case PHYSICALHEIGHT:
- case PHYSICALOFFSETX:
- case PHYSICALOFFSETY:
- case SCALINGFACTORX:
- case SCALINGFACTORY:
- case VREFRESH:
- case BLTALIGNMENT:
- ret = 0;
- break;
default:
- FIXME("(%p): unsupported capability %d, will return 0\n", dev->hdc, cap);
- ret = 0;
- goto done;
+ LeaveCriticalSection(&device_data_section);
+ dev = GET_NEXT_PHYSDEV( dev, pGetDeviceCaps );
+ return dev->funcs->pGetDeviceCaps( dev, cap );
}
TRACE("cap %d -> %d\n", cap, ret);
-done:
LeaveCriticalSection(&device_data_section);
return ret;
}
More information about the wine-cvs
mailing list