GetUpdateRgn should clip the returned region to the client area.
Changed GetUpdateRect and ExcludeUpdateRgn to call GetUpdateRgn. Moved these 3 functions to dlls/user/painting.c.
This commit is contained in:
parent
b72994b6d4
commit
0ba0d7a119
|
@ -70,6 +70,20 @@ static HRGN copy_rgn( HRGN hSrc )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* get_update_region
|
||||
*
|
||||
* Return update region for a window.
|
||||
*/
|
||||
static HRGN get_update_region( WND *win )
|
||||
{
|
||||
if (!win->hrgnUpdate) return CreateRectRgn( 0, 0, 0, 0 );
|
||||
if (win->hrgnUpdate > (HRGN)1) return copy_rgn( win->hrgnUpdate );
|
||||
return CreateRectRgn( 0, 0, win->rectWindow.right - win->rectWindow.left,
|
||||
win->rectWindow.bottom - win->rectWindow.top );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* get_update_regions
|
||||
*
|
||||
|
@ -258,3 +272,84 @@ BOOL WINAPI EndPaint( HWND hwnd, const PAINTSTRUCT *lps )
|
|||
ShowCaret( hwnd );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* GetUpdateRgn (USER32.@)
|
||||
*/
|
||||
INT WINAPI GetUpdateRgn( HWND hwnd, HRGN hrgn, BOOL erase )
|
||||
{
|
||||
INT retval;
|
||||
HRGN update_rgn;
|
||||
WND *wndPtr = WIN_GetPtr( hwnd );
|
||||
|
||||
if (!wndPtr) return ERROR;
|
||||
if (wndPtr == WND_OTHER_PROCESS)
|
||||
{
|
||||
FIXME( "not supported on other process window %p\n", hwnd );
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
if ((update_rgn = get_update_region( wndPtr )))
|
||||
{
|
||||
/* map coordinates and clip to client area */
|
||||
OffsetRgn( update_rgn, wndPtr->rectWindow.left - wndPtr->rectClient.left,
|
||||
wndPtr->rectWindow.top - wndPtr->rectClient.top );
|
||||
SetRectRgn( hrgn, 0, 0, wndPtr->rectClient.right - wndPtr->rectClient.left,
|
||||
wndPtr->rectClient.bottom - wndPtr->rectClient.top );
|
||||
retval = CombineRgn( hrgn, hrgn, update_rgn, RGN_AND );
|
||||
DeleteObject( update_rgn );
|
||||
}
|
||||
else retval = ERROR;
|
||||
|
||||
WIN_ReleasePtr( wndPtr );
|
||||
|
||||
if (erase) RedrawWindow( hwnd, NULL, 0, RDW_ERASENOW | RDW_NOCHILDREN );
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* GetUpdateRect (USER32.@)
|
||||
*/
|
||||
BOOL WINAPI GetUpdateRect( HWND hwnd, LPRECT rect, BOOL erase )
|
||||
{
|
||||
HRGN update_rgn = CreateRectRgn( 0, 0, 0, 0 );
|
||||
INT retval = GetUpdateRgn( hwnd, update_rgn, erase );
|
||||
|
||||
if (rect)
|
||||
{
|
||||
GetRgnBox( update_rgn, rect );
|
||||
if (GetClassLongA(hwnd, GCL_STYLE) & CS_OWNDC)
|
||||
{
|
||||
HDC hdc = GetDCEx( hwnd, 0, DCX_USESTYLE );
|
||||
if (hdc)
|
||||
{
|
||||
if (GetMapMode(hdc) != MM_TEXT) DPtoLP(hdc, (LPPOINT)rect, 2);
|
||||
ReleaseDC( hwnd, hdc );
|
||||
}
|
||||
}
|
||||
}
|
||||
DeleteObject( update_rgn );
|
||||
|
||||
return (retval != ERROR && retval != NULLREGION);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* ExcludeUpdateRgn (USER32.@)
|
||||
*/
|
||||
INT WINAPI ExcludeUpdateRgn( HDC hdc, HWND hwnd )
|
||||
{
|
||||
HRGN update_rgn = CreateRectRgn( 0, 0, 0, 0 );
|
||||
INT ret = GetUpdateRgn( hwnd, update_rgn, FALSE );
|
||||
|
||||
if (ret != ERROR)
|
||||
{
|
||||
/* do ugly coordinate translations in dce.c */
|
||||
|
||||
ret = DCE_ExcludeRgn( hdc, hwnd, update_rgn );
|
||||
DeleteObject( update_rgn );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -943,123 +943,6 @@ BOOL WINAPI ValidateRect( HWND hwnd, const RECT *rect )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* GetUpdateRect (USER32.@)
|
||||
*/
|
||||
BOOL WINAPI GetUpdateRect( HWND hwnd, LPRECT rect, BOOL erase )
|
||||
{
|
||||
BOOL retvalue;
|
||||
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
||||
if (!wndPtr) return FALSE;
|
||||
|
||||
if (rect)
|
||||
{
|
||||
if (wndPtr->hrgnUpdate > (HRGN)1)
|
||||
{
|
||||
HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 );
|
||||
if (GetUpdateRgn( hwnd, hrgn, erase ) == ERROR)
|
||||
{
|
||||
retvalue = FALSE;
|
||||
goto END;
|
||||
}
|
||||
GetRgnBox( hrgn, rect );
|
||||
DeleteObject( hrgn );
|
||||
if (GetClassLongA(wndPtr->hwndSelf, GCL_STYLE) & CS_OWNDC)
|
||||
{
|
||||
if (GetMapMode(wndPtr->dce->hDC) != MM_TEXT)
|
||||
{
|
||||
DPtoLP (wndPtr->dce->hDC, (LPPOINT)rect, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if( wndPtr->hrgnUpdate == (HRGN)1 )
|
||||
{
|
||||
GetClientRect( hwnd, rect );
|
||||
if (erase) RedrawWindow( hwnd, NULL, 0, RDW_FRAME | RDW_ERASENOW | RDW_NOCHILDREN );
|
||||
}
|
||||
else
|
||||
SetRectEmpty( rect );
|
||||
}
|
||||
retvalue = (wndPtr->hrgnUpdate >= (HRGN)1);
|
||||
END:
|
||||
WIN_ReleaseWndPtr(wndPtr);
|
||||
return retvalue;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* GetUpdateRgn (USER32.@)
|
||||
*/
|
||||
INT WINAPI GetUpdateRgn( HWND hwnd, HRGN hrgn, BOOL erase )
|
||||
{
|
||||
INT retval;
|
||||
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
||||
if (!wndPtr) return ERROR;
|
||||
|
||||
if (wndPtr->hrgnUpdate == 0)
|
||||
{
|
||||
SetRectRgn( hrgn, 0, 0, 0, 0 );
|
||||
retval = NULLREGION;
|
||||
goto END;
|
||||
}
|
||||
else
|
||||
if (wndPtr->hrgnUpdate == (HRGN)1)
|
||||
{
|
||||
SetRectRgn( hrgn, 0, 0, wndPtr->rectClient.right - wndPtr->rectClient.left,
|
||||
wndPtr->rectClient.bottom - wndPtr->rectClient.top );
|
||||
retval = SIMPLEREGION;
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = CombineRgn( hrgn, wndPtr->hrgnUpdate, 0, RGN_COPY );
|
||||
OffsetRgn( hrgn, wndPtr->rectWindow.left - wndPtr->rectClient.left,
|
||||
wndPtr->rectWindow.top - wndPtr->rectClient.top );
|
||||
}
|
||||
if (erase) RedrawWindow( hwnd, NULL, 0, RDW_ERASENOW | RDW_NOCHILDREN );
|
||||
END:
|
||||
WIN_ReleaseWndPtr(wndPtr);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* ExcludeUpdateRgn (USER32.@)
|
||||
*/
|
||||
INT WINAPI ExcludeUpdateRgn( HDC hdc, HWND hwnd )
|
||||
{
|
||||
RECT rect;
|
||||
WND * wndPtr;
|
||||
|
||||
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return ERROR;
|
||||
|
||||
if (wndPtr->hrgnUpdate)
|
||||
{
|
||||
INT ret;
|
||||
HRGN hrgn = CreateRectRgn(wndPtr->rectWindow.left - wndPtr->rectClient.left,
|
||||
wndPtr->rectWindow.top - wndPtr->rectClient.top,
|
||||
wndPtr->rectWindow.right - wndPtr->rectClient.left,
|
||||
wndPtr->rectWindow.bottom - wndPtr->rectClient.top);
|
||||
if( wndPtr->hrgnUpdate > (HRGN)1 )
|
||||
{
|
||||
CombineRgn(hrgn, wndPtr->hrgnUpdate, 0, RGN_COPY);
|
||||
OffsetRgn(hrgn, wndPtr->rectWindow.left - wndPtr->rectClient.left,
|
||||
wndPtr->rectWindow.top - wndPtr->rectClient.top );
|
||||
}
|
||||
|
||||
/* do ugly coordinate translations in dce.c */
|
||||
|
||||
ret = DCE_ExcludeRgn( hdc, hwnd, hrgn );
|
||||
DeleteObject( hrgn );
|
||||
WIN_ReleaseWndPtr(wndPtr);
|
||||
return ret;
|
||||
}
|
||||
WIN_ReleaseWndPtr(wndPtr);
|
||||
return GetClipBox( hdc, &rect );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* FillRect (USER.81)
|
||||
* NOTE
|
||||
|
|
Loading…
Reference in New Issue