ScrollDC patch.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

This fixes display problems with scrolling of a listview control using
native common controls. Comctl32 calls ScrollWindowsEx with rect equal
to the client rectangele and clipping rectangle uqual to the client
rectangle minus the header. During scrolling downwards the header
pixels are painted all over the listview control.
MS documentations says that ScrollWindowEx will paint pixels that are
scrolled from outside into the clip rectangle. This, I verified under
Win2000, is NOT true. Both ScrollWindow(Ex) and ScrollDC only move
pixels that are, and remain in, the clip rectangle. 


Changelog:
	dlls/x11drv	: scroll.c
	In X11DRV_ScrollDC only move pixels that are within the 
	clip rectangle, before and after they are scrolled.

Rein.
-- 
Rein Klazes
rklazes@xs4all.nl
--- wine/dlls/x11drv/scroll.c	Mon Oct 15 19:56:45 2001
+++ mywine/dlls/x11drv/scroll.c	Sun Feb  3 14:39:23 2002
@@ -19,7 +19,7 @@
 #include "win.h"
 #include "debugtools.h"
 
-DEFAULT_DEBUG_CHANNEL(x11drv);
+DEFAULT_DEBUG_CHANNEL(scroll);
 
 
 /*************************************************************************
@@ -63,7 +63,7 @@
 BOOL X11DRV_ScrollDC( HDC hdc, INT dx, INT dy, const RECT *rc,
                       const RECT *clipRect, HRGN hrgnUpdate, LPRECT rcUpdate )
 {
-    RECT rect, rClip, rSrc;
+    RECT rect, rClip, rDst;
 
     TRACE( "%04x %d,%d hrgnUpdate=%04x rcUpdate = %p\n", hdc, dx, dy, hrgnUpdate, rcUpdate );
     if (clipRect) TRACE( "cliprc = (%d,%d,%d,%d)\n",
@@ -82,16 +82,16 @@
     }
     else rClip = rect;
 
-    rSrc = rClip;
-    OffsetRect( &rSrc, -dx, -dy );
-    IntersectRect( &rSrc, &rSrc, &rect );
+    rDst = rClip;
+    OffsetRect( &rDst, dx,  dy );
+    IntersectRect( &rDst, &rDst, &rClip );
 
-    if (!IsRectEmpty(&rSrc))
+    if (!IsRectEmpty(&rDst))
     {
         /* copy bits */
-        if (!BitBlt( hdc, rSrc.left + dx, rSrc.top + dy,
-                     rSrc.right - rSrc.left, rSrc.bottom - rSrc.top,
-                     hdc, rSrc.left, rSrc.top, SRCCOPY))
+        if (!BitBlt( hdc, rDst.left, rDst.top,
+                     rDst.right - rDst.left, rDst.bottom - rDst.top,
+                     hdc, rDst.left - dx, rDst.top - dy, SRCCOPY))
             return FALSE;
     }
 
@@ -100,22 +100,14 @@
     if (hrgnUpdate || rcUpdate)
     {
         HRGN hrgn = hrgnUpdate, hrgn2;
-        POINT pt;
 
         /* map everything to device coordinates */
-        pt.x = rect.left + dx;
-        pt.y = rect.top + dy;
-        LPtoDP( hdc, &pt, 1 );
-        LPtoDP( hdc, (LPPOINT)&rect, 2 );
         LPtoDP( hdc, (LPPOINT)&rClip, 2 );
-        dx = pt.x - rect.left;
-        dy = pt.y - rect.top;
+        LPtoDP( hdc, (LPPOINT)&rDst, 2 );
 
-        hrgn2 = CreateRectRgnIndirect( &rect );
+        hrgn2 = CreateRectRgnIndirect( &rDst );
         if (hrgn) SetRectRgn( hrgn, rClip.left, rClip.top, rClip.right, rClip.bottom );
         else hrgn = CreateRectRgn( rClip.left, rClip.top, rClip.right, rClip.bottom );
-        CombineRgn( hrgn, hrgn, hrgn2, RGN_AND );
-        OffsetRgn( hrgn2, dx, dy );
         CombineRgn( hrgn, hrgn, hrgn2, RGN_DIFF );
 
         if( rcUpdate )
@@ -134,6 +126,9 @@
 
 /*************************************************************************
  *		ScrollWindowEx   (X11DRV.@)
+ *
+ * Note: contrary to what the doc says, pixels that are scrolled from the 
+ *      outside of clipRect to the inside are NOT painted.
  */
 INT X11DRV_ScrollWindowEx( HWND hwnd, INT dx, INT dy,
                            const RECT *rect, const RECT *clipRect,

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux