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