gdi32: Store mapper flags in DC_ATTR.

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:
Jacek Caban 2021-08-05 11:26:43 +02:00 committed by Alexandre Julliard
parent f37e4ff931
commit 6cb07a716c
12 changed files with 28 additions and 35 deletions

View File

@ -93,7 +93,7 @@ static void set_initial_dc_state( DC *dc )
dc->attr->text_color = RGB( 0, 0, 0 );
dc->attr->brush_org.x = 0;
dc->attr->brush_org.y = 0;
dc->mapperFlags = 0;
dc->attr->mapper_flags = 0;
dc->attr->text_align = TA_LEFT | TA_TOP | TA_NOUPDATECP;
dc->attr->char_extra = 0;
dc->breakExtra = 0;
@ -411,8 +411,8 @@ BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level )
dc->attr->brush_color = dcs->attr->brush_color;
dc->attr->pen_color = dcs->attr->pen_color;
dc->attr->brush_org = dcs->attr->brush_org;
dc->mapperFlags = dcs->mapperFlags;
dc->attr->text_align = dcs->attr->text_align;
dc->attr->mapper_flags = dcs->attr->mapper_flags;
dc->attr->text_align = dcs->attr->text_align;
dc->attr->char_extra = dcs->attr->char_extra;
dc->breakExtra = dcs->breakExtra;
dc->breakRem = dcs->breakRem;
@ -544,7 +544,6 @@ INT WINAPI NtGdiSaveDC( HDC hdc )
newdc->hFont = dc->hFont;
newdc->hBitmap = dc->hBitmap;
newdc->hPalette = dc->hPalette;
newdc->mapperFlags = dc->mapperFlags;
newdc->breakExtra = dc->breakExtra;
newdc->breakRem = dc->breakRem;
newdc->xformWorld2Wnd = dc->xformWorld2Wnd;

View File

@ -443,7 +443,7 @@ BOOL CDECL EMFDRV_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt )
return ret;
}
DWORD CDECL EMFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags )
BOOL EMFDC_SetMapperFlags( DC_ATTR *dc_attr, DWORD flags )
{
EMRSETMAPPERFLAGS emr;
@ -451,7 +451,7 @@ DWORD CDECL EMFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags )
emr.emr.nSize = sizeof(emr);
emr.dwFlags = flags;
return EMFDRV_WriteRecord( dev, &emr.emr ) ? flags : GDI_ERROR;
return EMFDRV_WriteRecord( dc_attr->emf, &emr.emr );
}
BOOL EMFDC_AbortPath( DC_ATTR *dc_attr )

View File

@ -115,7 +115,6 @@ extern INT CDECL EMFDRV_SetDIBitsToDevice( PHYSDEV dev, INT xDest, INT yDes
INT ySrc, UINT startscan, UINT lines, LPCVOID bits,
BITMAPINFO *info, UINT coloruse ) DECLSPEC_HIDDEN;
extern DWORD CDECL EMFDRV_SetLayout( PHYSDEV dev, DWORD layout ) DECLSPEC_HIDDEN;
extern DWORD CDECL EMFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags ) DECLSPEC_HIDDEN;
extern COLORREF CDECL EMFDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF CDECL EMFDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern BOOL CDECL EMFDRV_SetViewportExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN;

View File

@ -131,7 +131,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
NULL, /* pSetDeviceGammaRamp */
EMFDRV_SetLayout, /* pSetLayout */
NULL, /* pSetMapMode */
EMFDRV_SetMapperFlags, /* pSetMapperFlags */
NULL, /* pSetMapperFlags */
EMFDRV_SetPixel, /* pSetPixel */
NULL, /* pSetTextCharacterExtra */
EMFDRV_SetTextColor, /* pSetTextColor */

View File

@ -6311,28 +6311,6 @@ BOOL WINAPI PolyTextOutW( HDC hdc, const POLYTEXTW *pptxt, INT cStrings )
}
/***********************************************************************
* SetMapperFlags (GDI32.@)
*/
DWORD WINAPI SetMapperFlags( HDC hdc, DWORD flags )
{
DC *dc = get_dc_ptr( hdc );
DWORD ret = GDI_ERROR;
if (dc)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetMapperFlags );
flags = physdev->funcs->pSetMapperFlags( physdev, flags );
if (flags != GDI_ERROR)
{
ret = dc->mapperFlags;
dc->mapperFlags = flags;
}
release_dc_ptr( dc );
}
return ret;
}
/***********************************************************************
* GetAspectRatioFilterEx (GDI32.@)
*/

