Commit 6403e881 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use GetICMProfile driver entry point for EnumICMProfilesW.

When display ICM is not explicitly configured on Windows, GetICMProfile returns the default profile, but EnumICMProfiles does not enumerate anything. For non-default configuration, EnumICMProfiles returns configured profiles. Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarHuw Davies <huw@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent bf4cdfad
......@@ -642,7 +642,6 @@ const struct gdi_dc_funcs dib_driver =
NULL, /* pEndPage */
NULL, /* pEndPath */
NULL, /* pEnumFonts */
NULL, /* pEnumICMProfiles */
NULL, /* pExtDeviceMode */
NULL, /* pExtEscape */
dibdrv_ExtFloodFill, /* pExtFloodFill */
......@@ -1208,7 +1207,6 @@ static const struct gdi_dc_funcs window_driver =
NULL, /* pEndPage */
NULL, /* pEndPath */
NULL, /* pEnumFonts */
NULL, /* pEnumICMProfiles */
NULL, /* pExtDeviceMode */
NULL, /* pExtEscape */
windrv_ExtFloodFill, /* pExtFloodFill */
......
......@@ -337,11 +337,6 @@ static BOOL CDECL nulldrv_EnumFonts( PHYSDEV dev, LOGFONTW *logfont, FONTENUMPRO
return TRUE;
}
static INT CDECL nulldrv_EnumICMProfiles( PHYSDEV dev, ICMENUMPROCW func, LPARAM lparam )
{
return -1;
}
static INT CDECL nulldrv_ExtDeviceMode( LPSTR buffer, HWND hwnd, DEVMODEA *output, LPSTR device,
LPSTR port, DEVMODEA *input, LPSTR profile, DWORD mode )
{
......@@ -583,7 +578,7 @@ static DWORD CDECL nulldrv_GetGlyphOutline( PHYSDEV dev, UINT ch, UINT format, L
return GDI_ERROR;
}
static BOOL CDECL nulldrv_GetICMProfile( PHYSDEV dev, LPDWORD size, LPWSTR filename )
static BOOL CDECL nulldrv_GetICMProfile( PHYSDEV dev, BOOL allow_default, LPDWORD size, LPWSTR filename )
{
return FALSE;
}
......@@ -828,7 +823,6 @@ const struct gdi_dc_funcs null_driver =
nulldrv_EndPage, /* pEndPage */
nulldrv_EndPath, /* pEndPath */
nulldrv_EnumFonts, /* pEnumFonts */
nulldrv_EnumICMProfiles, /* pEnumICMProfiles */
nulldrv_ExtDeviceMode, /* pExtDeviceMode */
nulldrv_ExtEscape, /* pExtEscape */
nulldrv_ExtFloodFill, /* pExtFloodFill */
......
......@@ -467,7 +467,6 @@ static const struct gdi_dc_funcs emfdrv_driver =
NULL, /* pEndPage */
NULL, /* pEndPath */
NULL, /* pEnumFonts */
NULL, /* pEnumICMProfiles */
NULL, /* pExtDeviceMode */
NULL, /* pExtEscape */
NULL, /* pExtFloodFill */
......
......@@ -3854,7 +3854,6 @@ const struct gdi_dc_funcs font_driver =
NULL, /* pEndPage */
NULL, /* pEndPath */
font_EnumFonts, /* pEnumFonts */
NULL, /* pEnumICMProfiles */
NULL, /* pExtDeviceMode */
NULL, /* pExtEscape */
NULL, /* pExtFloodFill */
......
......@@ -76,19 +76,22 @@ INT WINAPI EnumICMProfilesA(HDC hdc, ICMENUMPROCA func, LPARAM lparam)
*/
INT WINAPI EnumICMProfilesW(HDC hdc, ICMENUMPROCW func, LPARAM lparam)
{
WCHAR profile[MAX_PATH];
DWORD size = ARRAYSIZE(profile);
DC *dc;
INT ret = -1;
BOOL ret = FALSE;
TRACE("%p, %p, 0x%08lx\n", hdc, func, lparam);
TRACE( "%p, %p, 0x%08lx\n", hdc, func, lparam );
if (!func) return -1;
if ((dc = get_dc_ptr(hdc)))
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pEnumICMProfiles );
ret = physdev->funcs->pEnumICMProfiles( physdev, func, lparam );
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetICMProfile );
ret = physdev->funcs->pGetICMProfile( physdev, FALSE, &size, profile );
release_dc_ptr(dc);
}
return ret;
/* FIXME: support multiple profiles */
return ret ? func( profile, lparam ) : -1;
}
/**********************************************************************
......@@ -149,7 +152,7 @@ BOOL WINAPI GetICMProfileW(HDC hdc, LPDWORD size, LPWSTR filename)
if (dc)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetICMProfile );
ret = physdev->funcs->pGetICMProfile( physdev, size, filename );
ret = physdev->funcs->pGetICMProfile( physdev, TRUE, size, filename );
release_dc_ptr(dc);
}
return ret;
......
......@@ -2046,7 +2046,6 @@ const struct gdi_dc_funcs path_driver =
NULL, /* pEndPage */
pathdrv_EndPath, /* pEndPath */
NULL, /* pEnumFonts */
NULL, /* pEnumICMProfiles */
NULL, /* pExtDeviceMode */
NULL, /* pExtEscape */
NULL, /* pExtFloodFill */
......
......@@ -303,7 +303,6 @@ static const struct gdi_dc_funcs android_drv_funcs =
NULL, /* pEndPage */
NULL, /* pEndPath */
NULL, /* pEnumFonts */
NULL, /* pEnumICMProfiles */
NULL, /* pExtDeviceMode */
NULL, /* pExtEscape */
NULL, /* pExtFloodFill */
......
......@@ -283,7 +283,6 @@ static const struct gdi_dc_funcs macdrv_funcs =
NULL, /* pEndPage */
NULL, /* pEndPath */
NULL, /* pEnumFonts */
NULL, /* pEnumICMProfiles */
NULL, /* pExtDeviceMode */
NULL, /* pExtEscape */
NULL, /* pExtFloodFill */
......
......@@ -797,7 +797,6 @@ static const struct gdi_dc_funcs psdrv_funcs =
PSDRV_EndPage, /* pEndPage */
NULL, /* pEndPath */
PSDRV_EnumFonts, /* pEnumFonts */
NULL, /* pEnumICMProfiles */
PSDRV_ExtDeviceMode, /* pExtDeviceMode */
PSDRV_ExtEscape, /* pExtEscape */
NULL, /* pExtFloodFill */
......
......@@ -1639,7 +1639,7 @@ static const WCHAR color_path[] =
/***********************************************************************
* GetICMProfile (X11DRV.@)
*/
BOOL CDECL X11DRV_GetICMProfile( PHYSDEV dev, LPDWORD size, LPWSTR filename )
BOOL CDECL X11DRV_GetICMProfile( PHYSDEV dev, BOOL allow_default, LPDWORD size, LPWSTR filename )
{
static const WCHAR srgb[] =
{'s','R','G','B',' ','C','o','l','o','r',' ','S','p','a','c','e',' ',
......@@ -1691,6 +1691,7 @@ BOOL CDECL X11DRV_GetICMProfile( PHYSDEV dev, LPDWORD size, LPWSTR filename )
}
HeapFree( GetProcessHeap(), 0, buffer );
}
else if (!allow_default) return FALSE;
else strcatW( fullname, srgb );
required = strlenW( fullname ) + 1;
......@@ -1709,58 +1710,3 @@ BOOL CDECL X11DRV_GetICMProfile( PHYSDEV dev, LPDWORD size, LPWSTR filename )
*size = required;
return TRUE;
}
/***********************************************************************
* EnumICMProfiles (X11DRV.@)
*/
INT CDECL X11DRV_EnumICMProfiles( PHYSDEV dev, ICMENUMPROCW proc, LPARAM lparam )
{
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
HKEY hkey;
DWORD len_sysdir, len_path, len, index = 0;
WCHAR sysdir[MAX_PATH], *profile;
LONG res;
INT ret;
TRACE("%p, %p, %ld\n", physDev, proc, lparam);
if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, mntr_key, 0, KEY_ALL_ACCESS, &hkey ))
return -1;
len_sysdir = GetSystemDirectoryW( sysdir, MAX_PATH );
len_path = len_sysdir + ARRAY_SIZE( color_path ) - 1;
len = 64;
for (;;)
{
if (!(profile = HeapAlloc( GetProcessHeap(), 0, (len_path + len) * sizeof(WCHAR) )))
{
RegCloseKey( hkey );
return -1;
}
res = RegEnumValueW( hkey, index, profile + len_path, &len, NULL, NULL, NULL, NULL );
while (res == ERROR_MORE_DATA)
{
len *= 2;
HeapFree( GetProcessHeap(), 0, profile );
if (!(profile = HeapAlloc( GetProcessHeap(), 0, (len_path + len) * sizeof(WCHAR) )))
{
RegCloseKey( hkey );
return -1;
}
res = RegEnumValueW( hkey, index, profile + len_path, &len, NULL, NULL, NULL, NULL );
}
if (res != ERROR_SUCCESS)
{
HeapFree( GetProcessHeap(), 0, profile );
break;
}
memcpy( profile, sysdir, len_sysdir * sizeof(WCHAR) );
memcpy( profile + len_sysdir, color_path, sizeof(color_path) - sizeof(WCHAR) );
ret = proc( profile, lparam );
HeapFree( GetProcessHeap(), 0, profile );
if (!ret) break;
index++;
}
RegCloseKey( hkey );
return -1;
}
......@@ -362,7 +362,6 @@ static const struct gdi_dc_funcs x11drv_funcs =
NULL, /* pEndPage */
NULL, /* pEndPath */
NULL, /* pEnumFonts */
X11DRV_EnumICMProfiles, /* pEnumICMProfiles */
NULL, /* pExtDeviceMode */
X11DRV_ExtEscape, /* pExtEscape */
X11DRV_ExtFloodFill, /* pExtFloodFill */
......
......@@ -152,11 +152,10 @@ extern BOOL CDECL X11DRV_Chord( PHYSDEV dev, INT left, INT top, INT right, INT b
extern NTSTATUS CDECL X11DRV_D3DKMTCheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *desc ) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL X11DRV_D3DKMTSetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *desc ) DECLSPEC_HIDDEN;
extern BOOL CDECL X11DRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
extern INT CDECL X11DRV_EnumICMProfiles( PHYSDEV dev, ICMENUMPROCW proc, LPARAM lparam ) DECLSPEC_HIDDEN;
extern BOOL CDECL X11DRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillType ) DECLSPEC_HIDDEN;
extern BOOL CDECL X11DRV_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL X11DRV_GetDeviceGammaRamp( PHYSDEV dev, LPVOID ramp ) DECLSPEC_HIDDEN;
extern BOOL CDECL X11DRV_GetICMProfile( PHYSDEV dev, LPDWORD size, LPWSTR filename ) DECLSPEC_HIDDEN;
extern BOOL CDECL X11DRV_GetICMProfile( PHYSDEV dev, BOOL allow_default, LPDWORD size, LPWSTR filename ) DECLSPEC_HIDDEN;
extern DWORD CDECL X11DRV_GetImage( PHYSDEV dev, BITMAPINFO *info,
struct gdi_image_bits *bits, struct bitblt_coords *src ) DECLSPEC_HIDDEN;
extern COLORREF CDECL X11DRV_GetNearestColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
......
......@@ -2174,7 +2174,6 @@ static const struct gdi_dc_funcs xrender_funcs =
NULL, /* pEndPage */
NULL, /* pEndPath */
NULL, /* pEnumFonts */
NULL, /* pEnumICMProfiles */
NULL, /* pExtDeviceMode */
xrenderdrv_ExtEscape, /* pExtEscape */
NULL, /* pExtFloodFill */
......
......@@ -87,7 +87,6 @@ struct gdi_dc_funcs
INT (CDECL *pEndPage)(PHYSDEV);
BOOL (CDECL *pEndPath)(PHYSDEV);
BOOL (CDECL *pEnumFonts)(PHYSDEV,LPLOGFONTW,FONTENUMPROCW,LPARAM);
INT (CDECL *pEnumICMProfiles)(PHYSDEV,ICMENUMPROCW,LPARAM);
INT (CDECL *pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
INT (CDECL *pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID);
BOOL (CDECL *pExtFloodFill)(PHYSDEV,INT,INT,COLORREF,UINT);
......@@ -108,7 +107,7 @@ struct gdi_dc_funcs
DWORD (CDECL *pGetFontUnicodeRanges)(PHYSDEV,LPGLYPHSET);
DWORD (CDECL *pGetGlyphIndices)(PHYSDEV,LPCWSTR,INT,LPWORD,DWORD);
DWORD (CDECL *pGetGlyphOutline)(PHYSDEV,UINT,UINT,LPGLYPHMETRICS,DWORD,LPVOID,const MAT2*);
BOOL (CDECL *pGetICMProfile)(PHYSDEV,LPDWORD,LPWSTR);
BOOL (CDECL *pGetICMProfile)(PHYSDEV,BOOL,LPDWORD,LPWSTR);
DWORD (CDECL *pGetImage)(PHYSDEV,BITMAPINFO*,struct gdi_image_bits*,struct bitblt_coords*);
DWORD (CDECL *pGetKerningPairs)(PHYSDEV,DWORD,LPKERNINGPAIR);
COLORREF (CDECL *pGetNearestColor)(PHYSDEV,COLORREF);
......@@ -169,7 +168,7 @@ struct gdi_dc_funcs
};
/* increment this when you change the DC function table */
#define WINE_GDI_DRIVER_VERSION 66
#define WINE_GDI_DRIVER_VERSION 67
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */
#define GDI_PRIORITY_FONT_DRV 100 /* any font driver */
......
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