x11drv: Do not use the scroll rectangle for clipping in ScrollDC.
With a conformance test.
This commit is contained in:
parent
7458d74169
commit
3df678a5af
|
@ -2954,7 +2954,7 @@ static void test_scrolldc( HWND parent)
|
||||||
ScrollDC( hdc, 5, -20, &rc, &cliprc, hrgn, &rcu);
|
ScrollDC( hdc, 5, -20, &rc, &cliprc, hrgn, &rcu);
|
||||||
colr = GetPixel( hdc, (rc.left+rc.right)/2, ( rc.top + rc.bottom) /2 - 1);
|
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);
|
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);
|
ScrollDC( hdc, 20, -20, &rc, NULL, hrgn, &rcu);
|
||||||
/*FillRgn(hdc, hrgn, GetStockObject(WHITE_BRUSH));*/
|
/*FillRgn(hdc, hrgn, GetStockObject(WHITE_BRUSH));*/
|
||||||
trace("update rect: %ld,%ld - %ld,%ld\n",
|
trace("update rect: %ld,%ld - %ld,%ld\n",
|
||||||
|
@ -2969,6 +2969,21 @@ static void test_scrolldc( HWND parent)
|
||||||
CombineRgn(exprgn, exprgn, tmprgn, RGN_OR);
|
CombineRgn(exprgn, exprgn, tmprgn, RGN_OR);
|
||||||
if (winetest_debug > 0) dump_region(exprgn);
|
if (winetest_debug > 0) dump_region(exprgn);
|
||||||
ok(EqualRgn(exprgn, hrgn), "wrong update region\n");
|
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 */
|
/* clean up */
|
||||||
DeleteObject(hrgn);
|
DeleteObject(hrgn);
|
||||||
|
|
|
@ -91,34 +91,21 @@ BOOL X11DRV_ScrollDC( HDC hdc, INT dx, INT dy, const RECT *lprcScroll,
|
||||||
} else
|
} else
|
||||||
CombineRgn( visrgn, visrgn, clipRgn, RGN_AND);
|
CombineRgn( visrgn, visrgn, clipRgn, RGN_AND);
|
||||||
/* only those pixels in the scroll rectangle that remain in the clipping
|
/* only those pixels in the scroll rectangle that remain in the clipping
|
||||||
* rect are scrolled. So first combine Scroll and Clipping rectangles,
|
* rect are scrolled. */
|
||||||
* if available */
|
if( lprcClip)
|
||||||
if( lprcScroll)
|
rcClip = *lprcClip;
|
||||||
{
|
|
||||||
if( lprcClip)
|
|
||||||
IntersectRect( &rcClip, lprcClip, lprcScroll);
|
|
||||||
else
|
|
||||||
rcClip = *lprcScroll;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
GetClipBox( hdc, &rcClip);
|
||||||
if( lprcClip)
|
|
||||||
rcClip = *lprcClip;
|
|
||||||
else
|
|
||||||
GetClipBox( hdc, &rcClip);
|
|
||||||
}
|
|
||||||
/* Then clip again to get the source rectangle that will remain in the
|
|
||||||
* clipping rect */
|
|
||||||
rcSrc = rcClip;
|
rcSrc = rcClip;
|
||||||
if (lprcClip)
|
OffsetRect( &rcClip, -dx, -dy);
|
||||||
{
|
IntersectRect( &rcSrc, &rcSrc, &rcClip);
|
||||||
OffsetRect( &rcSrc, -dx, -dy);
|
/* if an scroll rectangle is specified, only the pixels within that
|
||||||
IntersectRect( &rcSrc, &rcSrc, &rcClip);
|
* rectangle are scrolled */
|
||||||
}
|
if( lprcScroll)
|
||||||
|
IntersectRect( &rcSrc, &rcSrc, lprcScroll);
|
||||||
/* now convert to device coordinates */
|
/* now convert to device coordinates */
|
||||||
LPtoDP(hdc, (LPPOINT)&rcSrc, 2);
|
LPtoDP(hdc, (LPPOINT)&rcSrc, 2);
|
||||||
TRACE("source rect: %s\n", wine_dbgstr_rect(&rcSrc));
|
TRACE("source rect: %s\n", wine_dbgstr_rect(&rcSrc));
|
||||||
|
|
||||||
/* also dx and dy */
|
/* also dx and dy */
|
||||||
SetRect(&offset, 0, 0, dx, dy);
|
SetRect(&offset, 0, 0, dx, dy);
|
||||||
LPtoDP(hdc, (LPPOINT)&offset, 2);
|
LPtoDP(hdc, (LPPOINT)&offset, 2);
|
||||||
|
@ -160,6 +147,17 @@ BOOL X11DRV_ScrollDC( HDC hdc, INT dx, INT dy, const RECT *lprcScroll,
|
||||||
code = X11DRV_END_EXPOSURES;
|
code = X11DRV_END_EXPOSURES;
|
||||||
ExtEscape( hdc, X11DRV_ESCAPE, sizeof(code), (LPSTR)&code,
|
ExtEscape( hdc, X11DRV_ESCAPE, sizeof(code), (LPSTR)&code,
|
||||||
sizeof(ExpRgn), (LPSTR)&ExpRgn );
|
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 */
|
/* Convert the combined clip rectangle to device coordinates */
|
||||||
LPtoDP(hdc, (LPPOINT)&rcClip, 2);
|
LPtoDP(hdc, (LPPOINT)&rcClip, 2);
|
||||||
if( hrgn )
|
if( hrgn )
|
||||||
|
|
Loading…
Reference in New Issue