- Intersect the paint rectangle in NtUserBeginPaint with the client window rectangle.

- Fix the data returned by co_UserGetUpdateRgn and NtUserGetUpdateRect.

svn path=/trunk/; revision=18046
This commit is contained in:
Filip Navara 2005-09-25 11:16:54 +00:00
parent fa45440822
commit 8e767a38a4

View file

@ -766,6 +766,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
{
UnsafeIntGetRgnBox(Rgn, &Ps.rcPaint);
RGNDATA_UnlockRgn(Rgn);
IntGdiIntersectRect(&Ps.rcPaint, &Ps.rcPaint, &Window->ClientRect);
IntGdiOffsetRect(&Ps.rcPaint,
-Window->ClientRect.left,
-Window->ClientRect.top);
@ -855,6 +856,7 @@ INT FASTCALL
co_UserGetUpdateRgn(PWINDOW_OBJECT Window, HRGN hRgn, BOOL bErase)
{
int RegionType;
RECT Rect;
ASSERT_REFS_CO(Window);
@ -864,7 +866,10 @@ co_UserGetUpdateRgn(PWINDOW_OBJECT Window, HRGN hRgn, BOOL bErase)
}
else
{
RegionType = NtGdiCombineRgn(hRgn, Window->UpdateRegion, hRgn, RGN_COPY);
Rect = Window->ClientRect;
IntIntersectWithParents(Window, &Rect);
NtGdiSetRectRgn(hRgn, Rect.left, Rect.top, Rect.right, Rect.bottom);
RegionType = NtGdiCombineRgn(hRgn, hRgn, Window->UpdateRegion, RGN_AND);
NtGdiOffsetRgn(hRgn, -Window->ClientRect.left, -Window->ClientRect.top);
}
@ -875,6 +880,7 @@ co_UserGetUpdateRgn(PWINDOW_OBJECT Window, HRGN hRgn, BOOL bErase)
return RegionType;
}
/*
* NtUserGetUpdateRgn
*
@ -923,7 +929,6 @@ NtUserGetUpdateRect(HWND hWnd, LPRECT UnsafeRect, BOOL bErase)
RECT Rect;
INT RegionType;
PROSRGNDATA RgnData;
BOOL AlwaysPaint;
NTSTATUS Status;
DECLARE_RETURN(BOOL);
@ -932,7 +937,7 @@ NtUserGetUpdateRect(HWND hWnd, LPRECT UnsafeRect, BOOL bErase)
if (!(Window = UserGetWindowObject(hWnd)))
{
RETURN( ERROR);
RETURN(FALSE);
}
if (Window->UpdateRegion == NULL)
@ -940,17 +945,35 @@ NtUserGetUpdateRect(HWND hWnd, LPRECT UnsafeRect, BOOL bErase)
Rect.left = Rect.top = Rect.right = Rect.bottom = 0;
}
else
{
/* Get the update region bounding box. */
if (Window->UpdateRegion == (HRGN)1)
{
Rect = Window->ClientRect;
}
else
{
RgnData = RGNDATA_LockRgn(Window->UpdateRegion);
ASSERT(RgnData != NULL);
RegionType = UnsafeIntGetRgnBox(RgnData, &Rect);
ASSERT(RegionType != ERROR);
RGNDATA_UnlockRgn(RgnData);
}
AlwaysPaint = (Window->Flags & WINDOWOBJECT_NEED_NCPAINT) ||
(Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT);
if (bErase && Rect.left < Rect.right && Rect.top < Rect.bottom)
if (RegionType != ERROR && RegionType != NULLREGION)
IntGdiIntersectRect(&Rect, &Rect, &Window->ClientRect);
}
if (IntIntersectWithParents(Window, &Rect))
{
IntGdiOffsetRect(&Rect,
-Window->ClientRect.left,
-Window->ClientRect.top);
} else
{
Rect.left = Rect.top = Rect.right = Rect.bottom = 0;
}
}
if (bErase && !IntGdiIsEmptyRect(&Rect))
{
UserRefObjectCo(Window);
co_UserRedrawWindow(Window, NULL, NULL, RDW_ERASENOW | RDW_NOCHILDREN);
@ -967,7 +990,7 @@ NtUserGetUpdateRect(HWND hWnd, LPRECT UnsafeRect, BOOL bErase)
}
}
RETURN( (Rect.left < Rect.right && Rect.top < Rect.bottom) || AlwaysPaint);
RETURN(Window->UpdateRegion != NULL);
CLEANUP:
DPRINT("Leave NtUserGetUpdateRect, ret=%i\n",_ret_);