From 7582b13d8d413e195e8a4401d41d566fc32431d5 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 26 Sep 2009 13:31:45 +0200 Subject: [PATCH] gdi32: Move remaining 16-bit metafile functions to metafile16.c --- dlls/gdi32/gdi16.c | 9 ------- dlls/gdi32/gdi_private.h | 1 - dlls/gdi32/metafile16.c | 55 ++++++++++++++++++++++++++++++++++++++++ dlls/gdi32/mfdrv/init.c | 48 ----------------------------------- 4 files changed, 55 insertions(+), 58 deletions(-) diff --git a/dlls/gdi32/gdi16.c b/dlls/gdi32/gdi16.c index 2f4994869ba..f442d51c8c8 100644 --- a/dlls/gdi32/gdi16.c +++ b/dlls/gdi32/gdi16.c @@ -1601,15 +1601,6 @@ void WINAPI Resurrection16(HDC16 hdc, } -/********************************************************************** - * CreateMetaFile (GDI.125) - */ -HDC16 WINAPI CreateMetaFile16( LPCSTR filename ) -{ - return HDC_16( CreateMetaFileA( filename ) ); -} - - /*********************************************************************** * MulDiv (GDI.128) */ diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index d7f1d9104a0..03c63d44968 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -460,7 +460,6 @@ extern BOOL GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN; /* metafile.c */ extern HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh) DECLSPEC_HIDDEN; -extern HMETAFILE16 MF_Create_HMETAFILE16(METAHEADER *mh) DECLSPEC_HIDDEN; extern METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mr, LPCVOID filename, BOOL unicode ) DECLSPEC_HIDDEN; extern METAHEADER *MF_ReadMetaFile(HANDLE hfile) DECLSPEC_HIDDEN; extern METAHEADER *MF_LoadDiskBasedMetaFile(METAHEADER *mh) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/metafile16.c b/dlls/gdi32/metafile16.c index a8e8ca68005..812fb9cb7fa 100644 --- a/dlls/gdi32/metafile16.c +++ b/dlls/gdi32/metafile16.c @@ -57,6 +57,61 @@ static BOOL16 MF_ReleaseMetaHeader16( HMETAFILE16 hmf ) return GlobalUnlock16( hmf ); } +/****************************************************************** + * MF_Create_HMETATFILE16 + * + * Creates a HMETAFILE16 object from a METAHEADER + * + * HMETAFILE16s are Global memory handles. + */ +static HMETAFILE16 MF_Create_HMETAFILE16(METAHEADER *mh) +{ + HMETAFILE16 hmf; + DWORD size = mh->mtSize * sizeof(WORD); + + hmf = GlobalAlloc16(GMEM_MOVEABLE, size); + if(hmf) + { + METAHEADER *mh_dest = GlobalLock16(hmf); + memcpy(mh_dest, mh, size); + GlobalUnlock16(hmf); + } + HeapFree(GetProcessHeap(), 0, mh); + return hmf; +} + +/********************************************************************** + * CreateMetaFile (GDI.125) + */ +HDC16 WINAPI CreateMetaFile16( LPCSTR filename ) +{ + return HDC_16( CreateMetaFileA( filename ) ); +} + +/****************************************************************** + * CloseMetaFile (GDI.126) + */ +HMETAFILE16 WINAPI CloseMetaFile16(HDC16 hdc) +{ + HMETAFILE16 hmf16 = 0; + HMETAFILE hmf = CloseMetaFile( HDC_32(hdc) ); + + if (hmf) + { + UINT size = GetMetaFileBitsEx( hmf, 0, NULL ); + + hmf16 = GlobalAlloc16( GMEM_MOVEABLE, size ); + if (hmf16) + { + void *buffer = GlobalLock16( hmf16 ); + GetMetaFileBitsEx( hmf, size, buffer ); + GlobalUnlock16( hmf16 ); + } + DeleteMetaFile( hmf ); + } + return hmf16; +} + /****************************************************************** * DeleteMetaFile (GDI.127) */ diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c index a5b18d357fc..b6cf54986e8 100644 --- a/dlls/gdi32/mfdrv/init.c +++ b/dlls/gdi32/mfdrv/init.c @@ -23,8 +23,6 @@ #include "windef.h" #include "winbase.h" -#include "wine/winbase16.h" -#include "wownt32.h" #include "gdi_private.h" #include "mfdrv/metafiledrv.h" #include "wine/debug.h" @@ -353,52 +351,6 @@ static DC *MFDRV_CloseMetaFile( HDC hdc ) return dc; } -/****************************************************************** - * MF_Create_HMETATFILE16 - * - * Creates a HMETAFILE16 object from a METAHEADER - * - * HMETAFILE16s are Global memory handles. - */ -HMETAFILE16 MF_Create_HMETAFILE16(METAHEADER *mh) -{ - HMETAFILE16 hmf; - DWORD size = mh->mtSize * sizeof(WORD); - - hmf = GlobalAlloc16(GMEM_MOVEABLE, size); - if(hmf) - { - METAHEADER *mh_dest = GlobalLock16(hmf); - memcpy(mh_dest, mh, size); - GlobalUnlock16(hmf); - } - HeapFree(GetProcessHeap(), 0, mh); - return hmf; -} - -/****************************************************************** - * CloseMetaFile (GDI.126) - * - * PARAMS - * hdc [I] Metafile DC to close - */ -HMETAFILE16 WINAPI CloseMetaFile16(HDC16 hdc) -{ - HMETAFILE16 hmf; - METAFILEDRV_PDEVICE *physDev; - DC *dc = MFDRV_CloseMetaFile(HDC_32(hdc)); - if (!dc) return 0; - physDev = (METAFILEDRV_PDEVICE *)dc->physDev; - - /* Now allocate a global handle for the metafile */ - - hmf = MF_Create_HMETAFILE16( physDev->mh ); - - physDev->mh = NULL; /* So it won't be deleted */ - MFDRV_DeleteDC( dc ); - return hmf; -} - /****************************************************************** * CloseMetaFile (GDI32.@) *