Alexandre Julliard : gdi32: Add null driver entry points for the color management functions.

Alexandre Julliard julliard at winehq.org
Fri Mar 11 10:23:38 CST 2011


Module: wine
Branch: master
Commit: 0c33f1dd8957c19707ddd3a0439b4e8ce8a3cb31
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0c33f1dd8957c19707ddd3a0439b4e8ce8a3cb31

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Mar 11 12:33:34 2011 +0100

gdi32: Add null driver entry points for the color management functions.

---

 dlls/gdi32/dc.c     |    8 ++++----
 dlls/gdi32/driver.c |   28 ++++++++++++++++++++++++----
 dlls/gdi32/icm.c    |   51 +++++++++++----------------------------------------
 3 files changed, 39 insertions(+), 48 deletions(-)

diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index 98b6bf1..e7da659 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -1509,8 +1509,8 @@ BOOL WINAPI GetDeviceGammaRamp(HDC hDC, LPVOID ptr)
 
     if( dc )
     {
-	if (dc->funcs->pGetDeviceGammaRamp)
-	    ret = dc->funcs->pGetDeviceGammaRamp(dc->physDev, ptr);
+        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetDeviceGammaRamp );
+        ret = physdev->funcs->pGetDeviceGammaRamp( physdev, ptr );
 	release_dc_ptr( dc );
     }
     return ret;
@@ -1526,8 +1526,8 @@ BOOL WINAPI SetDeviceGammaRamp(HDC hDC, LPVOID ptr)
 
     if( dc )
     {
-	if (dc->funcs->pSetDeviceGammaRamp)
-	    ret = dc->funcs->pSetDeviceGammaRamp(dc->physDev, ptr);
+        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetDeviceGammaRamp );
+        ret = physdev->funcs->pSetDeviceGammaRamp( physdev, ptr );
 	release_dc_ptr( dc );
     }
     return ret;
diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
index 61cbfe5..969d660 100644
--- a/dlls/gdi32/driver.c
+++ b/dlls/gdi32/driver.c
@@ -366,6 +366,11 @@ static INT CDECL nulldrv_EndPage( PHYSDEV dev )
     return 0;
 }
 
+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 )
 {
@@ -388,6 +393,16 @@ static BOOL CDECL nulldrv_GdiComment( PHYSDEV dev, UINT size, const BYTE *data )
     return FALSE;
 }
 
+static BOOL CDECL nulldrv_GetDeviceGammaRamp( PHYSDEV dev, void *ramp )
+{
+    return FALSE;
+}
+
+static BOOL CDECL nulldrv_GetICMProfile( PHYSDEV dev, LPDWORD size, LPWSTR filename )
+{
+    return FALSE;
+}
+
 static COLORREF CDECL nulldrv_GetPixel( PHYSDEV dev, INT x, INT y )
 {
     return 0;
@@ -511,6 +526,11 @@ static DWORD CDECL nulldrv_SetLayout( PHYSDEV dev, DWORD layout )
     return layout;
 }
 
