Misc. painting fixes.

svn path=/trunk/; revision=3412
This commit is contained in:
David Welch 2002-08-27 23:29:40 +00:00
parent c75df46270
commit 25788364e8
4 changed files with 46 additions and 22 deletions

View file

@ -1,4 +1,4 @@
/* $Id: painting.c,v 1.3 2002/08/26 23:20:54 dwelch Exp $ /* $Id: painting.c,v 1.4 2002/08/27 23:29:40 dwelch Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -162,7 +162,7 @@ PaintValidateParent(PWINDOW_OBJECT Child)
Rect.right = Child->WindowRect.right - Child->WindowRect.left; Rect.right = Child->WindowRect.right - Child->WindowRect.left;
Rect.bottom = Child->WindowRect.bottom - Child->WindowRect.top; Rect.bottom = Child->WindowRect.bottom - Child->WindowRect.top;
hRgn = W32kCreateRectRgnIndirect(&Rect); hRgn = UnsafeW32kCreateRectRgnIndirect(&Rect);
} }
else else
{ {
@ -187,7 +187,8 @@ PaintValidateParent(PWINDOW_OBJECT Child)
Rect1.bottom = Parent->WindowRect.bottom - Rect1.bottom = Parent->WindowRect.bottom -
Parent->WindowRect.top; Parent->WindowRect.top;
Parent->UpdateRegion = W32kCreateRectRgnIndirect(&Rect1); Parent->UpdateRegion =
UnsafeW32kCreateRectRgnIndirect(&Rect1);
} }
Offset.x = Child->WindowRect.left - Parent->WindowRect.left; Offset.x = Child->WindowRect.left - Parent->WindowRect.left;
Offset.y = Child->WindowRect.top - Parent->WindowRect.top; Offset.y = Child->WindowRect.top - Parent->WindowRect.top;
@ -297,7 +298,7 @@ PaintUpdateRgns(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags,
if (Window->UpdateRegion == (HANDLE)1) if (Window->UpdateRegion == (HANDLE)1)
{ {
Window->UpdateRegion = Window->UpdateRegion =
W32kCreateRectRgnIndirect(&Rect); UnsafeW32kCreateRectRgnIndirect(&Rect);
} }
if (W32kCombineRgn(Window->UpdateRegion, if (W32kCombineRgn(Window->UpdateRegion,
Window->UpdateRegion, hRgn, Window->UpdateRegion, hRgn,
@ -475,11 +476,12 @@ PaintRedrawWindow(HWND hWnd, const RECT* UpdateRect, HRGN UpdateRgn,
} }
if (Window->UpdateRegion == NULL) if (Window->UpdateRegion == NULL)
{ {
Window->UpdateRegion = W32kCreateRectRgnIndirect(&Rect2); Window->UpdateRegion =
UnsafeW32kCreateRectRgnIndirect(&Rect2);
} }
else else
{ {
hRgn = W32kCreateRectRgnIndirect(&Rect2); hRgn = UnsafeW32kCreateRectRgnIndirect(&Rect2);
} }
} }
else else
@ -491,7 +493,7 @@ PaintRedrawWindow(HWND hWnd, const RECT* UpdateRect, HRGN UpdateRgn,
else else
{ {
W32kGetClientRect(hWnd, &Rect2); W32kGetClientRect(hWnd, &Rect2);
hRgn = W32kCreateRectRgnIndirect(&Rect2); hRgn = UnsafeW32kCreateRectRgnIndirect(&Rect2);
} }
} }
} }
@ -672,7 +674,8 @@ PaintUpdateNCRegion(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
{ {
if (Flags & UNC_UPDATE) if (Flags & UNC_UPDATE)
{ {
Window->UpdateRegion = W32kCreateRectRgnIndirect(&ClientRect); Window->UpdateRegion =
UnsafeW32kCreateRectRgnIndirect(&ClientRect);
} }
if (Flags & UNC_REGION) if (Flags & UNC_REGION)
{ {
@ -690,7 +693,8 @@ PaintUpdateNCRegion(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
else if (Window->UpdateRegion == (HANDLE)1 && Flags & UNC_UPDATE) else if (Window->UpdateRegion == (HANDLE)1 && Flags & UNC_UPDATE)
{ {
W32kGetClientRect(Window, &ClientRect); W32kGetClientRect(Window, &ClientRect);
Window->UpdateRegion = W32kCreateRectRgnIndirect(&ClientRect); Window->UpdateRegion =
UnsafeW32kCreateRectRgnIndirect(&ClientRect);
if (Flags & UNC_REGION) if (Flags & UNC_REGION)
{ {
hRgnRet = (HANDLE)1; hRgnRet = (HANDLE)1;
@ -768,9 +772,10 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs)
UpdateRegion = Window->UpdateRegion; UpdateRegion = Window->UpdateRegion;
Window->UpdateRegion = 0; Window->UpdateRegion = 0;
if (UpdateRegion != NULL || Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT) if (UpdateRegion != NULL ||
(Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT))
{ {
MsqDecPaintCountQueue(&Window->MessageQueue); MsqDecPaintCountQueue(Window->MessageQueue);
} }
Window->Flags &= ~WINDOWOBJECT_NEED_INTERNALPAINT; Window->Flags &= ~WINDOWOBJECT_NEED_INTERNALPAINT;
@ -802,7 +807,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* lPs)
/* FIXME: Check for DC creation failure. */ /* FIXME: Check for DC creation failure. */
W32kGetClientRect(hWnd, &ClientRect); W32kGetClientRect(Window, &ClientRect);
W32kGetClipBox(lPs->hdc, &ClipRect); W32kGetClipBox(lPs->hdc, &ClipRect);
W32kLPtoDP(lPs->hdc, (LPPOINT)&ClipRect, 2); W32kLPtoDP(lPs->hdc, (LPPOINT)&ClipRect, 2);
W32kIntersectRect(&lPs->rcPaint, &ClientRect, &ClipRect); W32kIntersectRect(&lPs->rcPaint, &ClientRect, &ClipRect);

