gdi32: Store poly fill mode 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-07-29 13:22:00 +01:00 committed by Alexandre Julliard
parent 9e8a308f68
commit 22f7e39fb7
7 changed files with 20 additions and 28 deletions

View File

@ -83,8 +83,8 @@ static void set_initial_dc_state( DC *dc )
dc->attr->layout = 0;
dc->font_code_page = CP_ACP;
dc->attr->rop_mode = R2_COPYPEN;
dc->polyFillMode = ALTERNATE;
dc->stretchBltMode = BLACKONWHITE;
dc->attr->poly_fill_mode = ALTERNATE;
dc->stretchBltMode = BLACKONWHITE;
dc->attr->rel_abs_mode = ABSOLUTE;
dc->attr->background_mode = OPAQUE;
dc->attr->background_color = RGB( 255, 255, 255 );
@ -398,8 +398,6 @@ INT CDECL nulldrv_SaveDC( PHYSDEV dev )
newdc->hFont = dc->hFont;
newdc->hBitmap = dc->hBitmap;
newdc->hPalette = dc->hPalette;
newdc->polyFillMode = dc->polyFillMode;
newdc->stretchBltMode = dc->stretchBltMode;
newdc->dcBrushColor = dc->dcBrushColor;
newdc->dcPenColor = dc->dcPenColor;
newdc->brush_org = dc->brush_org;
@ -467,7 +465,7 @@ BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level )
dc->attr->layout = dcs->attr->layout;
dc->attr->rop_mode = dcs->attr->rop_mode;
dc->polyFillMode = dcs->polyFillMode;
dc->attr->poly_fill_mode = dcs->attr->poly_fill_mode;
dc->stretchBltMode = dcs->stretchBltMode;
dc->attr->rel_abs_mode = dcs->attr->rel_abs_mode;
dc->attr->background_mode = dcs->attr->background_mode;
@ -1394,22 +1392,6 @@ UINT WINAPI SetBoundsRect(HDC hdc, const RECT* rect, UINT flags)
}
/***********************************************************************
* GetPolyFillMode (GDI32.@)
*/
INT WINAPI GetPolyFillMode( HDC hdc )
{
INT ret = 0;
DC * dc = get_dc_ptr( hdc );
if (dc)
{
ret = dc->polyFillMode;
release_dc_ptr( dc );
}
return ret;
}
/***********************************************************************
* SetPolyFillMode (GDI32.@)
*/
@ -1429,8 +1411,8 @@ INT WINAPI SetPolyFillMode( HDC hdc, INT mode )
mode = physdev->funcs->pSetPolyFillMode( physdev, mode );
if (mode)
{
ret = dc->polyFillMode;
dc->polyFillMode = mode;
ret = dc->attr->poly_fill_mode;
dc->attr->poly_fill_mode = mode;
}
release_dc_ptr( dc );
}

View File

@ -1271,7 +1271,8 @@ BOOL CDECL dibdrv_PolyPolygon( PHYSDEV dev, const POINT *pt, const INT *counts,
if (pdev->brush.style != BS_NULL &&
get_dib_rect( &pdev->dib, &rc ) &&
!(interior = create_polypolygon_region( points, counts, polygons, dc->polyFillMode, &rc )))
!(interior = create_polypolygon_region( points, counts, polygons,
dc->attr->poly_fill_mode, &rc )))
{
ret = FALSE;
goto done;

View File

@ -164,6 +164,15 @@ DWORD WINAPI GetLayout( HDC hdc )
return dc_attr ? dc_attr->layout : GDI_ERROR;
}
/***********************************************************************
* GetPolyFillMode (GDI32.@)
*/
INT WINAPI GetPolyFillMode( HDC hdc )
{
DC_ATTR *dc_attr = get_dc_attr( hdc );
return dc_attr ? dc_attr->poly_fill_mode : 0;
}
/***********************************************************************
* GetCurrentPositionEx (GDI32.@)
*/

View File

@ -116,7 +116,6 @@ typedef struct tagDC
const struct font_gamma_ramp *font_gamma_ramp;
UINT font_code_page;
WORD polyFillMode;
WORD stretchBltMode;
COLORREF dcBrushColor;
COLORREF dcPenColor;

View File

@ -537,7 +537,7 @@ struct gdi_path *get_gdi_flat_path( DC *dc, HRGN *rgn )
free_gdi_path( dc->path );
dc->path = NULL;
if (ret && rgn) *rgn = path_to_region( ret, dc->polyFillMode );
if (ret && rgn) *rgn = path_to_region( ret, dc->attr->poly_fill_mode );
}
else SetLastError( ERROR_CAN_NOT_COMPLETE );
@ -684,7 +684,7 @@ HRGN WINAPI PathToRegion(HDC hdc)
dc->path = NULL;
if (path)
{
ret = path_to_region( path, dc->polyFillMode );
ret = path_to_region( path, dc->attr->poly_fill_mode );
free_gdi_path( path );
}
}

View File

@ -900,7 +900,7 @@ static void test_mf_SaveDC(void)
SetPolyFillMode( hdcMetafile, WINDING );
SetBkColor( hdcMetafile, 0x123456 );
todo_wine ok( !GetPolyFillMode( hdcMetafile ), "GetPolyFillMode succeeded\n" );
ok( !GetPolyFillMode( hdcMetafile ), "GetPolyFillMode succeeded\n" );
ok( GetBkColor( hdcMetafile ) == CLR_INVALID, "GetBkColor succeeded\n" );
/* Force Win9x to update DC state */

View File

@ -107,6 +107,7 @@ typedef struct DC_ATTR
DWORD layout;
WORD text_align;
WORD background_mode;
WORD poly_fill_mode;
WORD rop_mode;
WORD rel_abs_mode;
void *emf;