gdi32: Separate EMFDRV_PDEVICE and struct emf.
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
478fa71f5f
commit
7f888ea093
|
@ -19,9 +19,15 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "enhmfdrv/enhmetafiledrv.h"
|
||||
#include "ntgdi_private.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct gdi_physdev dev;
|
||||
INT dev_caps[COLORMGMTCAPS + 1];
|
||||
} EMFDRV_PDEVICE;
|
||||
|
||||
static inline EMFDRV_PDEVICE *get_emf_physdev( PHYSDEV dev )
|
||||
{
|
||||
return CONTAINING_RECORD( dev, EMFDRV_PDEVICE, dev );
|
||||
|
@ -576,7 +582,6 @@ HDC WINAPI NtGdiCreateMetafileDC( HDC hdc )
|
|||
free_dc_ptr( dc );
|
||||
return 0;
|
||||
}
|
||||
dc->attr->emf = physDev;
|
||||
|
||||
push_dc_driver( &dc->physDev, &physDev->dev, &emfdrv_driver );
|
||||
|
||||
|
|
|
@ -31,9 +31,8 @@
|
|||
|
||||
/* Enhanced Metafile driver physical DC */
|
||||
|
||||
typedef struct emf
|
||||
struct emf
|
||||
{
|
||||
struct gdi_physdev dev;
|
||||
ENHMETAHEADER *emh; /* Pointer to enhanced metafile header */
|
||||
DC_ATTR *dc_attr;
|
||||
UINT handles_size, cur_handles;
|
||||
|
@ -42,8 +41,7 @@ typedef struct emf
|
|||
HBRUSH dc_brush;
|
||||
HPEN dc_pen;
|
||||
BOOL path;
|
||||
INT dev_caps[COLORMGMTCAPS + 1];
|
||||
} EMFDRV_PDEVICE;
|
||||
};
|
||||
|
||||
extern BOOL emfdc_record( struct emf *emf, EMR *emr ) DECLSPEC_HIDDEN;
|
||||
extern void emfdc_update_bounds( struct emf *emf, RECTL *rect ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -637,14 +637,14 @@ BOOL EMFDC_ExtTextOut( DC_ATTR *dc_attr, INT x, INT y, UINT flags, const RECT *l
|
|||
|
||||
if (graphicsMode == GM_COMPATIBLE)
|
||||
{
|
||||
const INT horzSize = GetDeviceCaps( emf->dev.hdc, HORZSIZE );
|
||||
const INT horzRes = GetDeviceCaps( emf->dev.hdc, HORZRES );
|
||||
const INT vertSize = GetDeviceCaps( emf->dev.hdc, VERTSIZE );
|
||||
const INT vertRes = GetDeviceCaps( emf->dev.hdc, VERTRES );
|
||||
const INT horzSize = GetDeviceCaps( dc_attr->hdc, HORZSIZE );
|
||||
const INT horzRes = GetDeviceCaps( dc_attr->hdc, HORZRES );
|
||||
const INT vertSize = GetDeviceCaps( dc_attr->hdc, VERTSIZE );
|
||||
const INT vertRes = GetDeviceCaps( dc_attr->hdc, VERTRES );
|
||||
SIZE wndext, vportext;
|
||||
|
||||
GetViewportExtEx( emf->dev.hdc, &vportext );
|
||||
GetWindowExtEx( emf->dev.hdc, &wndext );
|
||||
GetViewportExtEx( dc_attr->hdc, &vportext );
|
||||
GetWindowExtEx( dc_attr->hdc, &wndext );
|
||||
exScale = 100.0 * ((FLOAT)horzSize / (FLOAT)horzRes) /
|
||||
((FLOAT)wndext.cx / (FLOAT)vportext.cx);
|
||||
eyScale = 100.0 * ((FLOAT)vertSize / (FLOAT)vertRes) /
|
||||
|
@ -685,7 +685,7 @@ BOOL EMFDC_ExtTextOut( DC_ATTR *dc_attr, INT x, INT y, UINT flags, const RECT *l
|
|||
for (i = 0; i < count; i++) {
|
||||
textWidth += lpDx[i];
|
||||
}
|
||||
if (GetTextExtentPoint32W( emf->dev.hdc, str, count, &strSize ))
|
||||
if (GetTextExtentPoint32W( dc_attr->hdc, str, count, &strSize ))
|
||||
textHeight = strSize.cy;
|
||||
}
|
||||
else {
|
||||
|
@ -693,7 +693,7 @@ BOOL EMFDC_ExtTextOut( DC_ATTR *dc_attr, INT x, INT y, UINT flags, const RECT *l
|
|||
INT *dx = (INT *)((char*)pemr + pemr->emrtext.offDx);
|
||||
SIZE charSize;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (GetTextExtentPoint32W( emf->dev.hdc, str + i, 1, &charSize )) {
|
||||
if (GetTextExtentPoint32W( dc_attr->hdc, str + i, 1, &charSize )) {
|
||||
dx[i] = charSize.cx;
|
||||
textWidth += charSize.cx;
|
||||
textHeight = max(textHeight, charSize.cy);
|
||||
|
@ -729,7 +729,7 @@ BOOL EMFDC_ExtTextOut( DC_ATTR *dc_attr, INT x, INT y, UINT flags, const RECT *l
|
|||
switch (textAlign & (TA_TOP | TA_BOTTOM | TA_BASELINE)) {
|
||||
case TA_BASELINE: {
|
||||
TEXTMETRICW tm;
|
||||
if (!GetTextMetricsW( emf->dev.hdc, &tm ))
|
||||
if (!GetTextMetricsW( dc_attr->hdc, &tm ))
|
||||
tm.tmDescent = 0;
|
||||
/* Play safe here... it's better to have a bounding box */
|
||||
/* that is too big than too small. */
|
||||
|
|
|
@ -41,7 +41,7 @@ void EMFDC_DeleteDC( DC_ATTR *dc_attr )
|
|||
HeapFree( GetProcessHeap(), 0, emf->emh );
|
||||
for (index = 0; index < emf->handles_size; index++)
|
||||
if (emf->handles[index])
|
||||
GDI_hdc_not_using_object( emf->handles[index], emf->dev.hdc );
|
||||
GDI_hdc_not_using_object( emf->handles[index], dc_attr->hdc );
|
||||
HeapFree( GetProcessHeap(), 0, emf->handles );
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ void emfdc_update_bounds( struct emf *emf, RECTL *rect )
|
|||
RECTL *bounds = &emf->dc_attr->emf_bounds;
|
||||
RECTL vportRect = *rect;
|
||||
|
||||
LPtoDP( emf->dev.hdc, (POINT *)&vportRect, 2 );
|
||||
LPtoDP( emf->dc_attr->hdc, (POINT *)&vportRect, 2 );
|
||||
|
||||
/* The coordinate systems may be mirrored
|
||||
(LPtoDP handles points, not rectangles) */
|
||||
|
@ -173,12 +173,13 @@ HDC WINAPI CreateEnhMetaFileW(
|
|||
|
||||
if (!(ret = NtGdiCreateMetafileDC( hdc ))) return 0;
|
||||
|
||||
if (!(dc_attr = get_dc_attr( ret )))
|
||||
if (!(dc_attr = get_dc_attr( ret )) || !(emf = HeapAlloc( GetProcessHeap(), 0, sizeof(*emf) )))
|
||||
{
|
||||
DeleteDC( ret );
|
||||
return 0;
|
||||
}
|
||||
emf = dc_attr->emf;
|
||||
|
||||
dc_attr->emf = emf;
|
||||
|
||||
if(description) { /* App name\0Title\0\0 */
|
||||
length = lstrlenW(description);
|
||||
|
|
|
@ -284,7 +284,7 @@ static BOOL EMFDC_SelectFont( DC_ATTR *dc_attr, HFONT font )
|
|||
if (!(index = emfdc_find_object( emf, font )))
|
||||
{
|
||||
if (!(index = EMFDRV_CreateFontIndirect( emf, font ))) return FALSE;
|
||||
GDI_hdc_using_object( font, emf->dev.hdc, EMFDC_DeleteObject );
|
||||
GDI_hdc_using_object( font, dc_attr->hdc, EMFDC_DeleteObject );
|
||||
}
|
||||
|
||||
found:
|
||||
|
|
Loading…
Reference in New Issue