View file

@ -1,4 +1,4 @@
/* $Id: windc.c,v 1.4 2002/08/27 21:20:45 jfilby Exp $ /* $Id: windc.c,v 1.5 2002/08/27 23:29:40 dwelch Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -349,7 +349,7 @@ NtUserGetDCEx(HWND hWnd, HANDLE hRegion, ULONG Flags)
} }
dce = DCEOBJ_LockDCE(hdce); dce = DCEOBJ_LockDCE(hdce);
dce->type = DCE_CACHE_DC; dce->type = DCE_CACHE_DC;
dce->hDC = hdce; dce->hDC = W32kCreateDC(L"DISPLAY", NULL, NULL, NULL);
} }
} }
else else

View file

@ -67,9 +67,19 @@ int STDCALL W32kExtSelectClipRgn(HDC hDC,
} }
int STDCALL W32kGetClipBox(HDC hDC, int STDCALL W32kGetClipBox(HDC hDC,
LPRECT rc) LPRECT rc)
{ {
UNIMPLEMENTED; int retval;
DC *dc;
if (!(dc = DC_HandleToPtr(hDC))) return ERROR;
retval = W32kGetRgnBox(dc->w.hGCClipRgn, rc);
rc->left -= dc->w.DCOrgX;
rc->right -= dc->w.DCOrgX;
rc->top -= dc->w.DCOrgY;
rc->bottom -= dc->w.DCOrgY;
W32kDPtoLP(hDC, (LPPOINT)rc, 2);
return(retval);
} }
int STDCALL W32kGetMetaRgn(HDC hDC, int STDCALL W32kGetMetaRgn(HDC hDC,

View file

@ -1566,15 +1566,24 @@ W32kCreateRectRgn(INT LeftRect,
return NULL; return NULL;
} }
HRGN HRGN STDCALL
STDCALL W32kCreateRectRgnIndirect(CONST PRECT rc)
W32kCreateRectRgnIndirect(CONST PRECT rc)
{ {
RECT SafeRc; RECT SafeRc;
if( NT_SUCCESS( MmCopyFromCaller( &SafeRc, rc, sizeof( RECT ) ) ) ) NTSTATUS Status;
return W32kCreateRectRgn(SafeRc.left, SafeRc.top, SafeRc.right, SafeRc.bottom);
return NULL; Status = MmCopyFromCaller(&SafeRc, rc, sizeof(RECT));
if (!NT_SUCCESS(Status))
{
return(NULL);
}
return(UnsafeW32kCreateRectRgnIndirect(&SafeRc));
}
HRGN STDCALL
UnsafeW32kCreateRectRgnIndirect(CONST PRECT rc)
{
return(W32kCreateRectRgn(rc->left, rc->top, rc->right, rc->bottom));
} }
HRGN HRGN