NtGdiRestoreDC

1. fix do not delete all hdc and the restore hdc. 
2. fix calc of SaveLevel the calc are not perfect

we only have 6 fails when we try restore dc now with wine gdi32 test dc 

svn path=/trunk/; revision=24268
This commit is contained in:
Magnus Olsen 2006-09-25 18:50:40 +00:00
parent b79a852fe5
commit 888f16ea6f

View file

@ -1940,16 +1940,16 @@ NtGdiRestoreDC(HDC hDC, INT SaveLevel)
return FALSE;
}
if (SaveLevel == -1)
SaveLevel = dc->saveLevel;
if ((SaveLevel < 1) || (SaveLevel > dc->saveLevel))
if(abs(SaveLevel) > dc->saveLevel || SaveLevel == 0)
{
DC_UnlockDc(dc);
return FALSE;
}
success = TRUE;
/* FIXME this calc are not 100% correct I think ??*/
if (SaveLevel < 0) SaveLevel = dc->saveLevel + SaveLevel + 1;
success=TRUE;
while (dc->saveLevel >= SaveLevel)
{
HDC hdcs = DC_GetNextDC (dc);
@ -1960,20 +1960,21 @@ NtGdiRestoreDC(HDC hDC, INT SaveLevel)
DC_UnlockDc(dc);
return FALSE;
}
DC_SetNextDC (dcs, DC_GetNextDC (dcs));
DC_SetNextDC (dc, DC_GetNextDC (dcs));
dcs->hNext = 0;
if (--dc->saveLevel < SaveLevel)
{
DC_UnlockDc( dc );
DC_UnlockDc( dcs );
NtGdiSetDCState(hDC, hdcs);
#if 0
if (!PATH_AssignGdiPath( &dc->w.path, &dcs->w.path ))
{
//if (!PATH_AssignGdiPath( &dc->path, &dcs->path ))
/* FIXME: This might not be quite right, since we're
* returning FALSE but still destroying the saved DC state */
success = FALSE;
}
#endif
* returning FALSE but still destroying the saved DC state
*/
success=FALSE;
dc = DC_LockDc(hDC);
if(!dc)
{
@ -1990,6 +1991,7 @@ NtGdiRestoreDC(HDC hDC, INT SaveLevel)
return success;
}
INT STDCALL
NtGdiSaveDC(HDC hDC)
{