From 5f139f141118cf99157c648ad4974d342f32f8db Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 9 Sep 2021 14:02:03 +0200 Subject: [PATCH] gdi32: Factor out get_icm_profile. And move it to dc.c. Signed-off-by: Jacek Caban Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/gdi32/dc.c | 17 +++++++++++++++++ dlls/gdi32/gdi_private.h | 2 ++ dlls/gdi32/icm.c | 32 ++++---------------------------- 3 files changed, 23 insertions(+), 28 deletions(-) diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index ae6119529f5..f7b56b06f6f 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -1241,3 +1241,20 @@ DWORD WINAPI NtGdiSetLayout( HDC hdc, LONG wox, DWORD layout ) return old_layout; } + +/********************************************************************** + * get_icm_profile (win32u.@) + */ +BOOL get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename ) +{ + PHYSDEV physdev; + DC *dc; + BOOL ret; + + if (!(dc = get_dc_ptr(hdc))) return FALSE; + + physdev = GET_DC_PHYSDEV( dc, pGetICMProfile ); + ret = physdev->funcs->pGetICMProfile( physdev, allow_default, size, filename ); + release_dc_ptr(dc); + return ret; +} diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index e1ba092a08e..efadf3a7c82 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -278,6 +278,8 @@ extern HENHMETAFILE EMF_Create_HENHMETAFILE( ENHMETAHEADER *emh, DWORD filesize, extern BOOL get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage ) DECLSPEC_HIDDEN; +extern BOOL get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, + WCHAR *filename ) DECLSPEC_HIDDEN; static inline int get_dib_stride( int width, int bpp ) { diff --git a/dlls/gdi32/icm.c b/dlls/gdi32/icm.c index 22aacb762e3..63377a9ab88 100644 --- a/dlls/gdi32/icm.c +++ b/dlls/gdi32/icm.c @@ -19,16 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" +#include "gdi_private.h" #include "winnls.h" -#include "winreg.h" - -#include "ntgdi_private.h" #include "wine/debug.h" @@ -78,20 +70,13 @@ INT WINAPI EnumICMProfilesW(HDC hdc, ICMENUMPROCW func, LPARAM lparam) { WCHAR profile[MAX_PATH]; DWORD size = ARRAYSIZE(profile); - DC *dc; - BOOL ret = FALSE; 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, pGetICMProfile ); - ret = physdev->funcs->pGetICMProfile( physdev, FALSE, &size, profile ); - release_dc_ptr(dc); - } + if (!get_icm_profile( hdc, FALSE, &size, profile )) return -1; /* FIXME: support multiple profiles */ - return ret ? func( profile, lparam ) : -1; + return func( profile, lparam ); } /********************************************************************** @@ -144,18 +129,9 @@ BOOL WINAPI GetICMProfileA(HDC hdc, LPDWORD size, LPSTR filename) */ BOOL WINAPI GetICMProfileW(HDC hdc, LPDWORD size, LPWSTR filename) { - BOOL ret = FALSE; - DC *dc = get_dc_ptr(hdc); - TRACE("%p, %p, %p\n", hdc, size, filename); - if (dc) - { - PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetICMProfile ); - ret = physdev->funcs->pGetICMProfile( physdev, TRUE, size, filename ); - release_dc_ptr(dc); - } - return ret; + return get_icm_profile( hdc, TRUE, size, filename ); } /********************************************************************** -- 2.11.4.GIT