diff --git a/objects/region.c b/objects/region.c index 52e9654953e..04e2bc5e229 100644 --- a/objects/region.c +++ b/objects/region.c @@ -1190,8 +1190,15 @@ BOOL REGION_LPTODP( HDC hdc, HRGN hDest, HRGN hSrc ) tmpRect.top = YLPTODP( dc, tmpRect.top ); tmpRect.right = XLPTODP( dc, tmpRect.right ); tmpRect.bottom = YLPTODP( dc, tmpRect.bottom ); + + if (tmpRect.left > tmpRect.right) + { INT tmp = tmpRect.left; tmpRect.left = tmpRect.right; tmpRect.right = tmp; } + if (tmpRect.top > tmpRect.bottom) + { INT tmp = tmpRect.top; tmpRect.top = tmpRect.bottom; tmpRect.bottom = tmp; } + REGION_UnionRectWithRegion( &tmpRect, destObj->rgn ); } + ret = TRUE; GDI_ReleaseObj( hDest ); GDI_ReleaseObj( hSrc ); diff --git a/windows/painting.c b/windows/painting.c index 5578add6a8c..1fbaeb7cddf 100644 --- a/windows/painting.c +++ b/windows/painting.c @@ -354,13 +354,13 @@ HDC WINAPI BeginPaint( HWND hwnd, PAINTSTRUCT *lps ) than the window itself, so we need to intersect the cliprect with the window */ - GetClipBox( lps->hdc, &clipRect ); GetClientRect( hwnd, &clientRect ); - /* The rect obtained by GetClipBox is in logical, so make the client in logical to*/ - DPtoLP(lps->hdc, (LPPOINT)&clientRect, 2); + GetClipBox( lps->hdc, &clipRect ); + LPtoDP(lps->hdc, (LPPOINT)&clipRect, 2); /* GetClipBox returns LP */ IntersectRect(&lps->rcPaint, &clientRect, &clipRect); + DPtoLP(lps->hdc, (LPPOINT)&lps->rcPaint, 2); /* we must return LP */ TRACE("box = (%i,%i - %i,%i)\n", lps->rcPaint.left, lps->rcPaint.top, lps->rcPaint.right, lps->rcPaint.bottom ); diff --git a/windows/scroll.c b/windows/scroll.c index 4eb17607fe2..2cabfbf2b35 100644 --- a/windows/scroll.c +++ b/windows/scroll.c @@ -97,18 +97,27 @@ BOOL WINAPI ScrollDC( HDC hdc, INT dx, INT dy, const RECT *rc, dc->wndOrgY, dc->wndExtY, dc->vportOrgY, dc->vportExtY ); */ - /* compute device clipping region */ + /* compute device clipping region (in device coordinates) */ if ( rc ) rect = *rc; else /* maybe we should just return FALSE? */ GetClipBox( hdc, &rect ); + LPtoDP( hdc, (LPPOINT)&rect, 2 ); + if (prLClip) - IntersectRect( &rClip,&rect,prLClip ); + { + rClip = *prLClip; + LPtoDP( hdc, (LPPOINT)&rClip, 2 ); + IntersectRect( &rClip, &rect, &rClip ); + } else rClip = rect; + dx = XLPTODP ( dc, rect.left + dx ) - XLPTODP ( dc, rect.left ); + dy = YLPTODP ( dc, rect.top + dy ) - YLPTODP ( dc, rect.top ); + rSrc = rClip; OffsetRect( &rSrc, -dx, -dy ); IntersectRect( &rSrc, &rSrc, &rect ); @@ -121,6 +130,10 @@ BOOL WINAPI ScrollDC( HDC hdc, INT dx, INT dy, const RECT *rc, dest.y = (src.y = rSrc.top) + dy; /* copy bits */ + + DPtoLP( hdc, (LPPOINT)&rSrc, 2 ); + DPtoLP( hdc, &src, 1 ); + DPtoLP( hdc, &dest, 1 ); if (!BitBlt( hdc, dest.x, dest.y, rSrc.right - rSrc.left, rSrc.bottom - rSrc.top, @@ -139,10 +152,6 @@ BOOL WINAPI ScrollDC( HDC hdc, INT dx, INT dy, const RECT *rc, (hrgnUpdate) ? hrgnUpdate : CreateRectRgn( 0,0,0,0 ); HRGN hrgn2; - dx = XLPTODP ( dc, rect.left + dx) - XLPTODP ( dc, rect.left); - dy = YLPTODP ( dc, rect.top + dy) - YLPTODP ( dc, rect.top); - LPtoDP( hdc, (LPPOINT)&rect, 2 ); - LPtoDP( hdc, (LPPOINT)&rClip, 2 ); hrgn2 = CreateRectRgnIndirect( &rect ); OffsetRgn( hrgn2, dc->w.DCOrgX, dc->w.DCOrgY ); CombineRgn( hrgn2, hrgn2, dc->w.hVisRgn, RGN_AND );