mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 03:24:47 +00:00
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
|
* 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 )
|
static inline EMFDRV_PDEVICE *get_emf_physdev( PHYSDEV dev )
|
||||||
{
|
{
|
||||||
return CONTAINING_RECORD( dev, EMFDRV_PDEVICE, dev );
|
return CONTAINING_RECORD( dev, EMFDRV_PDEVICE, dev );
|
||||||
|
@ -576,7 +582,6 @@ HDC WINAPI NtGdiCreateMetafileDC( HDC hdc )
|
||||||
free_dc_ptr( dc );
|
free_dc_ptr( dc );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
dc->attr->emf = physDev;
|
|
||||||
|
|
||||||
push_dc_driver( &dc->physDev, &physDev->dev, &emfdrv_driver );
|
push_dc_driver( &dc->physDev, &physDev->dev, &emfdrv_driver );
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,8 @@
|
||||||
|
|
||||||
/* Enhanced Metafile driver physical DC */
|
/* Enhanced Metafile driver physical DC */
|
||||||
|
|
||||||
typedef struct emf
|
struct emf
|
||||||
{
|
{
|
||||||
struct gdi_physdev dev;
|
|
||||||
ENHMETAHEADER *emh; /* Pointer to enhanced metafile header */
|
ENHMETAHEADER *emh; /* Pointer to enhanced metafile header */
|
||||||
DC_ATTR *dc_attr;
|
DC_ATTR *dc_attr;
|
||||||
UINT handles_size, cur_handles;
|
UINT handles_size, cur_handles;
|
||||||
|
@ -42,8 +41,7 @@ typedef struct emf
|
||||||
HBRUSH dc_brush;
|
HBRUSH dc_brush;
|
||||||
HPEN dc_pen;
|
HPEN dc_pen;
|
||||||
BOOL path;
|
BOOL path;
|
||||||
INT dev_caps[COLORMGMTCAPS + 1];
|
};
|
||||||
} EMFDRV_PDEVICE;
|
|
||||||
|
|
||||||
extern BOOL emfdc_record( struct emf *emf, EMR *emr ) DECLSPEC_HIDDEN;
|
extern BOOL emfdc_record( struct emf *emf, EMR *emr ) DECLSPEC_HIDDEN;
|
||||||
extern void emfdc_update_bounds( struct emf *emf, RECTL *rect ) 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)
|
if (graphicsMode == GM_COMPATIBLE)
|
||||||
{
|
{
|
||||||
const INT horzSize = GetDeviceCaps( emf->dev.hdc, HORZSIZE );
|
const INT horzSize = GetDeviceCaps( dc_attr->hdc, HORZSIZE );
|
||||||
const INT horzRes = GetDeviceCaps( emf->dev.hdc, HORZRES );
|
const INT horzRes = GetDeviceCaps( dc_attr->hdc, HORZRES );
|
||||||
const INT vertSize = GetDeviceCaps( emf->dev.hdc, VERTSIZE );
|
const INT vertSize = GetDeviceCaps( dc_attr->hdc, VERTSIZE );
|
||||||
const INT vertRes = GetDeviceCaps( emf->dev.hdc, VERTRES );
|
const INT vertRes = GetDeviceCaps( dc_attr->hdc, VERTRES );
|
||||||
SIZE wndext, vportext;
|
SIZE wndext, vportext;
|
||||||
|
|
||||||
GetViewportExtEx( emf->dev.hdc, &vportext );
|
GetViewportExtEx( dc_attr->hdc, &vportext );
|
||||||
GetWindowExtEx( emf->dev.hdc, &wndext );
|
GetWindowExtEx( dc_attr->hdc, &wndext );
|
||||||
exScale = 100.0 * ((FLOAT)horzSize / (FLOAT)horzRes) /
|
exScale = 100.0 * ((FLOAT)horzSize / (FLOAT)horzRes) /
|
||||||
((FLOAT)wndext.cx / (FLOAT)vportext.cx);
|
((FLOAT)wndext.cx / (FLOAT)vportext.cx);
|
||||||
eyScale = 100.0 * ((FLOAT)vertSize / (FLOAT)vertRes) /
|
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++) {
|
for (i = 0; i < count; i++) {
|
||||||
textWidth += lpDx[i];
|
textWidth += lpDx[i];
|
||||||
}
|
}
|
||||||
if (GetTextExtentPoint32W( emf->dev.hdc, str, count, &strSize ))
|
if (GetTextExtentPoint32W( dc_attr->hdc, str, count, &strSize ))
|
||||||
textHeight = strSize.cy;
|
textHeight = strSize.cy;
|
||||||
}
|
}
|
||||||
else {
|
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);
|
INT *dx = (INT *)((char*)pemr + pemr->emrtext.offDx);
|
||||||
SIZE charSize;
|
SIZE charSize;
|
||||||
for (i = 0; i < count; i++) {
|
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;
|
dx[i] = charSize.cx;
|
||||||
textWidth += charSize.cx;
|
textWidth += charSize.cx;
|
||||||
textHeight = max(textHeight, charSize.cy);
|
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)) {
|
switch (textAlign & (TA_TOP | TA_BOTTOM | TA_BASELINE)) {
|
||||||
case TA_BASELINE: {
|
case TA_BASELINE: {
|
||||||
TEXTMETRICW tm;
|
TEXTMETRICW tm;
|
||||||
if (!GetTextMetricsW( emf->dev.hdc, &tm ))
|
if (!GetTextMetricsW( dc_attr->hdc, &tm ))
|
||||||
tm.tmDescent = 0;
|
tm.tmDescent = 0;
|
||||||
/* Play safe here... it's better to have a bounding box */
|
/* Play safe here... it's better to have a bounding box */
|
||||||
/* that is too big than too small. */
|
/* that is too big than too small. */
|
||||||
|
|
|
@ -41,7 +41,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], emf->dev.hdc );
|
GDI_hdc_not_using_object( emf->handles[index], dc_attr->hdc );
|
||||||
HeapFree( GetProcessHeap(), 0, emf->handles );
|
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 *bounds = &emf->dc_attr->emf_bounds;
|
||||||
RECTL vportRect = *rect;
|
RECTL vportRect = *rect;
|
||||||
|
|
||||||
LPtoDP( emf->dev.hdc, (POINT *)&vportRect, 2 );
|
LPtoDP( emf->dc_attr->hdc, (POINT *)&vportRect, 2 );
|
||||||
|
|
||||||
/* The coordinate systems may be mirrored
|
/* The coordinate systems may be mirrored
|
||||||
(LPtoDP handles points, not rectangles) */
|
(LPtoDP handles points, not rectangles) */
|
||||||
|
@ -173,12 +173,13 @@ HDC WINAPI CreateEnhMetaFileW(
|
||||||
|
|
||||||
if (!(ret = NtGdiCreateMetafileDC( hdc ))) return 0;
|
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 );
|
DeleteDC( ret );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
emf = dc_attr->emf;
|
|
||||||
|
dc_attr->emf = emf;
|
||||||
|
|
||||||
if(description) { /* App name\0Title\0\0 */
|
if(description) { /* App name\0Title\0\0 */
|
||||||
length = lstrlenW(description);
|
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 = emfdc_find_object( emf, font )))
|
||||||
{
|
{
|
||||||
if (!(index = EMFDRV_CreateFontIndirect( emf, font ))) return FALSE;
|
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:
|
found:
|
||||||
|
|
Loading…
Reference in a new issue