Author: greatlrd
Date: Mon Sep 25 22:50:40 2006
New Revision: 24268
URL:
http://svn.reactos.org/svn/reactos?rev=24268&view=rev
Log:
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
Modified:
trunk/reactos/subsystems/win32/win32k/objects/dc.c
Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dc.c (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dc.c Mon Sep 25 22:50:40 2006
@@ -1940,55 +1940,57 @@
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);
-
- 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);
+ HDC hdcs = DC_GetNextDC (dc);
+
+ 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)