Commit 7e67cc99 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Merge enhmetafiledrv.h into emfdc.c.

parent 580099aa
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
#include <assert.h> #include <assert.h>
#include "enhmfdrv/enhmetafiledrv.h" #include "gdi_private.h"
#include "ntgdi_private.h"
#include "winnls.h" #include "winnls.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -30,6 +31,19 @@ ...@@ -30,6 +31,19 @@
WINE_DEFAULT_DEBUG_CHANNEL(enhmetafile); WINE_DEFAULT_DEBUG_CHANNEL(enhmetafile);
struct emf
{
ENHMETAHEADER *emh;
DC_ATTR *dc_attr;
UINT handles_size, cur_handles;
HGDIOBJ *handles;
HANDLE file;
HBRUSH dc_brush;
HPEN dc_pen;
BOOL path;
};
#define HANDLE_LIST_INC 20
static const RECTL empty_bounds = { 0, 0, -1, -1 }; static const RECTL empty_bounds = { 0, 0, -1, -1 };
static BOOL emfdc_record( struct emf *emf, EMR *emr ) static BOOL emfdc_record( struct emf *emf, EMR *emr )
...@@ -1880,7 +1894,7 @@ void EMFDC_DeleteDC( DC_ATTR *dc_attr ) ...@@ -1880,7 +1894,7 @@ void EMFDC_DeleteDC( DC_ATTR *dc_attr )
HeapFree( GetProcessHeap(), 0, emf->emh ); HeapFree( GetProcessHeap(), 0, emf->emh );
for (index = 0; index < emf->handles_size; index++) for (index = 0; index < emf->handles_size; index++)
if (emf->handles[index]) if (emf->handles[index])
GDI_hdc_not_using_object( emf->handles[index], dc_attr->hdc ); GDI_hdc_not_using_object( emf->handles[index], emf->dc_attr->hdc );
HeapFree( GetProcessHeap(), 0, emf->handles ); HeapFree( GetProcessHeap(), 0, emf->handles );
} }
...@@ -1970,6 +1984,7 @@ HDC WINAPI CreateEnhMetaFileW( HDC hdc, const WCHAR *filename, const RECT *rect, ...@@ -1970,6 +1984,7 @@ HDC WINAPI CreateEnhMetaFileW( HDC hdc, const WCHAR *filename, const RECT *rect,
return 0; return 0;
} }
emf->dc_attr = dc_attr;
dc_attr->emf = emf; dc_attr->emf = emf;
if (description) /* App name\0Title\0\0 */ if (description) /* App name\0Title\0\0 */
...@@ -1992,7 +2007,7 @@ HDC WINAPI CreateEnhMetaFileW( HDC hdc, const WCHAR *filename, const RECT *rect, ...@@ -1992,7 +2007,7 @@ HDC WINAPI CreateEnhMetaFileW( HDC hdc, const WCHAR *filename, const RECT *rect,
HANDLE_LIST_INC * sizeof(emf->handles[0]) ); HANDLE_LIST_INC * sizeof(emf->handles[0]) );
emf->handles_size = HANDLE_LIST_INC; emf->handles_size = HANDLE_LIST_INC;
emf->cur_handles = 1; emf->cur_handles = 1;
emf->hFile = 0; emf->file = 0;
emf->dc_brush = 0; emf->dc_brush = 0;
emf->dc_pen = 0; emf->dc_pen = 0;
emf->path = FALSE; emf->path = FALSE;
...@@ -2052,7 +2067,7 @@ HDC WINAPI CreateEnhMetaFileW( HDC hdc, const WCHAR *filename, const RECT *rect, ...@@ -2052,7 +2067,7 @@ HDC WINAPI CreateEnhMetaFileW( HDC hdc, const WCHAR *filename, const RECT *rect,
DeleteDC( ret ); DeleteDC( ret );
return 0; return 0;
} }
emf->hFile = file; emf->file = file;
} }
TRACE( "returning %p\n", ret ); TRACE( "returning %p\n", ret );
...@@ -2103,23 +2118,23 @@ HENHMETAFILE WINAPI CloseEnhMetaFile( HDC hdc ) ...@@ -2103,23 +2118,23 @@ HENHMETAFILE WINAPI CloseEnhMetaFile( HDC hdc )
emf->emh->szlMillimeters.cy * 100 / emf->emh->szlDevice.cy; emf->emh->szlMillimeters.cy * 100 / emf->emh->szlDevice.cy;
} }
if (emf->hFile) /* disk based metafile */ if (emf->file) /* disk based metafile */
{ {
if (!WriteFile( emf->hFile, emf->emh, emf->emh->nBytes, NULL, NULL )) if (!WriteFile( emf->file, emf->emh, emf->emh->nBytes, NULL, NULL ))
{ {
CloseHandle( emf->hFile ); CloseHandle( emf->file );
return 0; return 0;
} }
HeapFree( GetProcessHeap(), 0, emf->emh ); HeapFree( GetProcessHeap(), 0, emf->emh );
mapping = CreateFileMappingA( emf->hFile, NULL, PAGE_READONLY, 0, 0, NULL ); mapping = CreateFileMappingA( emf->file, NULL, PAGE_READONLY, 0, 0, NULL );
TRACE( "mapping = %p\n", mapping ); TRACE( "mapping = %p\n", mapping );
emf->emh = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 ); emf->emh = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, 0 );
TRACE( "view = %p\n", emf->emh ); TRACE( "view = %p\n", emf->emh );
CloseHandle( mapping ); CloseHandle( mapping );
CloseHandle( emf->hFile ); CloseHandle( emf->file );
} }
hmf = EMF_Create_HENHMETAFILE( emf->emh, emf->emh->nBytes, emf->hFile != 0 ); hmf = EMF_Create_HENHMETAFILE( emf->emh, emf->emh->nBytes, emf->file != 0 );
emf->emh = NULL; /* So it won't be deleted */ emf->emh = NULL; /* So it won't be deleted */
DeleteDC( hdc ); DeleteDC( hdc );
return hmf; return hmf;
......
/*
* Enhanced MetaFile driver definitions
*
* Copyright 1999 Huw D M Davies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_ENHMETAFILEDRV_H
#define __WINE_ENHMETAFILEDRV_H
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "ntgdi_private.h"
#include "gdi_private.h"
/* Enhanced Metafile driver physical DC */
struct emf
{
ENHMETAHEADER *emh; /* Pointer to enhanced metafile header */
DC_ATTR *dc_attr;
UINT handles_size, cur_handles;
HGDIOBJ *handles;
HANDLE hFile; /* Handle for disk based MetaFile */
HBRUSH dc_brush;
HPEN dc_pen;
BOOL path;
};
#define HANDLE_LIST_INC 20
#endif /* __WINE_METAFILEDRV_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment