Module: wine Branch: refs/heads/master Commit: 3df678a5afcb54bcd6b92ba14227c7a5b44bef73 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=3df678a5afcb54bcd6b92ba1...
Author: Rein Klazes wijn@wanadoo.nl Date: Mon Dec 19 09:53:04 2005 +0100
x11drv: Do not use the scroll rectangle for clipping in ScrollDC. With a conformance test.
---
dlls/user/tests/win.c | 17 ++++++++++++++++- dlls/x11drv/scroll.c | 44 +++++++++++++++++++++----------------------- 2 files changed, 37 insertions(+), 24 deletions(-)
diff --git a/dlls/user/tests/win.c b/dlls/user/tests/win.c index 447ca34..6cef7a9 100644 --- a/dlls/user/tests/win.c +++ b/dlls/user/tests/win.c @@ -2954,7 +2954,7 @@ static void test_scrolldc( HWND parent) ScrollDC( hdc, 5, -20, &rc, &cliprc, hrgn, &rcu); colr = GetPixel( hdc, (rc.left+rc.right)/2, ( rc.top + rc.bottom) /2 - 1); ok ( colr == 0, "pixel should be black, color is %08lx\n", colr); - + /* test with NULL clip rect */ ScrollDC( hdc, 20, -20, &rc, NULL, hrgn, &rcu); /*FillRgn(hdc, hrgn, GetStockObject(WHITE_BRUSH));*/ trace("update rect: %ld,%ld - %ld,%ld\n", @@ -2969,6 +2969,21 @@ static void test_scrolldc( HWND parent) CombineRgn(exprgn, exprgn, tmprgn, RGN_OR); if (winetest_debug > 0) dump_region(exprgn); ok(EqualRgn(exprgn, hrgn), "wrong update region\n"); + /* test clip rect > scroll rect */ + FillRect( hdc, &rc, GetStockObject(WHITE_BRUSH)); + rc2=rc; + InflateRect( &rc2, -(rc.right-rc.left)/4, -(rc.bottom-rc.top)/4); + FillRect( hdc, &rc2, GetStockObject(BLACK_BRUSH)); + ScrollDC( hdc, 10, 10, &rc2, &rc, hrgn, &rcu); + SetRectRgn( exprgn, 25, 25, 75, 35); + SetRectRgn( tmprgn, 25, 35, 35, 75); + CombineRgn(exprgn, exprgn, tmprgn, RGN_OR); + ok(EqualRgn(exprgn, hrgn), "wrong update region\n"); + colr = GetPixel( hdc, 80, 80); + ok ( colr == 0, "pixel should be black, color is %08lx\n", colr); + trace("update rect: %ld,%ld - %ld,%ld\n", + rcu.left, rcu.top, rcu.right, rcu.bottom); + if (winetest_debug > 0) dump_region(hrgn);
/* clean up */ DeleteObject(hrgn); diff --git a/dlls/x11drv/scroll.c b/dlls/x11drv/scroll.c index e0c2f83..cf80870 100644 --- a/dlls/x11drv/scroll.c +++ b/dlls/x11drv/scroll.c @@ -91,34 +91,21 @@ BOOL X11DRV_ScrollDC( HDC hdc, INT dx, I } else CombineRgn( visrgn, visrgn, clipRgn, RGN_AND); /* only those pixels in the scroll rectangle that remain in the clipping - * rect are scrolled. So first combine Scroll and Clipping rectangles, - * if available */ - if( lprcScroll) - { - if( lprcClip) - IntersectRect( &rcClip, lprcClip, lprcScroll); - else - rcClip = *lprcScroll; - } + * rect are scrolled. */ + if( lprcClip) + rcClip = *lprcClip; else - { - if( lprcClip) - rcClip = *lprcClip; - else - GetClipBox( hdc, &rcClip); - } - /* Then clip again to get the source rectangle that will remain in the - * clipping rect */ + GetClipBox( hdc, &rcClip); rcSrc = rcClip; - if (lprcClip) - { - OffsetRect( &rcSrc, -dx, -dy); - IntersectRect( &rcSrc, &rcSrc, &rcClip); - } + OffsetRect( &rcClip, -dx, -dy); + IntersectRect( &rcSrc, &rcSrc, &rcClip); + /* if an scroll rectangle is specified, only the pixels within that + * rectangle are scrolled */ + if( lprcScroll) + IntersectRect( &rcSrc, &rcSrc, lprcScroll); /* now convert to device coordinates */ LPtoDP(hdc, (LPPOINT)&rcSrc, 2); TRACE("source rect: %s\n", wine_dbgstr_rect(&rcSrc)); - /* also dx and dy */ SetRect(&offset, 0, 0, dx, dy); LPtoDP(hdc, (LPPOINT)&offset, 2); @@ -160,6 +147,17 @@ BOOL X11DRV_ScrollDC( HDC hdc, INT dx, I code = X11DRV_END_EXPOSURES; ExtEscape( hdc, X11DRV_ESCAPE, sizeof(code), (LPSTR)&code, sizeof(ExpRgn), (LPSTR)&ExpRgn ); + /* Intersect clip and scroll rectangles, allowing NULL values */ + if( lprcScroll) + if( lprcClip) + IntersectRect( &rcClip, lprcClip, lprcScroll); + else + rcClip = *lprcScroll; + else + if( lprcClip) + rcClip = *lprcClip; + else + GetClipBox( hdc, &rcClip); /* Convert the combined clip rectangle to device coordinates */ LPtoDP(hdc, (LPPOINT)&rcClip, 2); if( hrgn )