patch from : Paolo Devoti (email devotip at tiscali dot it)

-----------------------------------------------------------
Fixed right hdc being save/restore , the #if 0 change was not accpected. 
the code works fine without it. it was problare cause by another bug.
all wine test for gdi32_winetest dc pass now, without any foualt. 
See issue #2055 for more details.

svn path=/trunk/; revision=27768
This commit is contained in:
Magnus Olsen 2007-07-21 18:41:06 +00:00
parent e54ea177eb
commit cf0aabe39c

View file

@ -1811,42 +1811,44 @@ NtGdiRestoreDC(HDC hDC, INT SaveLevel)
return FALSE; return FALSE;
} }
if(abs(SaveLevel) > dc->saveLevel || SaveLevel == 0) if (SaveLevel < 0)
SaveLevel = dc->saveLevel + SaveLevel + 1;
if(SaveLevel < 0 || dc->saveLevel<SaveLevel)
{ {
DC_UnlockDc(dc); DC_UnlockDc(dc);
return FALSE; return FALSE;
} }
/* FIXME this calc are not 100% correct I think ??*/
if (SaveLevel < 0) SaveLevel = dc->saveLevel + SaveLevel + 1;
success=TRUE; success=TRUE;
while (dc->saveLevel >= SaveLevel) while (dc->saveLevel >= SaveLevel)
{ {
HDC hdcs = DC_GetNextDC (dc); HDC hdcs = DC_GetNextDC (dc);
dcs = DC_LockDc (hdcs); dcs = DC_LockDc (hdcs);
if (dcs == NULL) if (dcs == NULL)
{ {
DC_UnlockDc(dc); DC_UnlockDc(dc);
return FALSE; return FALSE;
} }
DC_SetNextDC (dc, DC_GetNextDC (dcs)); DC_SetNextDC (dc, DC_GetNextDC (dcs));
dcs->hNext = 0; 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 (!PATH_AssignGdiPath( &dc->path, &dcs->path ))
/* FIXME: This might not be quite right, since we're if (!PATH_AssignGdiPath( &dc->w.path, &dcs->w.path ))
* returning FALSE but still destroying the saved DC state {
*/ /* FIXME: This might not be quite right, since we're
success=FALSE; * returning FALSE but still destroying the saved DC state */
dc = DC_LockDc(hDC); success = FALSE;
}
dc = DC_LockDc(hDC);
if(!dc) if(!dc)
{ {
return FALSE; return FALSE;