View File

@ -78,6 +78,7 @@ extern BOOL METADC_SaveDC( HDC hdc ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetBkMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetTextCharacterExtra( HDC hdc, INT extra ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetMapMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetMapperFlags( HDC hdc, DWORD flags ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetPixel( HDC hdc, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetPolyFillMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetRelAbs( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
@ -137,6 +138,7 @@ extern BOOL EMFDC_SaveDC( DC_ATTR *dc_attr ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetArcDirection( DC_ATTR *dc_attr, INT dir ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetBkMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetMapMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetMapperFlags( DC_ATTR *dc_attr, DWORD flags ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetPixel( DC_ATTR *dc_attr, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetPolyFillMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetROP2( DC_ATTR *dc_attr, INT rop ) DECLSPEC_HIDDEN;

View File

@ -329,6 +329,22 @@ INT WINAPI SetTextCharacterExtra( HDC hdc, INT extra )
return ret;
}
/***********************************************************************
* SetMapperFlags (GDI32.@)
*/
DWORD WINAPI SetMapperFlags( HDC hdc, DWORD flags )
{
DC_ATTR *dc_attr;
DWORD ret;
if (is_meta_dc( hdc )) return METADC_SetMapperFlags( hdc, flags );
if (!(dc_attr = get_dc_attr( hdc ))) return GDI_ERROR;
if (dc_attr->emf && !EMFDC_SetMapperFlags( dc_attr, flags )) return GDI_ERROR;
ret = dc_attr->mapper_flags;
dc_attr->mapper_flags = flags;
return ret;
}
/***********************************************************************
* GetPolyFillMode (GDI32.@)
*/

View File

@ -145,9 +145,9 @@ BOOL METADC_SetTextCharacterExtra( HDC hdc, INT extra )
return metadc_param1( hdc, META_SETTEXTCHAREXTRA, extra );
}
DWORD CDECL MFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags )
BOOL METADC_SetMapperFlags( HDC hdc, DWORD flags )
{
return MFDRV_MetaParam2( dev, META_SETMAPPERFLAGS, HIWORD(flags), LOWORD(flags) ) ? flags : GDI_ERROR;
return metadc_param2( hdc, META_SETMAPPERFLAGS, HIWORD(flags), LOWORD(flags) );
}
BOOL CDECL MFDRV_AbortPath( PHYSDEV dev )

View File

@ -196,7 +196,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
NULL, /* pSetDeviceGammaRamp */
MFDRV_SetLayout, /* pSetLayout */
NULL, /* pSetMapMode */
MFDRV_SetMapperFlags, /* pSetMapperFlags */
NULL, /* pSetMapperFlags */
NULL, /* pSetPixel */
NULL, /* pSetTextCharacterExtra */
MFDRV_SetTextColor, /* pSetTextColor */

View File

@ -104,7 +104,6 @@ extern COLORREF CDECL MFDRV_SetBkColor( PHYSDEV dev, COLORREF color ) DECLSPEC_H
extern COLORREF CDECL MFDRV_SetDCBrushColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF CDECL MFDRV_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern DWORD CDECL MFDRV_SetLayout( PHYSDEV dev, DWORD layout ) DECLSPEC_HIDDEN;
extern DWORD CDECL MFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags ) DECLSPEC_HIDDEN;
extern COLORREF CDECL MFDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_SetViewportExtEx( PHYSDEV dev, INT x, INT y, SIZE *size ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;

View File

@ -110,7 +110,6 @@ typedef struct tagDC
const struct font_gamma_ramp *font_gamma_ramp;
UINT font_code_page;
DWORD mapperFlags; /* Font mapper flags */
INT breakExtra; /* breakTotalExtra / breakCount */
INT breakRem; /* breakTotalExtra % breakCount */
ABORTPROC pAbortProc; /* AbortProc for Printing */

View File

@ -126,6 +126,7 @@ typedef struct DC_ATTR
WORD stretch_blt_mode;
INT map_mode;
INT char_extra;
DWORD mapper_flags; /* font mapper flags */
RECT vis_rect; /* visible rectangle in screen coords */
FLOAT miter_limit;
POINT brush_org; /* brush origin */