Alexandre Julliard : gdi32: Store the total visible rectangle in the DC.

Alexandre Julliard julliard at winehq.org
Mon Jul 26 13:22:39 CDT 2010


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jul 26 15:30:26 2010 +0200

gdi32: Store the total visible rectangle in the DC.

---

 dlls/gdi32/bitmap.c      |    4 ++++
 dlls/gdi32/clipping.c    |    1 +
 dlls/gdi32/dc.c          |   19 +++++++++++++++----
 dlls/gdi32/gdi_private.h |    1 +
 4 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c
index 937a67d..e5a02be 100644
--- a/dlls/gdi32/bitmap.c
+++ b/dlls/gdi32/bitmap.c
@@ -611,6 +611,10 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
         dc->hBitmap = handle;
         GDI_inc_ref_count( handle );
         dc->dirty = 0;
+        dc->vis_rect.left   = 0;
+        dc->vis_rect.top    = 0;
+        dc->vis_rect.right  = bitmap->bitmap.bmWidth;
+        dc->vis_rect.bottom = bitmap->bitmap.bmHeight;
         SetRectRgn( dc->hVisRgn, 0, 0, bitmap->bitmap.bmWidth, bitmap->bitmap.bmHeight);
         GDI_ReleaseObj( handle );
         DC_InitDC( dc );
diff --git a/dlls/gdi32/clipping.c b/dlls/gdi32/clipping.c
index e865656..142c520 100644
--- a/dlls/gdi32/clipping.c
+++ b/dlls/gdi32/clipping.c
@@ -171,6 +171,7 @@ void CDECL __wine_set_visible_region( HDC hdc, HRGN hrgn, const RECT *vis_rect )
 
     DeleteObject( dc->hVisRgn );
     dc->dirty = 0;
+    dc->vis_rect = *vis_rect;
     dc->hVisRgn = hrgn;
     CLIPPING_UpdateGCRegion( dc );
     release_dc_ptr( dc );
diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index 7c86d34..738e42e 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -666,8 +666,11 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
         goto error;
     }
 
-    SetRectRgn( dc->hVisRgn, 0, 0,
-                GetDeviceCaps( hdc, DESKTOPHORZRES ), GetDeviceCaps( hdc, DESKTOPVERTRES ) );
+    dc->vis_rect.left   = 0;
+    dc->vis_rect.top    = 0;
+    dc->vis_rect.right  = GetDeviceCaps( hdc, DESKTOPHORZRES );
+    dc->vis_rect.bottom = GetDeviceCaps( hdc, DESKTOPVERTRES );
+    SetRectRgn(dc->hVisRgn, dc->vis_rect.left, dc->vis_rect.top, dc->vis_rect.right, dc->vis_rect.bottom);
 
     DC_InitDC( dc );
     release_dc_ptr( dc );
@@ -768,6 +771,10 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
     TRACE("(%p): returning %p\n", hdc, dc->hSelf );
 
     dc->hBitmap = GDI_inc_ref_count( GetStockObject( DEFAULT_BITMAP ));
+    dc->vis_rect.left   = 0;
+    dc->vis_rect.top    = 0;
+    dc->vis_rect.right  = 1;
+    dc->vis_rect.bottom = 1;
     if (!(dc->hVisRgn = CreateRectRgn( 0, 0, 1, 1 ))) goto error;   /* default bitmap is 1x1 */
 
     /* Copy the driver-specific physical device info into
@@ -860,8 +867,12 @@ HDC WINAPI ResetDCW( HDC hdc, const DEVMODEW *devmode )
             if (ret)  /* reset the visible region */
             {
                 dc->dirty = 0;
-                SetRectRgn( dc->hVisRgn, 0, 0, GetDeviceCaps( hdc, DESKTOPHORZRES ),
-                            GetDeviceCaps( hdc, DESKTOPVERTRES ) );
+                dc->vis_rect.left   = 0;
+                dc->vis_rect.top    = 0;
+                dc->vis_rect.right  = GetDeviceCaps( hdc, DESKTOPHORZRES );
+                dc->vis_rect.bottom = GetDeviceCaps( hdc, DESKTOPVERTRES );
+                SetRectRgn( dc->hVisRgn, dc->vis_rect.left, dc->vis_rect.top,
+                            dc->vis_rect.right, dc->vis_rect.bottom );
                 CLIPPING_UpdateGCRegion( dc );
             }
         }
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index d1cb66b..8ac78ef 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -261,6 +261,7 @@ typedef struct tagDC
     INT          vportExtY;
     SIZE         virtual_res;      /* Initially HORZRES,VERTRES. Changed by SetVirtualResolution */
     SIZE         virtual_size;     /* Initially HORZSIZE,VERTSIZE. Changed by SetVirtualResolution */
+    RECT         vis_rect;         /* visible rectangle in screen coords */
     FLOAT        miterLimit;
 
     int           flags;




More information about the wine-cvs mailing list