gdi32: Factor out get_icm_profile.

And move it to dc.c.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-09-09 14:02:03 +02:00 committed by Alexandre Julliard
parent 6403e88140
commit 5f139f1411
3 changed files with 23 additions and 28 deletions

View File

@ -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;
}

View File

@ -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 )
{

View File

@ -19,16 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <string.h>
#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 );
}
/**********************************************************************