mirror of
https://github.com/reactos/wine.git
synced 2025-02-28 08:46:31 +00:00
Removed enhmetafile.h. Simplified ENHMETAFILEOBJ structure a bit.
This commit is contained in:
parent
5f728cae70
commit
e6c0642e79
@ -10,7 +10,6 @@
|
|||||||
#include "wingdi.h"
|
#include "wingdi.h"
|
||||||
#include "gdi.h"
|
#include "gdi.h"
|
||||||
#include "heap.h"
|
#include "heap.h"
|
||||||
#include "enhmetafile.h"
|
|
||||||
#include "enhmetafiledrv.h"
|
#include "enhmetafiledrv.h"
|
||||||
#include "debugtools.h"
|
#include "debugtools.h"
|
||||||
|
|
||||||
@ -378,13 +377,17 @@ HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc) /* [in] metafile DC */
|
|||||||
|
|
||||||
if (physDev->hFile) /* disk based metafile */
|
if (physDev->hFile) /* disk based metafile */
|
||||||
{
|
{
|
||||||
if (SetFilePointer(physDev->hFile, 0, NULL, FILE_BEGIN) != 0) {
|
if (SetFilePointer(physDev->hFile, 0, NULL, FILE_BEGIN) != 0)
|
||||||
|
{
|
||||||
|
CloseHandle( physDev->hFile );
|
||||||
EMFDRV_DeleteDC( dc );
|
EMFDRV_DeleteDC( dc );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!WriteFile(physDev->hFile, (LPSTR)physDev->emh,
|
if (!WriteFile(physDev->hFile, (LPSTR)physDev->emh,
|
||||||
sizeof(*physDev->emh), NULL, NULL)) {
|
sizeof(*physDev->emh), NULL, NULL))
|
||||||
|
{
|
||||||
|
CloseHandle( physDev->hFile );
|
||||||
EMFDRV_DeleteDC( dc );
|
EMFDRV_DeleteDC( dc );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -394,13 +397,12 @@ HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc) /* [in] metafile DC */
|
|||||||
TRACE("hMapping = %08x\n", hMapping );
|
TRACE("hMapping = %08x\n", hMapping );
|
||||||
physDev->emh = MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, 0);
|
physDev->emh = MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, 0);
|
||||||
TRACE("view = %p\n", physDev->emh );
|
TRACE("view = %p\n", physDev->emh );
|
||||||
|
CloseHandle( hMapping );
|
||||||
|
CloseHandle( physDev->hFile );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hmf = EMF_Create_HENHMETAFILE( physDev->emh, (physDev->hFile != 0) );
|
||||||
hmf = EMF_Create_HENHMETAFILE( physDev->emh, physDev->hFile, hMapping );
|
|
||||||
physDev->emh = NULL; /* So it won't be deleted */
|
physDev->emh = NULL; /* So it won't be deleted */
|
||||||
EMFDRV_DeleteDC( dc );
|
EMFDRV_DeleteDC( dc );
|
||||||
return hmf;
|
return hmf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* Enhanced Metafile definitions
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __WINE_ENHMETAFILE_H
|
|
||||||
#define __WINE_ENHMETAFILE_H
|
|
||||||
|
|
||||||
#include "gdi.h"
|
|
||||||
#include "windef.h"
|
|
||||||
#include "wingdi.h"
|
|
||||||
|
|
||||||
/* GDI32 enhanced metafile object */
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
GDIOBJHDR header;
|
|
||||||
ENHMETAHEADER *emh;
|
|
||||||
HFILE hFile; /* File handle if EMF is disk-based */
|
|
||||||
HANDLE hMapping; /* Mapping handle if EMF is disk-based */
|
|
||||||
} ENHMETAFILEOBJ;
|
|
||||||
|
|
||||||
|
|
||||||
extern HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, HFILE hFile,
|
|
||||||
HANDLE hMapping);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __WINE_ENHMETAFILE_H */
|
|
||||||
|
|
@ -589,4 +589,7 @@ INT CLIPPING_IntersectVisRect( DC * dc, INT left, INT top,
|
|||||||
INT right, INT bottom, BOOL exclude );
|
INT right, INT bottom, BOOL exclude );
|
||||||
extern void CLIPPING_UpdateGCRegion( DC * dc );
|
extern void CLIPPING_UpdateGCRegion( DC * dc );
|
||||||
|
|
||||||
|
/* objects/enhmetafile.c */
|
||||||
|
extern HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk );
|
||||||
|
|
||||||
#endif /* __WINE_GDI_H */
|
#endif /* __WINE_GDI_H */
|
||||||
|
@ -22,27 +22,31 @@
|
|||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "wingdi.h"
|
#include "wingdi.h"
|
||||||
#include "winerror.h"
|
#include "winerror.h"
|
||||||
#include "enhmetafile.h"
|
|
||||||
#include "debugtools.h"
|
#include "debugtools.h"
|
||||||
#include "heap.h"
|
|
||||||
#include "metafile.h"
|
#include "metafile.h"
|
||||||
|
|
||||||
DEFAULT_DEBUG_CHANNEL(enhmetafile);
|
DEFAULT_DEBUG_CHANNEL(enhmetafile);
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
GDIOBJHDR header;
|
||||||
|
ENHMETAHEADER *emh;
|
||||||
|
BOOL on_disk; /* true if metafile is on disk */
|
||||||
|
} ENHMETAFILEOBJ;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* EMF_Create_HENHMETAFILE
|
* EMF_Create_HENHMETAFILE
|
||||||
*/
|
*/
|
||||||
HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, HFILE hFile, HANDLE
|
HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk )
|
||||||
hMapping )
|
|
||||||
{
|
{
|
||||||
HENHMETAFILE hmf = 0;
|
HENHMETAFILE hmf = 0;
|
||||||
ENHMETAFILEOBJ *metaObj = GDI_AllocObject( sizeof(ENHMETAFILEOBJ),
|
ENHMETAFILEOBJ *metaObj = GDI_AllocObject( sizeof(ENHMETAFILEOBJ),
|
||||||
ENHMETAFILE_MAGIC, &hmf );
|
ENHMETAFILE_MAGIC, &hmf );
|
||||||
if (metaObj)
|
if (metaObj)
|
||||||
{
|
{
|
||||||
metaObj->emh = emh;
|
metaObj->emh = emh;
|
||||||
metaObj->hFile = hFile;
|
metaObj->on_disk = on_disk;
|
||||||
metaObj->hMapping = hMapping;
|
|
||||||
GDI_ReleaseObj( hmf );
|
GDI_ReleaseObj( hmf );
|
||||||
}
|
}
|
||||||
return hmf;
|
return hmf;
|
||||||
@ -56,11 +60,10 @@ static BOOL EMF_Delete_HENHMETAFILE( HENHMETAFILE hmf )
|
|||||||
ENHMETAFILEOBJ *metaObj = (ENHMETAFILEOBJ *)GDI_GetObjPtr( hmf,
|
ENHMETAFILEOBJ *metaObj = (ENHMETAFILEOBJ *)GDI_GetObjPtr( hmf,
|
||||||
ENHMETAFILE_MAGIC );
|
ENHMETAFILE_MAGIC );
|
||||||
if(!metaObj) return FALSE;
|
if(!metaObj) return FALSE;
|
||||||
if(metaObj->hMapping) {
|
|
||||||
|
if(metaObj->on_disk)
|
||||||
UnmapViewOfFile( metaObj->emh );
|
UnmapViewOfFile( metaObj->emh );
|
||||||
CloseHandle( metaObj->hMapping );
|
else
|
||||||
CloseHandle( metaObj->hFile );
|
|
||||||
} else
|
|
||||||
HeapFree( GetProcessHeap(), 0, metaObj->emh );
|
HeapFree( GetProcessHeap(), 0, metaObj->emh );
|
||||||
return GDI_FreeObject( hmf, metaObj );
|
return GDI_FreeObject( hmf, metaObj );
|
||||||
}
|
}
|
||||||
@ -100,15 +103,17 @@ static HENHMETAFILE EMF_GetEnhMetaFile( HANDLE hFile )
|
|||||||
|
|
||||||
hMapping = CreateFileMappingA( hFile, NULL, PAGE_READONLY, 0, 0, NULL );
|
hMapping = CreateFileMappingA( hFile, NULL, PAGE_READONLY, 0, 0, NULL );
|
||||||
emh = MapViewOfFile( hMapping, FILE_MAP_READ, 0, 0, 0 );
|
emh = MapViewOfFile( hMapping, FILE_MAP_READ, 0, 0, 0 );
|
||||||
|
CloseHandle( hMapping );
|
||||||
|
|
||||||
|
if (!emh) return 0;
|
||||||
|
|
||||||
if (emh->iType != EMR_HEADER || emh->dSignature != ENHMETA_SIGNATURE) {
|
if (emh->iType != EMR_HEADER || emh->dSignature != ENHMETA_SIGNATURE) {
|
||||||
WARN("Invalid emf header type 0x%08lx sig 0x%08lx.\n",
|
WARN("Invalid emf header type 0x%08lx sig 0x%08lx.\n",
|
||||||
emh->iType, emh->dSignature);
|
emh->iType, emh->dSignature);
|
||||||
UnmapViewOfFile( emh );
|
UnmapViewOfFile( emh );
|
||||||
CloseHandle( hMapping );
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return EMF_Create_HENHMETAFILE( emh, hFile, hMapping );
|
return EMF_Create_HENHMETAFILE( emh, TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -131,8 +136,7 @@ HENHMETAFILE WINAPI GetEnhMetaFileA(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
hmf = EMF_GetEnhMetaFile( hFile );
|
hmf = EMF_GetEnhMetaFile( hFile );
|
||||||
if(!hmf)
|
CloseHandle( hFile );
|
||||||
CloseHandle( hFile );
|
|
||||||
return hmf;
|
return hmf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,8 +156,7 @@ HENHMETAFILE WINAPI GetEnhMetaFileW(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
hmf = EMF_GetEnhMetaFile( hFile );
|
hmf = EMF_GetEnhMetaFile( hFile );
|
||||||
if(!hmf)
|
CloseHandle( hFile );
|
||||||
CloseHandle( hFile );
|
|
||||||
return hmf;
|
return hmf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +264,7 @@ HENHMETAFILE WINAPI SetEnhMetaFileBits(UINT bufsize, const BYTE *buf)
|
|||||||
{
|
{
|
||||||
ENHMETAHEADER *emh = HeapAlloc( GetProcessHeap(), 0, bufsize );
|
ENHMETAHEADER *emh = HeapAlloc( GetProcessHeap(), 0, bufsize );
|
||||||
memmove(emh, buf, bufsize);
|
memmove(emh, buf, bufsize);
|
||||||
return EMF_Create_HENHMETAFILE( emh, 0, 0 );
|
return EMF_Create_HENHMETAFILE( emh, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -1701,13 +1704,14 @@ HENHMETAFILE WINAPI CopyEnhMetaFileA(
|
|||||||
if (!file) {
|
if (!file) {
|
||||||
emrDst = HeapAlloc( GetProcessHeap(), 0, emrSrc->nBytes );
|
emrDst = HeapAlloc( GetProcessHeap(), 0, emrSrc->nBytes );
|
||||||
memcpy( emrDst, emrSrc, emrSrc->nBytes );
|
memcpy( emrDst, emrSrc, emrSrc->nBytes );
|
||||||
hmfDst = EMF_Create_HENHMETAFILE( emrDst, 0, 0 );
|
hmfDst = EMF_Create_HENHMETAFILE( emrDst, FALSE );
|
||||||
} else {
|
} else {
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
hFile = CreateFileA( file, GENERIC_WRITE | GENERIC_READ, 0, NULL,
|
hFile = CreateFileA( file, GENERIC_WRITE | GENERIC_READ, 0, NULL,
|
||||||
CREATE_ALWAYS, 0, 0);
|
CREATE_ALWAYS, 0, 0);
|
||||||
WriteFile( hFile, emrSrc, emrSrc->nBytes, 0, 0);
|
WriteFile( hFile, emrSrc, emrSrc->nBytes, 0, 0);
|
||||||
hmfDst = EMF_GetEnhMetaFile( hFile );
|
hmfDst = EMF_GetEnhMetaFile( hFile );
|
||||||
|
CloseHandle( hFile );
|
||||||
}
|
}
|
||||||
EMF_ReleaseEnhMetaHeader( hmfSrc );
|
EMF_ReleaseEnhMetaHeader( hmfSrc );
|
||||||
return hmfDst;
|
return hmfDst;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user