From fa7c939d02903f3e06b6c41e571b5a623d0a64bc Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 30 Jul 2021 13:01:38 +0200 Subject: [PATCH] gdi32: Move more functions from dc.c. Signed-off-by: Jacek Caban Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/gdi32/dc.c | 132 -------------------------------------------- dlls/gdi32/gdidc.c | 133 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+), 132 deletions(-) diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index a0bc86d6337..130a1ac99e1 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -690,65 +690,6 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output, } -/*********************************************************************** - * CreateDCA (GDI32.@) - */ -HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output, - const DEVMODEA *initData ) -{ - UNICODE_STRING driverW, deviceW, outputW; - DEVMODEW *initDataW; - HDC ret; - - if (driver) RtlCreateUnicodeStringFromAsciiz(&driverW, driver); - else driverW.Buffer = NULL; - - if (device) RtlCreateUnicodeStringFromAsciiz(&deviceW, device); - else deviceW.Buffer = NULL; - - if (output) RtlCreateUnicodeStringFromAsciiz(&outputW, output); - else outputW.Buffer = NULL; - - initDataW = NULL; - if (initData) - { - /* don't convert initData for DISPLAY driver, it's not used */ - if (!driverW.Buffer || wcsicmp( driverW.Buffer, L"display" )) - initDataW = GdiConvertToDevmodeW(initData); - } - - ret = CreateDCW( driverW.Buffer, deviceW.Buffer, outputW.Buffer, initDataW ); - - RtlFreeUnicodeString(&driverW); - RtlFreeUnicodeString(&deviceW); - RtlFreeUnicodeString(&outputW); - HeapFree(GetProcessHeap(), 0, initDataW); - return ret; -} - - -/*********************************************************************** - * CreateICA (GDI32.@) - */ -HDC WINAPI CreateICA( LPCSTR driver, LPCSTR device, LPCSTR output, - const DEVMODEA* initData ) -{ - /* Nothing special yet for ICs */ - return CreateDCA( driver, device, output, initData ); -} - - -/*********************************************************************** - * CreateICW (GDI32.@) - */ -HDC WINAPI CreateICW( LPCWSTR driver, LPCWSTR device, LPCWSTR output, - const DEVMODEW* initData ) -{ - /* Nothing special yet for ICs */ - return CreateDCW( driver, device, output, initData ); -} - - /*********************************************************************** * CreateCompatibleDC (GDI32.@) */ @@ -864,24 +805,6 @@ HDC WINAPI ResetDCW( HDC hdc, const DEVMODEW *devmode ) } -/*********************************************************************** - * ResetDCA (GDI32.@) - */ -HDC WINAPI ResetDCA( HDC hdc, const DEVMODEA *devmode ) -{ - DEVMODEW *devmodeW; - HDC ret; - - if (devmode) devmodeW = GdiConvertToDevmodeW(devmode); - else devmodeW = NULL; - - ret = ResetDCW(hdc, devmodeW); - - HeapFree(GetProcessHeap(), 0, devmodeW); - return ret; -} - - /*********************************************************************** * GetDeviceCaps (GDI32.@) */ @@ -1164,18 +1087,6 @@ WORD WINAPI SetHookFlags( HDC hdc, WORD flags ) return ret; } -/*********************************************************************** - * SetICMMode (GDI32.@) - */ -INT WINAPI SetICMMode(HDC hdc, INT iEnableICM) -{ -/*FIXME: Assume that ICM is always off, and cannot be turned on */ - if (iEnableICM == ICM_OFF) return ICM_OFF; - if (iEnableICM == ICM_ON) return 0; - if (iEnableICM == ICM_QUERY) return ICM_OFF; - return 0; -} - /*********************************************************************** * GetDeviceGammaRamp (GDI32.@) */ @@ -1528,46 +1439,3 @@ COLORREF WINAPI SetDCPenColor(HDC hdc, COLORREF crColor) return oldClr; } - -/*********************************************************************** - * CancelDC (GDI32.@) - */ -BOOL WINAPI CancelDC(HDC hdc) -{ - FIXME("stub\n"); - return TRUE; -} - -/******************************************************************* - * GdiIsMetaPrintDC [GDI32.@] - */ -BOOL WINAPI GdiIsMetaPrintDC(HDC hdc) -{ - FIXME("%p\n", hdc); - return FALSE; -} - -/******************************************************************* - * GdiIsMetaFileDC [GDI32.@] - */ -BOOL WINAPI GdiIsMetaFileDC(HDC hdc) -{ - TRACE("%p\n", hdc); - - switch( GetObjectType( hdc ) ) - { - case OBJ_METADC: - case OBJ_ENHMETADC: - return TRUE; - } - return FALSE; -} - -/******************************************************************* - * GdiIsPlayMetafileDC [GDI32.@] - */ -BOOL WINAPI GdiIsPlayMetafileDC(HDC hdc) -{ - FIXME("%p\n", hdc); - return FALSE; -} diff --git a/dlls/gdi32/gdidc.c b/dlls/gdi32/gdidc.c index aec9ad48610..42df880f718 100644 --- a/dlls/gdi32/gdidc.c +++ b/dlls/gdi32/gdidc.c @@ -21,6 +21,8 @@ */ #include "gdi_private.h" +#include "winternl.h" + #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(gdi); @@ -37,6 +39,79 @@ static DC_ATTR *get_dc_attr( HDC hdc ) return dc_attr->disabled ? NULL : dc_attr; } +/*********************************************************************** + * CreateDCA (GDI32.@) + */ +HDC WINAPI CreateDCA( const char *driver, const char *device, const char *output, + const DEVMODEA *init_data ) +{ + UNICODE_STRING driverW, deviceW, outputW; + DEVMODEW *init_dataW = NULL; + HDC ret; + + if (driver) RtlCreateUnicodeStringFromAsciiz( &driverW, driver ); + else driverW.Buffer = NULL; + + if (device) RtlCreateUnicodeStringFromAsciiz( &deviceW, device ); + else deviceW.Buffer = NULL; + + if (output) RtlCreateUnicodeStringFromAsciiz( &outputW, output ); + else outputW.Buffer = NULL; + + if (init_data) + { + /* don't convert init_data for DISPLAY driver, it's not used */ + if (!driverW.Buffer || wcsicmp( driverW.Buffer, L"display" )) + init_dataW = GdiConvertToDevmodeW( init_data ); + } + + ret = CreateDCW( driverW.Buffer, deviceW.Buffer, outputW.Buffer, init_dataW ); + + RtlFreeUnicodeString( &driverW ); + RtlFreeUnicodeString( &deviceW ); + RtlFreeUnicodeString( &outputW ); + HeapFree( GetProcessHeap(), 0, init_dataW ); + return ret; +} + +/*********************************************************************** + * CreateICA (GDI32.@) + */ +HDC WINAPI CreateICA( const char *driver, const char *device, const char *output, + const DEVMODEA *init_data ) +{ + /* Nothing special yet for ICs */ + return CreateDCA( driver, device, output, init_data ); +} + + +/*********************************************************************** + * CreateICW (GDI32.@) + */ +HDC WINAPI CreateICW( const WCHAR *driver, const WCHAR *device, const WCHAR *output, + const DEVMODEW *init_data ) +{ + /* Nothing special yet for ICs */ + return CreateDCW( driver, device, output, init_data ); +} + +/*********************************************************************** + * ResetDCA (GDI32.@) + */ +HDC WINAPI ResetDCA( HDC hdc, const DEVMODEA *devmode ) +{ + DEVMODEW *devmodeW; + HDC ret; + + if (devmode) devmodeW = GdiConvertToDevmodeW( devmode ); + else devmodeW = NULL; + + ret = ResetDCW( hdc, devmodeW ); + + HeapFree( GetProcessHeap(), 0, devmodeW ); + return ret; +} + /*********************************************************************** * GetTextAlign (GDI32.@) */ @@ -854,3 +929,61 @@ BOOL WINAPI GdiSetPixelFormat( HDC hdc, INT format, const PIXELFORMATDESCRIPTOR TRACE( "(%p,%d,%p)\n", hdc, format, descr ); return NtGdiSetPixelFormat( hdc, format ); } + +/*********************************************************************** + * CancelDC (GDI32.@) + */ +BOOL WINAPI CancelDC(HDC hdc) +{ + FIXME( "stub\n" ); + return TRUE; +} + +/*********************************************************************** + * SetICMMode (GDI32.@) + */ +INT WINAPI SetICMMode( HDC hdc, INT mode ) +{ + /* FIXME: Assume that ICM is always off, and cannot be turned on */ + switch (mode) + { + case ICM_OFF: return ICM_OFF; + case ICM_ON: return 0; + case ICM_QUERY: return ICM_OFF; + } + return 0; +} + +/*********************************************************************** + * GdiIsMetaPrintDC (GDI32.@) + */ +BOOL WINAPI GdiIsMetaPrintDC( HDC hdc ) +{ + FIXME( "%p\n", hdc ); + return FALSE; +} + +/*********************************************************************** + * GdiIsMetaFileDC (GDI32.@) + */ +BOOL WINAPI GdiIsMetaFileDC( HDC hdc ) +{ + TRACE( "%p\n", hdc ); + + switch (GetObjectType( hdc )) + { + case OBJ_METADC: + case OBJ_ENHMETADC: + return TRUE; + } + return FALSE; +} + +/*********************************************************************** + * GdiIsPlayMetafileDC (GDI32.@) + */ +BOOL WINAPI GdiIsPlayMetafileDC( HDC hdc ) +{ + FIXME( "%p\n", hdc ); + return FALSE; +}