[1/3] gdi32: Move EnumICMProfiles to the driver.

Hans Leidekker hans at codeweavers.com
Tue Oct 26 05:40:41 CDT 2010


---
 dlls/gdi32/driver.c               |    1 +
 dlls/gdi32/enhmfdrv/init.c        |    1 +
 dlls/gdi32/gdi_private.h          |    1 +
 dlls/gdi32/icm.c                  |   71 ++++++++++++++++++++++++++++++++++--
 dlls/gdi32/mfdrv/init.c           |    1 +
 dlls/winex11.drv/graphics.c       |    9 +++++
 dlls/winex11.drv/winex11.drv.spec |    1 +
 7 files changed, 81 insertions(+), 4 deletions(-)

diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
index 65eb048..38c4942 100644
--- a/dlls/gdi32/driver.c
+++ b/dlls/gdi32/driver.c
@@ -96,6 +96,7 @@ static struct graphics_driver *create_driver( HMODULE module )
         GET_FUNC(EndPage);
         GET_FUNC(EndPath);
         GET_FUNC(EnumDeviceFonts);
+        GET_FUNC(EnumICMProfiles);
         GET_FUNC(ExcludeClipRect);
         GET_FUNC(ExtDeviceMode);
         GET_FUNC(ExtEscape);
diff --git a/dlls/gdi32/enhmfdrv/init.c b/dlls/gdi32/enhmfdrv/init.c
index 279300d..8f0b932 100644
--- a/dlls/gdi32/enhmfdrv/init.c
+++ b/dlls/gdi32/enhmfdrv/init.c
@@ -58,6 +58,7 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
     NULL,                            /* pEndPage */
     EMFDRV_EndPath,                  /* pEndPath */
     NULL,                            /* pEnumDeviceFonts */
+    NULL,                            /* pEnumICMProfiles */
     EMFDRV_ExcludeClipRect,          /* pExcludeClipRect */
     NULL,                            /* pExtDeviceMode */
     NULL,                            /* pExtEscape */
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index ee44af5..3ed9356 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -99,6 +99,7 @@ typedef struct tagDC_FUNCS
     INT      (CDECL *pEndDoc)(PHYSDEV);
     INT      (CDECL *pEndPage)(PHYSDEV);
     BOOL     (CDECL *pEndPath)(PHYSDEV);
+    INT      (CDECL *pEnumICMProfiles)(PHYSDEV,ICMENUMPROCW,LPARAM);
     BOOL     (CDECL *pEnumDeviceFonts)(PHYSDEV,LPLOGFONTW,FONTENUMPROCW,LPARAM);
     INT      (CDECL *pExcludeClipRect)(PHYSDEV,INT,INT,INT,INT);
     INT      (CDECL *pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
diff --git a/dlls/gdi32/icm.c b/dlls/gdi32/icm.c
index 0e346ee..033dbd9 100644
--- a/dlls/gdi32/icm.c
+++ b/dlls/gdi32/icm.c
@@ -38,13 +38,60 @@
 WINE_DEFAULT_DEBUG_CHANNEL(icm);
 

+struct enum_profiles
+{
+    BOOL unicode;
+    union
+    {
+        ICMENUMPROCA funcA;
+        ICMENUMPROCW funcW;
+    } callback;
+    LPARAM data;
+};
+
+INT CALLBACK enum_profiles_callback( 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 );
+        HeapFree( GetProcessHeap(), 0, filenameA );
+    }
+    return ret;
+}
+
 /***********************************************************************
  *           EnumICMProfilesA    (GDI32.@)
  */
 INT WINAPI EnumICMProfilesA(HDC hdc, ICMENUMPROCA func, LPARAM lparam)
 {
-	FIXME("%p, %p, 0x%08lx stub\n", hdc, func, lparam);
-	return -1;
+    INT ret = -1;
+    DC *dc = get_dc_ptr(hdc);
+
+    TRACE("%p, %p, 0x%08lx\n", hdc, func, lparam);
+    if (dc)
+    {
+        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;
 }
 
 /***********************************************************************
@@ -52,8 +99,24 @@ INT WINAPI EnumICMProfilesA(HDC hdc, ICMENUMPROCA func, LPARAM lparam)
  */
 INT WINAPI EnumICMProfilesW(HDC hdc, ICMENUMPROCW func, LPARAM lparam)
 {
-	FIXME("%p, %p, 0x%08lx stub\n", hdc, func, lparam);
-	return -1;
+    INT ret = -1;
+    DC *dc = get_dc_ptr(hdc);
+
+    TRACE("%p, %p, 0x%08lx\n", hdc, func, lparam);
+    if (dc)
+    {
+        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);
+        }
+        release_dc_ptr(dc);
+    }
+    return ret;
 }
 
 /**********************************************************************
diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c
index 810bd27..553c363 100644
--- a/dlls/gdi32/mfdrv/init.c
+++ b/dlls/gdi32/mfdrv/init.c
@@ -56,6 +56,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
     NULL,                            /* pEndPage */
     MFDRV_EndPath,                   /* pEndPath */
     NULL,                            /* pEnumDeviceFonts */
+    NULL,                            /* pEnumICMProfiles */
     MFDRV_ExcludeClipRect,           /* pExcludeClipRect */
     NULL,                            /* pExtDeviceMode */
     MFDRV_ExtEscape,                 /* pExtEscape */
diff --git a/dlls/winex11.drv/graphics.c b/dlls/winex11.drv/graphics.c
index 8420f01..ef8c3c7 100644
--- a/dlls/winex11.drv/graphics.c
+++ b/dlls/winex11.drv/graphics.c
@@ -1589,3 +1589,12 @@ BOOL CDECL X11DRV_GetICMProfile( X11DRV_PDEVICE *physDev, LPDWORD size, LPWSTR f
     *size = required;
     return TRUE;
 }
+
+/***********************************************************************
+ *              EnumICMProfiles (X11DRV.@)
+ */
+INT CDECL X11DRV_EnumICMProfiles( X11DRV_PDEVICE *physDev, ICMENUMPROCW proc, LPARAM lparam )
+{
+    FIXME("%p, %p, %ld\n", physDev, proc, lparam);
+    return -1;
+}
diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec
index 323da2c..9476c40 100644
--- a/dlls/winex11.drv/winex11.drv.spec
+++ b/dlls/winex11.drv/winex11.drv.spec
@@ -12,6 +12,7 @@
 @ cdecl DescribePixelFormat(ptr long long ptr) X11DRV_DescribePixelFormat
 @ cdecl Ellipse(ptr long long long long) X11DRV_Ellipse
 @ cdecl EnumDeviceFonts(ptr ptr ptr long) X11DRV_EnumDeviceFonts
+@ cdecl EnumICMProfiles(ptr ptr long) X11DRV_EnumICMProfiles
 @ cdecl ExtEscape(ptr long long ptr long ptr) X11DRV_ExtEscape
 @ cdecl ExtFloodFill(ptr long long long long) X11DRV_ExtFloodFill
 @ cdecl ExtTextOut(ptr long long long ptr ptr long ptr) X11DRV_ExtTextOut
-- 
1.7.1







More information about the wine-patches mailing list