Alexandre Julliard : winex11.drv: Make sure the drawable rect is always updated and use it where appropriate .

Alexandre Julliard julliard at wine.codeweavers.com
Tue Dec 12 08:42:12 CST 2006


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Dec 12 13:46:15 2006 +0100

winex11.drv: Make sure the drawable rect is always updated and use it where appropriate.

---

 dlls/winex11.drv/bitblt.c  |   10 +++-------
 dlls/winex11.drv/bitmap.c  |    5 +++++
 dlls/winex11.drv/init.c    |    5 +++++
 dlls/winex11.drv/xrender.c |   10 +++-------
 4 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c
index b143bf4..00bf375 100644
--- a/dlls/winex11.drv/bitblt.c
+++ b/dlls/winex11.drv/bitblt.c
@@ -1149,13 +1149,9 @@ static BOOL BITBLT_GetVisRectangles( X11
     if (heightSrc < 0) SWAP_INT32( &rect.top, &rect.bottom );
     /* Apparently the clipping and visible regions are only for output,
        so just check against dc extent here to avoid BadMatch errors */
-    if (physDevSrc->bitmap)
-    {
-        BITMAP bm;
-        GetObjectW( physDevSrc->bitmap->hbitmap, sizeof(bm), &bm );
-        SetRect( &clipRect, 0, 0, bm.bmWidth, bm.bmHeight );
-    }
-    else clipRect = virtual_screen_rect;
+    clipRect = physDevSrc->drawable_rect;
+    OffsetRect( &clipRect, -(physDevSrc->drawable_rect.left + physDevSrc->dc_rect.left),
+                -(physDevSrc->drawable_rect.top + physDevSrc->dc_rect.top) );
     if (!IntersectRect( visRectSrc, &rect, &clipRect ))
         return FALSE;
 
diff --git a/dlls/winex11.drv/bitmap.c b/dlls/winex11.drv/bitmap.c
index 726581a..75623e4 100644
--- a/dlls/winex11.drv/bitmap.c
+++ b/dlls/winex11.drv/bitmap.c
@@ -72,6 +72,9 @@ void X11DRV_BITMAP_Init(void)
 HBITMAP X11DRV_SelectBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
 {
     X_PHYSBITMAP *physBitmap;
+    BITMAP bitmap;
+
+    if (!GetObjectW( hbitmap, sizeof(bitmap), &bitmap )) return 0;
 
     if(physDev->xrender)
         X11DRV_XRender_UpdateDrawable( physDev );
@@ -81,6 +84,8 @@ HBITMAP X11DRV_SelectBitmap( X11DRV_PDEV
 
     physDev->bitmap = physBitmap;
     physDev->drawable = physBitmap->pixmap;
+    SetRect( &physDev->drawable_rect, 0, 0, bitmap.bmWidth, bitmap.bmHeight );
+    physDev->dc_rect = physDev->drawable_rect;
 
       /* Change GC depth if needed */
 
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c
index 9b2b9c8..c33301a 100644
--- a/dlls/winex11.drv/init.c
+++ b/dlls/winex11.drv/init.c
@@ -135,12 +135,17 @@ BOOL X11DRV_CreateDC( HDC hdc, X11DRV_PD
         physDev->bitmap    = &BITMAP_stock_phys_bitmap;
         physDev->drawable  = BITMAP_stock_phys_bitmap.pixmap;
         physDev->depth     = 1;
+        SetRect( &physDev->drawable_rect, 0, 0, 1, 1 );
+        physDev->dc_rect = physDev->drawable_rect;
     }
     else
     {
         physDev->bitmap    = NULL;
         physDev->drawable  = root_window;
         physDev->depth     = screen_depth;
+        physDev->drawable_rect = virtual_screen_rect;
+        SetRect( &physDev->dc_rect, 0, 0, virtual_screen_rect.right - virtual_screen_rect.left,
+                 virtual_screen_rect.bottom - virtual_screen_rect.top );
     }
     physDev->region = CreateRectRgn( 0, 0, 0, 0 );
 
diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c
index 317a36b..9c5e274 100644
--- a/dlls/winex11.drv/xrender.c
+++ b/dlls/winex11.drv/xrender.c
@@ -1327,16 +1327,12 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_P
 	    }
 	} else {
 	    XImage *image;
-	    unsigned int w, h, dummy_uint;
-	    Window dummy_window;
-	    int dummy_int;
 	    int image_x, image_y, image_off_x, image_off_y, image_w, image_h;
 	    RECT extents = {0, 0, 0, 0};
 	    POINT cur = {0, 0};
-	    
-	    
-	    XGetGeometry(gdi_display, physDev->drawable, &dummy_window, &dummy_int, &dummy_int,
-			 &w, &h, &dummy_uint, &dummy_uint);
+            int w = physDev->drawable_rect.right - physDev->drawable_rect.left;
+            int h = physDev->drawable_rect.bottom - physDev->drawable_rect.top;
+
 	    TRACE("drawable %dx%d\n", w, h);
 
 	    for(idx = 0; idx < count; idx++) {




More information about the wine-cvs mailing list