mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 20:03:38 +00:00
gdi32: Move GdiConvertToDevmodeW to gdidc.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:
parent
ef7b2a1b8b
commit
75d21c999e
|
@ -225,7 +225,7 @@ done:
|
|||
|
||||
|
||||
/***********************************************************************
|
||||
* __wine_set_display_driver (GDI32.@)
|
||||
* __wine_set_display_driver (win32u.@)
|
||||
*/
|
||||
void CDECL __wine_set_display_driver( HMODULE module )
|
||||
{
|
||||
|
@ -941,56 +941,6 @@ BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* GdiConvertToDevmodeW (GDI32.@)
|
||||
*/
|
||||
DEVMODEW * WINAPI GdiConvertToDevmodeW(const DEVMODEA *dmA)
|
||||
{
|
||||
DEVMODEW *dmW;
|
||||
WORD dmW_size, dmA_size;
|
||||
|
||||
dmA_size = dmA->dmSize;
|
||||
|
||||
/* this is the minimal dmSize that XP accepts */
|
||||
if (dmA_size < FIELD_OFFSET(DEVMODEA, dmFields))
|
||||
return NULL;
|
||||
|
||||
if (dmA_size > sizeof(DEVMODEA))
|
||||
dmA_size = sizeof(DEVMODEA);
|
||||
|
||||
dmW_size = dmA_size + CCHDEVICENAME;
|
||||
if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
|
||||
dmW_size += CCHFORMNAME;
|
||||
|
||||
dmW = HeapAlloc(GetProcessHeap(), 0, dmW_size + dmA->dmDriverExtra);
|
||||
if (!dmW) return NULL;
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmDeviceName, -1,
|
||||
dmW->dmDeviceName, CCHDEVICENAME);
|
||||
/* copy slightly more, to avoid long computations */
|
||||
memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion, dmA_size - CCHDEVICENAME);
|
||||
|
||||
if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
|
||||
{
|
||||
if (dmA->dmFields & DM_FORMNAME)
|
||||
MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmFormName, -1,
|
||||
dmW->dmFormName, CCHFORMNAME);
|
||||
else
|
||||
dmW->dmFormName[0] = 0;
|
||||
|
||||
if (dmA_size > FIELD_OFFSET(DEVMODEA, dmLogPixels))
|
||||
memcpy(&dmW->dmLogPixels, &dmA->dmLogPixels, dmA_size - FIELD_OFFSET(DEVMODEA, dmLogPixels));
|
||||
}
|
||||
|
||||
if (dmA->dmDriverExtra)
|
||||
memcpy((char *)dmW + dmW_size, (const char *)dmA + dmA_size, dmA->dmDriverExtra);
|
||||
|
||||
dmW->dmSize = dmW_size;
|
||||
|
||||
return dmW;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* @ [GDI32.100]
|
||||
*
|
||||
|
|
|
@ -97,6 +97,55 @@ HDC WINAPI CreateICW( const WCHAR *driver, const WCHAR *device, const WCHAR *out
|
|||
return CreateDCW( driver, device, output, init_data );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GdiConvertToDevmodeW (GDI32.@)
|
||||
*/
|
||||
DEVMODEW *WINAPI GdiConvertToDevmodeW( const DEVMODEA *dmA )
|
||||
{
|
||||
DEVMODEW *dmW;
|
||||
WORD dmW_size, dmA_size;
|
||||
|
||||
dmA_size = dmA->dmSize;
|
||||
|
||||
/* this is the minimal dmSize that XP accepts */
|
||||
if (dmA_size < FIELD_OFFSET(DEVMODEA, dmFields))
|
||||
return NULL;
|
||||
|
||||
if (dmA_size > sizeof(DEVMODEA))
|
||||
dmA_size = sizeof(DEVMODEA);
|
||||
|
||||
dmW_size = dmA_size + CCHDEVICENAME;
|
||||
if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
|
||||
dmW_size += CCHFORMNAME;
|
||||
|
||||
dmW = HeapAlloc( GetProcessHeap(), 0, dmW_size + dmA->dmDriverExtra );
|
||||
if (!dmW) return NULL;
|
||||
|
||||
MultiByteToWideChar( CP_ACP, 0, (const char*) dmA->dmDeviceName, -1,
|
||||
dmW->dmDeviceName, CCHDEVICENAME );
|
||||
/* copy slightly more, to avoid long computations */
|
||||
memcpy( &dmW->dmSpecVersion, &dmA->dmSpecVersion, dmA_size - CCHDEVICENAME );
|
||||
|
||||
if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
|
||||
{
|
||||
if (dmA->dmFields & DM_FORMNAME)
|
||||
MultiByteToWideChar( CP_ACP, 0, (const char*) dmA->dmFormName, -1,
|
||||
dmW->dmFormName, CCHFORMNAME );
|
||||
else
|
||||
dmW->dmFormName[0] = 0;
|
||||
|
||||
if (dmA_size > FIELD_OFFSET(DEVMODEA, dmLogPixels))
|
||||
memcpy( &dmW->dmLogPixels, &dmA->dmLogPixels, dmA_size - FIELD_OFFSET(DEVMODEA, dmLogPixels) );
|
||||
}
|
||||
|
||||
if (dmA->dmDriverExtra)
|
||||
memcpy( (char *)dmW + dmW_size, (const char *)dmA + dmA_size, dmA->dmDriverExtra );
|
||||
|
||||
dmW->dmSize = dmW_size;
|
||||
|
||||
return dmW;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DeleteDC (GDI32.@)
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue