Hans Leidekker : gdi32: Move EnumICMProfiles to the driver.
Alexandre Julliard
julliard at winehq.org
Tue Oct 26 12:34:52 CDT 2010
Module: wine
Branch: master
Commit: 0839dabdabd43fd99d0c47507fabce08a8d43c7d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0839dabdabd43fd99d0c47507fabce08a8d43c7d
Author: Hans Leidekker <hans at codeweavers.com>
Date: Tue Oct 26 12:40:41 2010 +0200
gdi32: Move EnumICMProfiles to the driver.
---
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 +
5 files changed, 71 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 */
More information about the wine-cvs
mailing list