Alexandre Julliard : gdi32: Move the whole DC saving functionality into get_dc_state, and rename it to save_dc_state.
Alexandre Julliard
julliard at winehq.org
Wed Apr 8 10:05:31 CDT 2009
Module: wine
Branch: master
Commit: a23725785e12f920b35a43b915cba70bccc45176
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a23725785e12f920b35a43b915cba70bccc45176
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Apr 7 20:18:58 2009 +0200
gdi32: Move the whole DC saving functionality into get_dc_state, and rename it to save_dc_state.
---
dlls/gdi32/dc.c | 50 ++++++++++++++-------------------------------
dlls/gdi32/gdi_private.h | 2 +-
2 files changed, 17 insertions(+), 35 deletions(-)
diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index 8bcd2fa..9f0c9f6 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -332,12 +332,12 @@ void DC_UpdateXforms( DC *dc )
/***********************************************************************
- * get_dc_state (Not a Windows API)
+ * save_dc_state
*/
-HDC get_dc_state( HDC hdc )
+INT save_dc_state( HDC hdc )
{
DC * newdc, * dc;
- HGDIOBJ handle;
+ INT ret;
if (!(dc = get_dc_ptr( hdc ))) return 0;
if (!(newdc = HeapAlloc( GetProcessHeap(), 0, sizeof(*newdc ))))
@@ -407,8 +407,6 @@ HDC get_dc_state( HDC hdc )
release_dc_ptr( dc );
return 0;
}
- handle = newdc->hSelf;
- TRACE("(%p): returning %p\n", hdc, handle );
/* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */
@@ -428,9 +426,19 @@ HDC get_dc_state( HDC hdc )
}
/* don't bother recomputing hMetaClipRgn, we'll do that in SetDCState */
+ if (!PATH_AssignGdiPath( &newdc->path, &dc->path ))
+ {
+ release_dc_ptr( dc );
+ free_dc_ptr( newdc );
+ return 0;
+ }
+
+ newdc->saved_dc = dc->saved_dc;
+ dc->saved_dc = newdc->hSelf;
+ ret = ++dc->saveLevel;
release_dc_ptr( newdc );
release_dc_ptr( dc );
- return handle;
+ return ret;
}
@@ -533,8 +541,7 @@ void set_dc_state( HDC hdc, HDC hdcs )
*/
INT WINAPI SaveDC( HDC hdc )
{
- HDC hdcs;
- DC * dc, * dcs;
+ DC * dc;
INT ret;
dc = get_dc_ptr( hdc );
@@ -549,32 +556,7 @@ INT WINAPI SaveDC( HDC hdc )
return ret;
}
- if (!(hdcs = get_dc_state( hdc )))
- {
- release_dc_ptr( dc );
- return 0;
- }
- dcs = get_dc_ptr( hdcs );
-
- /* Copy path. The reason why path saving / restoring is in SaveDC/
- * RestoreDC and not in GetDCState/SetDCState is that the ...DCState
- * functions are only in Win16 (which doesn't have paths) and that
- * SetDCState doesn't allow us to signal an error (which can happen
- * when copying paths).
- */
- if (!PATH_AssignGdiPath( &dcs->path, &dc->path ))
- {
- release_dc_ptr( dc );
- release_dc_ptr( dcs );
- DeleteDC( hdcs );
- return 0;
- }
-
- dcs->saved_dc = dc->saved_dc;
- dc->saved_dc = hdcs;
- TRACE("(%p): returning %d\n", hdc, dc->saveLevel+1 );
- ret = ++dc->saveLevel;
- release_dc_ptr( dcs );
+ ret = save_dc_state( hdc );
release_dc_ptr( dc );
return ret;
}
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index a21fc76..c585eaf 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -383,7 +383,7 @@ extern void release_dc_ptr( DC *dc ) DECLSPEC_HIDDEN;
extern void update_dc( DC *dc ) DECLSPEC_HIDDEN;
extern void DC_InitDC( DC * dc ) DECLSPEC_HIDDEN;
extern void DC_UpdateXforms( DC * dc ) DECLSPEC_HIDDEN;
-extern HDC get_dc_state( HDC hdc ) DECLSPEC_HIDDEN;
+extern INT save_dc_state( HDC hdc ) DECLSPEC_HIDDEN;
extern void set_dc_state( HDC hdc, HDC hdcs ) DECLSPEC_HIDDEN;
/* dib.c */
More information about the wine-cvs
mailing list