Alexandre Julliard : gdi32: Export a function to compute the DC clip box.

Alexandre Julliard julliard at winehq.org
Mon Jul 11 13:17:49 CDT 2011


Module: wine
Branch: master
Commit: 2ff31091ed633ae564c6eb6dc6554635491b48b0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2ff31091ed633ae564c6eb6dc6554635491b48b0

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jul 11 13:40:45 2011 +0200

gdi32: Export a function to compute the DC clip box.

---

 dlls/gdi32/clipping.c    |   31 ++++++++++++++++++++++---------
 dlls/gdi32/gdi_private.h |    1 +
 2 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/dlls/gdi32/clipping.c b/dlls/gdi32/clipping.c
index 86b19f1..e9978c3 100644
--- a/dlls/gdi32/clipping.c
+++ b/dlls/gdi32/clipping.c
@@ -53,6 +53,27 @@ static inline RECT get_clip_rect( DC * dc, int left, int top, int right, int bot
 }
 
 /***********************************************************************
+ *           get_clip_box
+ *
+ * Get the clipping rectangle in device coordinates.
+ */
+int get_clip_box( DC *dc, RECT *rect )
+{
+    int ret = ERROR;
+    HRGN rgn, clip = get_clip_region( dc );
+
+    if (!clip) return GetRgnBox( dc->hVisRgn, rect );
+
+    if ((rgn = CreateRectRgn( 0, 0, 0, 0 )))
+    {
+        CombineRgn( rgn, dc->hVisRgn, clip, RGN_AND );
+        ret = GetRgnBox( rgn, rect );
+        DeleteObject( rgn );
+    }
+    return ret;
+}
+
+/***********************************************************************
  *           CLIPPING_UpdateGCRegion
  *
  * Update the GC clip region when the ClipRgn or VisRgn have changed.
@@ -379,19 +400,11 @@ BOOL WINAPI RectVisible( HDC hdc, const RECT* rect )
 INT WINAPI GetClipBox( HDC hdc, LPRECT rect )
 {
     INT ret;
-    HRGN clip;
     DC *dc = get_dc_ptr( hdc );
     if (!dc) return ERROR;
 
     update_dc( dc );
-    if ((clip = get_clip_region(dc)))
-    {
-        HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 );
-        CombineRgn( hrgn, dc->hVisRgn, clip, RGN_AND );
-        ret = GetRgnBox( hrgn, rect );
-        DeleteObject( hrgn );
-    }
-    else ret = GetRgnBox( dc->hVisRgn, rect );
+    ret = get_clip_box( dc, rect );
     if (dc->layout & LAYOUT_RTL)
     {
         int tmp = rect->left;
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 456d92c..82d72e5 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -439,6 +439,7 @@ extern BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, PHYSDEV physdev ) DECLSPEC_HIDDE
 extern INT BITMAP_GetWidthBytes( INT bmWidth, INT bpp ) DECLSPEC_HIDDEN;
 
 /* clipping.c */
+extern int get_clip_box( DC *dc, RECT *rect ) DECLSPEC_HIDDEN;
 extern void CLIPPING_UpdateGCRegion( DC * dc ) DECLSPEC_HIDDEN;
 
 /* Return the total clip region (if any) */




More information about the wine-cvs mailing list