+static BOOL CDECL nulldrv_SetDeviceGammaRamp( PHYSDEV dev, void *ramp )
+{
+    return FALSE;
+}
+
 static DWORD CDECL nulldrv_SetMapperFlags( PHYSDEV dev, DWORD flags )
 {
     return flags;
@@ -667,7 +687,7 @@ const DC_FUNCTIONS null_driver =
     nulldrv_EndDoc,                     /* pEndDoc */
     nulldrv_EndPage,                    /* pEndPage */
     NULL,                               /* pEndPath */
-    NULL,                               /* pEnumICMProfiles */
+    nulldrv_EnumICMProfiles,            /* pEnumICMProfiles */
     NULL,                               /* pEnumDeviceFonts */
     nulldrv_ExcludeClipRect,            /* pExcludeClipRect */
     nulldrv_ExtDeviceMode,              /* pExtDeviceMode */
@@ -684,8 +704,8 @@ const DC_FUNCTIONS null_driver =
     NULL,                               /* pGetCharWidth */
     NULL,                               /* pGetDIBits */
     NULL,                               /* pGetDeviceCaps */
-    NULL,                               /* pGetDeviceGammaRamp */
-    NULL,                               /* pGetICMProfile */
+    nulldrv_GetDeviceGammaRamp,         /* pGetDeviceGammaRamp */
+    nulldrv_GetICMProfile,              /* pGetICMProfile */
     NULL,                               /* pGetNearestColor */
     nulldrv_GetPixel,                   /* pGetPixel */
     nulldrv_GetPixelFormat,             /* pGetPixelFormat */
@@ -736,7 +756,7 @@ const DC_FUNCTIONS null_driver =
     NULL,                               /* pSetDIBits */
     NULL,                               /* pSetDIBitsToDevice */
     nulldrv_SetDeviceClipping,          /* pSetDeviceClipping */
-    NULL,                               /* pSetDeviceGammaRamp */
+    nulldrv_SetDeviceGammaRamp,         /* pSetDeviceGammaRamp */
     nulldrv_SetLayout,                  /* pSetLayout */
     nulldrv_SetMapMode,                 /* pSetMapMode */
     nulldrv_SetMapperFlags,             /* pSetMapperFlags */
diff --git a/dlls/gdi32/icm.c b/dlls/gdi32/icm.c
index afbc0ee..d3a345d 100644
--- a/dlls/gdi32/icm.c
+++ b/dlls/gdi32/icm.c
@@ -40,30 +40,22 @@ WINE_DEFAULT_DEBUG_CHANNEL(icm);
 
 struct enum_profiles
 {
-    BOOL unicode;
-    union
-    {
-        ICMENUMPROCA funcA;
-        ICMENUMPROCW funcW;
-    } callback;
+    ICMENUMPROCA funcA;
     LPARAM data;
 };
 
-INT CALLBACK enum_profiles_callback( LPWSTR filename, LPARAM lparam )
+static INT CALLBACK enum_profiles_callbackA( LPWSTR filename, LPARAM lparam )
 {
     int len, ret = -1;
     struct enum_profiles *ep = (struct enum_profiles *)lparam;
     char *filenameA;
 
-    if (ep->unicode)
-        return ep->callback.funcW( filename, ep->data );
-
     len = WideCharToMultiByte( CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL );
     filenameA = HeapAlloc( GetProcessHeap(), 0, len );
     if (filenameA)
     {
         WideCharToMultiByte( CP_ACP, 0, filename, -1, filenameA, len, NULL, NULL );
-        ret = ep->callback.funcA( filenameA, ep->data );
+        ret = ep->funcA( filenameA, ep->data );
         HeapFree( GetProcessHeap(), 0, filenameA );
     }
     return ret;
@@ -74,26 +66,12 @@ INT CALLBACK enum_profiles_callback( LPWSTR filename, LPARAM lparam )
  */
 INT WINAPI EnumICMProfilesA(HDC hdc, ICMENUMPROCA func, LPARAM lparam)
 {
-    DC *dc;
-    INT ret = -1;
-
-    TRACE("%p, %p, 0x%08lx\n", hdc, func, lparam);
+    struct enum_profiles ep;
 
     if (!func) return -1;
-    if ((dc = get_dc_ptr(hdc)))
-    {
-        if (dc->funcs->pEnumICMProfiles)
-        {
-            struct enum_profiles ep;
-
-            ep.unicode        = FALSE;
-            ep.callback.funcA = func;
-            ep.data           = lparam;
-            ret = dc->funcs->pEnumICMProfiles(dc->physDev, enum_profiles_callback, (LPARAM)&ep);
-        }
-        release_dc_ptr(dc);
-    }
-    return ret;
+    ep.funcA = func;
+    ep.data  = lparam;
+    return EnumICMProfilesW( hdc, enum_profiles_callbackA, (LPARAM)&ep );
 }
 
 /***********************************************************************
@@ -109,15 +87,8 @@ INT WINAPI EnumICMProfilesW(HDC hdc, ICMENUMPROCW func, LPARAM lparam)
     if (!func) return -1;
     if ((dc = get_dc_ptr(hdc)))
     {
-        if (dc->funcs->pEnumICMProfiles)
-        {
-            struct enum_profiles ep;
-
-            ep.unicode        = TRUE;
-            ep.callback.funcW = func;
-            ep.data           = lparam;
-            ret = dc->funcs->pEnumICMProfiles(dc->physDev, enum_profiles_callback, (LPARAM)&ep);
-        }
+        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pEnumICMProfiles );
+        ret = physdev->funcs->pEnumICMProfiles( physdev, func, lparam );
         release_dc_ptr(dc);
     }
     return ret;
@@ -173,8 +144,8 @@ BOOL WINAPI GetICMProfileW(HDC hdc, LPDWORD size, LPWSTR filename)
 
     if (dc)
     {
-        if (dc->funcs->pGetICMProfile)
-            ret = dc->funcs->pGetICMProfile(dc->physDev, size, filename);
+        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetICMProfile );
+        ret = physdev->funcs->pGetICMProfile( physdev, size, filename );
         release_dc_ptr(dc);
     }
     return ret;




More information about the wine-cvs mailing list