mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
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:
parent
b79a852fe5
commit
888f16ea6f
1 changed files with 39 additions and 37 deletions
|
@ -1940,55 +1940,57 @@ 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);
|
||||
HDC hdcs = DC_GetNextDC (dc);
|
||||
|
||||
dcs = DC_LockDc (hdcs);
|
||||
if (dcs == NULL)
|
||||
{
|
||||
DC_UnlockDc(dc);
|
||||
return FALSE;
|
||||
}
|
||||
DC_SetNextDC (dcs, DC_GetNextDC (dcs));
|
||||
if (--dc->saveLevel < SaveLevel)
|
||||
{
|
||||
DC_UnlockDc( dc );
|
||||
DC_UnlockDc( dcs );
|
||||
NtGdiSetDCState(hDC, hdcs);
|
||||
#if 0
|
||||
if (!PATH_AssignGdiPath( &dc->w.path, &dcs->w.path ))
|
||||
{
|
||||
/* FIXME: This might not be quite right, since we're
|
||||
* returning FALSE but still destroying the saved DC state */
|
||||
success = FALSE;
|
||||
}
|
||||
#endif
|
||||
dc = DC_LockDc(hDC);
|
||||
if(!dc)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DC_UnlockDc( dcs );
|
||||
}
|
||||
NtGdiDeleteObjectApp (hdcs);
|
||||
dcs = DC_LockDc (hdcs);
|
||||
if (dcs == NULL)
|
||||
{
|
||||
DC_UnlockDc(dc);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DC_SetNextDC (dc, DC_GetNextDC (dcs));
|
||||
dcs->hNext = 0;
|
||||
|
||||
if (--dc->saveLevel < SaveLevel)
|
||||
{
|
||||
DC_UnlockDc( dc );
|
||||
DC_UnlockDc( dcs );
|
||||
|
||||
NtGdiSetDCState(hDC, hdcs);
|
||||
//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;
|
||||
dc = DC_LockDc(hDC);
|
||||
if(!dc)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DC_UnlockDc( dcs );
|
||||
}
|
||||
NtGdiDeleteObjectApp (hdcs);
|
||||
}
|
||||
DC_UnlockDc( dc );
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
INT STDCALL
|
||||
NtGdiSaveDC(HDC hDC)
|
||||
|
|
Loading…
Reference in a new issue