2 * Window painting functions
4 * Copyright 1993, 1994, 1995 Alexandre Julliard
6 * FIXME: Do not repaint full nonclient area all the time. Instead, compute
7 * intersection with hrgnUpdate (which should be moved from client to
8 * window coords as well, lookup 'the pain' comment in the winpos.c).
16 #include "wine/winuser16.h"
18 /* Last CTLCOLOR id */
19 #define CTLCOLOR_MAX CTLCOLOR_STATIC
21 /***********************************************************************
25 void WIN_UpdateNCArea(WND
* wnd
, BOOL bUpdate
)
30 TRACE(nonclient
,"hwnd %04x, hrgnUpdate %04x\n",
31 wnd
->hwndSelf
, wnd
->hrgnUpdate
);
33 /* desktop window doesn't have nonclient area */
34 if(wnd
== WIN_GetDesktop())
36 wnd
->flags
&= ~WIN_NEEDS_NCPAINT
;
42 if( wnd
->hrgnUpdate
> 1 )
44 ClientToScreen16(wnd
->hwndSelf
, &pt
);
46 hClip
= CreateRectRgn( 0, 0, 0, 0 );
47 if (!CombineRgn( hClip
, wnd
->hrgnUpdate
, 0, RGN_COPY
))
53 OffsetRgn( hClip
, pt
.x
, pt
.y
);
57 /* exclude non-client area from update region */
58 HRGN hrgn
= CreateRectRgn( 0, 0,
59 wnd
->rectClient
.right
- wnd
->rectClient
.left
,
60 wnd
->rectClient
.bottom
- wnd
->rectClient
.top
);
62 if (hrgn
&& (CombineRgn( wnd
->hrgnUpdate
, wnd
->hrgnUpdate
,
63 hrgn
, RGN_AND
) == NULLREGION
))
65 DeleteObject( wnd
->hrgnUpdate
);
73 wnd
->flags
&= ~WIN_NEEDS_NCPAINT
;
75 if ((wnd
->hwndSelf
== GetActiveWindow()) &&
76 !(wnd
->flags
& WIN_NCACTIVATED
))
78 wnd
->flags
|= WIN_NCACTIVATED
;
79 if( hClip
> 1) DeleteObject( hClip
);
83 if (hClip
) SendMessage16( wnd
->hwndSelf
, WM_NCPAINT
, hClip
, 0L );
85 if (hClip
> 1) DeleteObject( hClip
);
89 /***********************************************************************
90 * BeginPaint16 (USER.39)
92 HDC16 WINAPI
BeginPaint16( HWND16 hwnd
, LPPAINTSTRUCT16 lps
)
96 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
97 if (!wndPtr
) return 0;
99 bIcon
= (wndPtr
->dwStyle
& WS_MINIMIZE
&& wndPtr
->class->hIcon
);
101 wndPtr
->flags
&= ~WIN_NEEDS_BEGINPAINT
;
103 if (wndPtr
->flags
& WIN_NEEDS_NCPAINT
) WIN_UpdateNCArea( wndPtr
, TRUE
);
105 if (((hrgnUpdate
= wndPtr
->hrgnUpdate
) != 0) ||
106 (wndPtr
->flags
& WIN_INTERNAL_PAINT
))
107 QUEUE_DecPaintCount( wndPtr
->hmemTaskQ
);
109 wndPtr
->hrgnUpdate
= 0;
110 wndPtr
->flags
&= ~WIN_INTERNAL_PAINT
;
114 TRACE(win
,"hrgnUpdate = %04x, \n", hrgnUpdate
);
116 /* When bIcon is TRUE hrgnUpdate is automatically in window coordinates
117 * (because rectClient == rectWindow for WS_MINIMIZE windows).
120 if (wndPtr
->class->style
& CS_PARENTDC
)
122 /* Don't clip the output to the update region for CS_PARENTDC window */
124 DeleteObject(hrgnUpdate
);
125 lps
->hdc
= GetDCEx16( hwnd
, 0, DCX_WINDOWPAINT
| DCX_USESTYLE
|
126 (bIcon
? DCX_WINDOW
: 0) );
130 lps
->hdc
= GetDCEx16(hwnd
, hrgnUpdate
, DCX_INTERSECTRGN
|
131 DCX_WINDOWPAINT
| DCX_USESTYLE
|
132 (bIcon
? DCX_WINDOW
: 0) );
135 TRACE(win
,"hdc = %04x\n", lps
->hdc
);
139 WARN(win
, "GetDCEx() failed in BeginPaint(), hwnd=%04x\n", hwnd
);
140 WIN_ReleaseWndPtr(wndPtr
);
144 GetClipBox16( lps
->hdc
, &lps
->rcPaint
);
146 TRACE(win
,"box = (%i,%i - %i,%i)\n", lps
->rcPaint
.left
, lps
->rcPaint
.top
,
147 lps
->rcPaint
.right
, lps
->rcPaint
.bottom
);
149 if (wndPtr
->flags
& WIN_NEEDS_ERASEBKGND
)
151 wndPtr
->flags
&= ~WIN_NEEDS_ERASEBKGND
;
152 lps
->fErase
= !SendMessage16(hwnd
, (bIcon
) ? WM_ICONERASEBKGND
154 (WPARAM16
)lps
->hdc
, 0 );
156 else lps
->fErase
= TRUE
;
158 WIN_ReleaseWndPtr(wndPtr
);
163 /***********************************************************************
164 * BeginPaint32 (USER32.10)
166 HDC WINAPI
BeginPaint( HWND hwnd
, PAINTSTRUCT
*lps
)
170 BeginPaint16( hwnd
, &ps
);
171 lps
->hdc
= (HDC
)ps
.hdc
;
172 lps
->fErase
= ps
.fErase
;
173 lps
->rcPaint
.top
= ps
.rcPaint
.top
;
174 lps
->rcPaint
.left
= ps
.rcPaint
.left
;
175 lps
->rcPaint
.right
= ps
.rcPaint
.right
;
176 lps
->rcPaint
.bottom
= ps
.rcPaint
.bottom
;
177 lps
->fRestore
= ps
.fRestore
;
178 lps
->fIncUpdate
= ps
.fIncUpdate
;
183 /***********************************************************************
184 * EndPaint16 (USER.40)
186 BOOL16 WINAPI
EndPaint16( HWND16 hwnd
, const PAINTSTRUCT16
* lps
)
188 ReleaseDC16( hwnd
, lps
->hdc
);
194 /***********************************************************************
195 * EndPaint32 (USER32.176)
197 BOOL WINAPI
EndPaint( HWND hwnd
, const PAINTSTRUCT
*lps
)
199 ReleaseDC( hwnd
, lps
->hdc
);
205 /***********************************************************************
206 * FillWindow (USER.324)
208 void WINAPI
FillWindow16( HWND16 hwndParent
, HWND16 hwnd
, HDC16 hdc
, HBRUSH16 hbrush
)
211 GetClientRect16( hwnd
, &rect
);
212 DPtoLP16( hdc
, (LPPOINT16
)&rect
, 2 );
213 PaintRect16( hwndParent
, hwnd
, hdc
, hbrush
, &rect
);
217 /***********************************************************************
218 * PAINT_GetControlBrush
220 static HBRUSH16
PAINT_GetControlBrush( HWND hParent
, HWND hWnd
, HDC16 hDC
, UINT16 ctlType
)
222 HBRUSH16 bkgBrush
= (HBRUSH16
)SendMessageA( hParent
, WM_CTLCOLORMSGBOX
+ ctlType
,
223 (WPARAM
)hDC
, (LPARAM
)hWnd
);
224 if( !IsGDIObject16(bkgBrush
) )
225 bkgBrush
= DEFWND_ControlColor( hDC
, ctlType
);
230 /***********************************************************************
231 * PaintRect (USER.325)
233 void WINAPI
PaintRect16( HWND16 hwndParent
, HWND16 hwnd
, HDC16 hdc
,
234 HBRUSH16 hbrush
, const RECT16
*rect
)
236 if( hbrush
<= CTLCOLOR_MAX
)
239 hbrush
= PAINT_GetControlBrush( hwndParent
, hwnd
, hdc
, (UINT16
)hbrush
);
244 FillRect16( hdc
, rect
, hbrush
);
248 /***********************************************************************
249 * GetControlBrush (USER.326)
251 HBRUSH16 WINAPI
GetControlBrush16( HWND16 hwnd
, HDC16 hdc
, UINT16 ctlType
)
253 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
256 if((ctlType
<= CTLCOLOR_MAX
) && wndPtr
)
259 if( wndPtr
->dwStyle
& WS_POPUP
) parent
= WIN_LockWndPtr(wndPtr
->owner
);
260 else parent
= WIN_LockWndPtr(wndPtr
->parent
);
261 if( !parent
) parent
= wndPtr
;
262 retvalue
= (HBRUSH16
)PAINT_GetControlBrush( parent
->hwndSelf
, hwnd
, hdc
, ctlType
);
263 WIN_ReleaseWndPtr(parent
);
266 retvalue
= (HBRUSH16
)0;
268 WIN_ReleaseWndPtr(wndPtr
);
273 /***********************************************************************
276 * FIXME: Windows uses WM_SYNCPAINT to cut down the number of intertask
277 * SendMessage() calls. This is a comment inside DefWindowProc() source
280 * This message avoids lots of inter-app message traffic
281 * by switching to the other task and continuing the
285 * LOWORD(lParam) = hrgnClip
286 * HIWORD(lParam) = hwndSkip (not used; always NULL)
288 * All in all, a prime candidate for a rewrite.
290 BOOL
PAINT_RedrawWindow( HWND hwnd
, const RECT
*rectUpdate
,
291 HRGN hrgnUpdate
, UINT flags
, UINT control
)
299 if (!hwnd
) hwnd
= GetDesktopWindow();
300 if (!(wndPtr
= WIN_FindWndPtr( hwnd
))) return FALSE
;
301 if (!WIN_IsWindowDrawable( wndPtr
, !(flags
& RDW_FRAME
) ) )
303 WIN_ReleaseWndPtr(wndPtr
);
304 return TRUE
; /* No redraw needed */
307 bIcon
= (wndPtr
->dwStyle
& WS_MINIMIZE
&& wndPtr
->class->hIcon
);
310 TRACE(win
, "%04x %d,%d-%d,%d %04x flags=%04x\n",
311 hwnd
, rectUpdate
->left
, rectUpdate
->top
,
312 rectUpdate
->right
, rectUpdate
->bottom
, hrgnUpdate
, flags
);
316 TRACE(win
, "%04x NULL %04x flags=%04x\n", hwnd
, hrgnUpdate
, flags
);
319 GetClientRect( hwnd
, &rectClient
);
321 if (flags
& RDW_INVALIDATE
) /* Invalidate */
323 int rgnNotEmpty
= COMPLEXREGION
;
325 if (wndPtr
->hrgnUpdate
> 1) /* Is there already an update region? */
327 if ((hrgn
= hrgnUpdate
) == 0)
328 hrgn
= CreateRectRgnIndirect( rectUpdate
? rectUpdate
:
330 rgnNotEmpty
= CombineRgn( wndPtr
->hrgnUpdate
, wndPtr
->hrgnUpdate
,
332 if (!hrgnUpdate
) DeleteObject( hrgn
);
334 else /* No update region yet */
336 if (!(wndPtr
->flags
& WIN_INTERNAL_PAINT
))
337 QUEUE_IncPaintCount( wndPtr
->hmemTaskQ
);
340 wndPtr
->hrgnUpdate
= CreateRectRgn( 0, 0, 0, 0 );
341 rgnNotEmpty
= CombineRgn( wndPtr
->hrgnUpdate
, hrgnUpdate
,
344 else wndPtr
->hrgnUpdate
= CreateRectRgnIndirect( rectUpdate
?
345 rectUpdate
: &rectClient
);
348 if (flags
& RDW_FRAME
) wndPtr
->flags
|= WIN_NEEDS_NCPAINT
;
350 /* restrict update region to client area (FIXME: correct?) */
351 if (wndPtr
->hrgnUpdate
)
353 HRGN clientRgn
= CreateRectRgnIndirect( &rectClient
);
354 rgnNotEmpty
= CombineRgn( wndPtr
->hrgnUpdate
, clientRgn
,
355 wndPtr
->hrgnUpdate
, RGN_AND
);
356 DeleteObject( clientRgn
);
359 /* check for bogus update region */
360 if ( rgnNotEmpty
== NULLREGION
)
362 wndPtr
->flags
&= ~WIN_NEEDS_ERASEBKGND
;
363 DeleteObject( wndPtr
->hrgnUpdate
);
364 wndPtr
->hrgnUpdate
=0;
365 if (!(wndPtr
->flags
& WIN_INTERNAL_PAINT
))
366 QUEUE_DecPaintCount( wndPtr
->hmemTaskQ
);
369 if (flags
& RDW_ERASE
) wndPtr
->flags
|= WIN_NEEDS_ERASEBKGND
;
370 flags
|= RDW_FRAME
; /* Force children frame invalidation */
372 else if (flags
& RDW_VALIDATE
) /* Validate */
374 /* We need an update region in order to validate anything */
375 if (wndPtr
->hrgnUpdate
> 1)
377 if (!hrgnUpdate
&& !rectUpdate
)
379 /* Special case: validate everything */
380 DeleteObject( wndPtr
->hrgnUpdate
);
381 wndPtr
->hrgnUpdate
= 0;
385 if ((hrgn
= hrgnUpdate
) == 0)
386 hrgn
= CreateRectRgnIndirect( rectUpdate
);
387 if (CombineRgn( wndPtr
->hrgnUpdate
, wndPtr
->hrgnUpdate
,
388 hrgn
, RGN_DIFF
) == NULLREGION
)
390 DeleteObject( wndPtr
->hrgnUpdate
);
391 wndPtr
->hrgnUpdate
= 0;
393 if (!hrgnUpdate
) DeleteObject( hrgn
);
395 if (!wndPtr
->hrgnUpdate
) /* No more update region */
396 if (!(wndPtr
->flags
& WIN_INTERNAL_PAINT
))
397 QUEUE_DecPaintCount( wndPtr
->hmemTaskQ
);
399 if (flags
& RDW_NOFRAME
) wndPtr
->flags
&= ~WIN_NEEDS_NCPAINT
;
400 if (flags
& RDW_NOERASE
) wndPtr
->flags
&= ~WIN_NEEDS_ERASEBKGND
;
403 /* Set/clear internal paint flag */
405 if (flags
& RDW_INTERNALPAINT
)
407 if ( wndPtr
->hrgnUpdate
<= 1 && !(wndPtr
->flags
& WIN_INTERNAL_PAINT
))
408 QUEUE_IncPaintCount( wndPtr
->hmemTaskQ
);
409 wndPtr
->flags
|= WIN_INTERNAL_PAINT
;
411 else if (flags
& RDW_NOINTERNALPAINT
)
413 if ( wndPtr
->hrgnUpdate
<= 1 && (wndPtr
->flags
& WIN_INTERNAL_PAINT
))
414 QUEUE_DecPaintCount( wndPtr
->hmemTaskQ
);
415 wndPtr
->flags
&= ~WIN_INTERNAL_PAINT
;
418 /* Erase/update window */
420 if (flags
& RDW_UPDATENOW
)
422 if (wndPtr
->hrgnUpdate
) /* wm_painticon wparam is 1 */
423 SendMessage16( hwnd
, (bIcon
) ? WM_PAINTICON
: WM_PAINT
, bIcon
, 0 );
425 else if (flags
& RDW_ERASENOW
)
427 if (wndPtr
->flags
& WIN_NEEDS_NCPAINT
)
428 WIN_UpdateNCArea( wndPtr
, FALSE
);
430 if (wndPtr
->flags
& WIN_NEEDS_ERASEBKGND
)
432 HDC hdc
= GetDCEx( hwnd
, wndPtr
->hrgnUpdate
,
433 DCX_INTERSECTRGN
| DCX_USESTYLE
|
434 DCX_KEEPCLIPRGN
| DCX_WINDOWPAINT
|
435 (bIcon
? DCX_WINDOW
: 0) );
438 if (SendMessage16( hwnd
, (bIcon
) ? WM_ICONERASEBKGND
441 wndPtr
->flags
&= ~WIN_NEEDS_ERASEBKGND
;
442 ReleaseDC( hwnd
, hdc
);
447 /* Recursively process children */
449 if (!(flags
& RDW_NOCHILDREN
) &&
450 ((flags
& RDW_ALLCHILDREN
) || !(wndPtr
->dwStyle
& WS_CLIPCHILDREN
)) &&
451 !(wndPtr
->dwStyle
& WS_MINIMIZE
) )
453 if ( hrgnUpdate
|| rectUpdate
)
455 if (!(hrgn
= CreateRectRgn( 0, 0, 0, 0 )))
457 WIN_ReleaseWndPtr(wndPtr
);
462 control
|= (RDW_C_DELETEHRGN
| RDW_C_USEHRGN
);
463 if( !(hrgnUpdate
= CreateRectRgnIndirect( rectUpdate
)) )
465 DeleteObject( hrgn
);
466 WIN_ReleaseWndPtr(wndPtr
);
470 if( (list
= WIN_BuildWinArray( wndPtr
, 0, NULL
)) )
472 for (ppWnd
= list
; *ppWnd
; ppWnd
++)
474 WIN_UpdateWndPtr(&wndPtr
,*ppWnd
);
475 if (!IsWindow(wndPtr
->hwndSelf
)) continue;
476 if (wndPtr
->dwStyle
& WS_VISIBLE
)
479 wndPtr
->rectWindow
.left
, wndPtr
->rectWindow
.top
,
480 wndPtr
->rectWindow
.right
, wndPtr
->rectWindow
.bottom
);
481 if (CombineRgn( hrgn
, hrgn
, hrgnUpdate
, RGN_AND
))
483 OffsetRgn( hrgn
, -wndPtr
->rectClient
.left
,
484 -wndPtr
->rectClient
.top
);
485 PAINT_RedrawWindow( wndPtr
->hwndSelf
, NULL
, hrgn
, flags
,
490 WIN_ReleaseWinArray(list
);
492 DeleteObject( hrgn
);
493 if (control
& RDW_C_DELETEHRGN
) DeleteObject( hrgnUpdate
);
497 if( (list
= WIN_BuildWinArray( wndPtr
, 0, NULL
)) )
499 for (ppWnd
= list
; *ppWnd
; ppWnd
++)
501 WIN_UpdateWndPtr(&wndPtr
,*ppWnd
);
502 if (IsWindow( wndPtr
->hwndSelf
))
503 PAINT_RedrawWindow( wndPtr
->hwndSelf
, NULL
, 0, flags
, 0 );
505 WIN_ReleaseWinArray(list
);
510 WIN_ReleaseWndPtr(wndPtr
);
515 /***********************************************************************
516 * RedrawWindow32 (USER32.426)
518 BOOL WINAPI
RedrawWindow( HWND hwnd
, const RECT
*rectUpdate
,
519 HRGN hrgnUpdate
, UINT flags
)
521 return PAINT_RedrawWindow( hwnd
, rectUpdate
, hrgnUpdate
, flags
, 0 );
525 /***********************************************************************
526 * RedrawWindow16 (USER.290)
528 BOOL16 WINAPI
RedrawWindow16( HWND16 hwnd
, const RECT16
*rectUpdate
,
529 HRGN16 hrgnUpdate
, UINT16 flags
)
534 CONV_RECT16TO32( rectUpdate
, &r
);
535 return (BOOL16
)RedrawWindow( (HWND
)hwnd
, &r
, hrgnUpdate
, flags
);
537 return (BOOL16
)PAINT_RedrawWindow( (HWND
)hwnd
, NULL
,
538 (HRGN
)hrgnUpdate
, flags
, 0 );
542 /***********************************************************************
543 * UpdateWindow16 (USER.124)
545 void WINAPI
UpdateWindow16( HWND16 hwnd
)
547 PAINT_RedrawWindow( hwnd
, NULL
, 0, RDW_UPDATENOW
| RDW_NOCHILDREN
, 0 );
550 /***********************************************************************
551 * UpdateWindow32 (USER32.567)
553 void WINAPI
UpdateWindow( HWND hwnd
)
555 PAINT_RedrawWindow( hwnd
, NULL
, 0, RDW_UPDATENOW
| RDW_NOCHILDREN
, 0 );
558 /***********************************************************************
559 * InvalidateRgn16 (USER.126)
561 void WINAPI
InvalidateRgn16( HWND16 hwnd
, HRGN16 hrgn
, BOOL16 erase
)
563 PAINT_RedrawWindow((HWND
)hwnd
, NULL
, (HRGN
)hrgn
,
564 RDW_INVALIDATE
| (erase
? RDW_ERASE
: 0), 0 );
568 /***********************************************************************
569 * InvalidateRgn32 (USER32.329)
571 BOOL WINAPI
InvalidateRgn( HWND hwnd
, HRGN hrgn
, BOOL erase
)
573 return PAINT_RedrawWindow(hwnd
, NULL
, hrgn
, RDW_INVALIDATE
| (erase
? RDW_ERASE
: 0), 0 );
577 /***********************************************************************
578 * InvalidateRect16 (USER.125)
580 void WINAPI
InvalidateRect16( HWND16 hwnd
, const RECT16
*rect
, BOOL16 erase
)
582 RedrawWindow16( hwnd
, rect
, 0, RDW_INVALIDATE
| (erase
? RDW_ERASE
: 0) );
586 /***********************************************************************
587 * InvalidateRect32 (USER32.328)
589 BOOL WINAPI
InvalidateRect( HWND hwnd
, const RECT
*rect
, BOOL erase
)
591 return PAINT_RedrawWindow( hwnd
, rect
, 0,
592 RDW_INVALIDATE
| (erase
? RDW_ERASE
: 0), 0 );
596 /***********************************************************************
597 * ValidateRgn16 (USER.128)
599 void WINAPI
ValidateRgn16( HWND16 hwnd
, HRGN16 hrgn
)
601 PAINT_RedrawWindow( (HWND
)hwnd
, NULL
, (HRGN
)hrgn
,
602 RDW_VALIDATE
| RDW_NOCHILDREN
, 0 );
606 /***********************************************************************
607 * ValidateRgn32 (USER32.572)
609 void WINAPI
ValidateRgn( HWND hwnd
, HRGN hrgn
)
611 PAINT_RedrawWindow( hwnd
, NULL
, hrgn
, RDW_VALIDATE
| RDW_NOCHILDREN
, 0 );
615 /***********************************************************************
616 * ValidateRect16 (USER.127)
618 void WINAPI
ValidateRect16( HWND16 hwnd
, const RECT16
*rect
)
620 RedrawWindow16( hwnd
, rect
, 0, RDW_VALIDATE
| RDW_NOCHILDREN
);
624 /***********************************************************************
625 * ValidateRect32 (USER32.571)
627 void WINAPI
ValidateRect( HWND hwnd
, const RECT
*rect
)
629 PAINT_RedrawWindow( hwnd
, rect
, 0, RDW_VALIDATE
| RDW_NOCHILDREN
, 0 );
633 /***********************************************************************
634 * GetUpdateRect16 (USER.190)
636 BOOL16 WINAPI
GetUpdateRect16( HWND16 hwnd
, LPRECT16 rect
, BOOL16 erase
)
641 if (!rect
) return GetUpdateRect( hwnd
, NULL
, erase
);
642 ret
= GetUpdateRect( hwnd
, &r
, erase
);
643 CONV_RECT32TO16( &r
, rect
);
648 /***********************************************************************
649 * GetUpdateRect32 (USER32.297)
651 BOOL WINAPI
GetUpdateRect( HWND hwnd
, LPRECT rect
, BOOL erase
)
654 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
655 if (!wndPtr
) return FALSE
;
659 if (wndPtr
->hrgnUpdate
> 1)
661 HRGN hrgn
= CreateRectRgn( 0, 0, 0, 0 );
662 if (GetUpdateRgn( hwnd
, hrgn
, erase
) == ERROR
)
667 GetRgnBox( hrgn
, rect
);
668 DeleteObject( hrgn
);
669 if (wndPtr
->class->style
& CS_OWNDC
)
671 if (GetMapMode(wndPtr
->dce
->hDC
) != MM_TEXT
)
673 DPtoLP (wndPtr
->dce
->hDC
, (LPPOINT
)rect
, 2);
677 else SetRectEmpty( rect
);
679 retvalue
= (wndPtr
->hrgnUpdate
> 1);
681 WIN_ReleaseWndPtr(wndPtr
);
686 /***********************************************************************
687 * GetUpdateRgn16 (USER.237)
689 INT16 WINAPI
GetUpdateRgn16( HWND16 hwnd
, HRGN16 hrgn
, BOOL16 erase
)
691 return GetUpdateRgn( hwnd
, hrgn
, erase
);
695 /***********************************************************************
696 * GetUpdateRgn32 (USER32.298)
698 INT WINAPI
GetUpdateRgn( HWND hwnd
, HRGN hrgn
, BOOL erase
)
701 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
702 if (!wndPtr
) return ERROR
;
704 if (wndPtr
->hrgnUpdate
<= 1)
706 SetRectRgn( hrgn
, 0, 0, 0, 0 );
710 retval
= CombineRgn( hrgn
, wndPtr
->hrgnUpdate
, 0, RGN_COPY
);
711 if (erase
) RedrawWindow( hwnd
, NULL
, 0, RDW_ERASENOW
| RDW_NOCHILDREN
);
713 WIN_ReleaseWndPtr(wndPtr
);
718 /***********************************************************************
719 * ExcludeUpdateRgn16 (USER.238)
721 INT16 WINAPI
ExcludeUpdateRgn16( HDC16 hdc
, HWND16 hwnd
)
723 return ExcludeUpdateRgn( hdc
, hwnd
);
727 /***********************************************************************
728 * ExcludeUpdateRgn32 (USER32.195)
730 INT WINAPI
ExcludeUpdateRgn( HDC hdc
, HWND hwnd
)
735 if (!(wndPtr
= WIN_FindWndPtr( hwnd
))) return ERROR
;
737 if (wndPtr
->hrgnUpdate
)
740 HRGN hrgn
= CreateRectRgn(wndPtr
->rectWindow
.left
- wndPtr
->rectClient
.left
,
741 wndPtr
->rectWindow
.top
- wndPtr
->rectClient
.top
,
742 wndPtr
->rectClient
.right
- wndPtr
->rectClient
.left
,
743 wndPtr
->rectClient
.bottom
- wndPtr
->rectClient
.top
);
744 if( wndPtr
->hrgnUpdate
> 1 )
745 CombineRgn(hrgn
, wndPtr
->hrgnUpdate
, 0, RGN_COPY
);
747 /* do ugly coordinate translations in dce.c */
749 ret
= DCE_ExcludeRgn( hdc
, wndPtr
, hrgn
);
750 DeleteObject( hrgn
);
751 WIN_ReleaseWndPtr(wndPtr
);
754 WIN_ReleaseWndPtr(wndPtr
);
755 return GetClipBox( hdc
, &rect
);