gdi32: Store save level 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-17 11:37:21 +02:00 committed by Alexandre Julliard
parent a3efdeeb17
commit 8eab13f397
5 changed files with 10 additions and 10 deletions

View File

@ -404,10 +404,10 @@ BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level )
/* find the state level to restore */
if (abs(level) > dc->saveLevel || level == 0) return FALSE;
if (level < 0) level = dc->saveLevel + level + 1;
if (abs(level) > dc->attr->save_level || level == 0) return FALSE;
if (level < 0) level = dc->attr->save_level + level + 1;
first_dcs = dc->saved_dc;
for (dcs = first_dcs, save_level = dc->saveLevel; save_level > level; save_level--)
for (dcs = first_dcs, save_level = dc->attr->save_level; save_level > level; save_level--)
dcs = dcs->saved_dc;
/* restore the state */
@ -478,7 +478,7 @@ BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level )
dc->saved_dc = dcs->saved_dc;
dcs->saved_dc = 0;
dc->saveLevel = save_level - 1;
dc->attr->save_level = save_level - 1;
/* now destroy all the saved DCs */
@ -524,7 +524,7 @@ static BOOL reset_dc_state( HDC hdc )
free_dc_state( dcs );
}
dc->saved_dc = NULL;
dc->saveLevel = 0;
dc->attr->save_level = 0;
release_dc_ptr( dc );
return TRUE;
}
@ -587,7 +587,7 @@ INT WINAPI NtGdiSaveDC( HDC hdc )
newdc->saved_dc = dc->saved_dc;
dc->saved_dc = newdc;
ret = ++dc->saveLevel;
ret = ++dc->attr->save_level;
release_dc_ptr( dc );
return ret;
}

View File

@ -44,7 +44,7 @@ BOOL CDECL EMFDRV_RestoreDC( PHYSDEV dev, INT level )
if (level < 0)
emr.iRelative = level;
else
emr.iRelative = level - dc->saveLevel - 1;
emr.iRelative = level - dc->attr->save_level - 1;
physDev->restoring++;
ret = next->funcs->pRestoreDC( next, level );

View File

@ -439,8 +439,8 @@ HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc) /* [in] metafile DC */
}
physDev = get_emf_physdev( find_dc_driver( dc, &emfdrv_driver ));
if(dc->saveLevel)
RestoreDC(hdc, 1);
if (dc->attr->save_level)
RestoreDC( hdc, 1 );
if (physDev->dc_brush) DeleteObject( physDev->dc_brush );
if (physDev->dc_pen) DeleteObject( physDev->dc_pen );

View File

@ -72,7 +72,6 @@ typedef struct tagDC
DWORD thread; /* thread owning the DC */
LONG refcount; /* thread refcount */
LONG dirty; /* dirty flag */
INT saveLevel;
DC_ATTR *attr; /* DC attributes accessible by client */
struct tagDC *saved_dc;
DWORD_PTR dwHookData;

View File

@ -127,6 +127,7 @@ typedef struct DC_ATTR
{
HDC hdc; /* handle to self */
LONG disabled; /* disabled flag, controled by DCHF_(DISABLE|ENABLE)DC */
int save_level;
COLORREF background_color;
COLORREF brush_color;
COLORREF pen_color;