winex11: Use inline intersect_rect helper instead of IntersectRect.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-04-17 21:52:34 +02:00 committed by Alexandre Julliard
parent ace09cf315
commit aa9072998f
6 changed files with 16 additions and 7 deletions

View File

@ -1912,7 +1912,7 @@ static void x11drv_surface_flush( struct window_surface *window_surface )
coords.width = surface->header.rect.right - surface->header.rect.left; coords.width = surface->header.rect.right - surface->header.rect.left;
coords.height = surface->header.rect.bottom - surface->header.rect.top; coords.height = surface->header.rect.bottom - surface->header.rect.top;
SetRect( &coords.visrect, 0, 0, coords.width, coords.height ); SetRect( &coords.visrect, 0, 0, coords.width, coords.height );
if (IntersectRect( &coords.visrect, &coords.visrect, &surface->bounds )) if (intersect_rect( &coords.visrect, &coords.visrect, &surface->bounds ))
{ {
TRACE( "flushing %p %dx%d bounds %s bits %p\n", TRACE( "flushing %p %dx%d bounds %s bits %p\n",
surface, coords.width, coords.height, surface, coords.width, coords.height,

View File

@ -124,7 +124,7 @@ RECT get_work_area(const RECT *monitor_rect)
work_rect.right = work_rect.left + work_area[i * 4 + 2]; work_rect.right = work_rect.left + work_area[i * 4 + 2];
work_rect.bottom = work_rect.top + work_area[i * 4 + 3]; work_rect.bottom = work_rect.top + work_area[i * 4 + 3];
if (IntersectRect(&work_rect, &work_rect, monitor_rect)) if (intersect_rect( &work_rect, &work_rect, monitor_rect ))
{ {
TRACE("work_rect:%s.\n", wine_dbgstr_rect(&work_rect)); TRACE("work_rect:%s.\n", wine_dbgstr_rect(&work_rect));
XFree(work_area); XFree(work_area);
@ -146,7 +146,7 @@ RECT get_work_area(const RECT *monitor_rect)
SetRect(&work_rect, work_area[0], work_area[1], work_area[0] + work_area[2], SetRect(&work_rect, work_area[0], work_area[1], work_area[0] + work_area[2],
work_area[1] + work_area[3]); work_area[1] + work_area[3]);
if (IntersectRect(&work_rect, &work_rect, monitor_rect)) if (intersect_rect( &work_rect, &work_rect, monitor_rect ))
{ {
TRACE("work_rect:%s.\n", wine_dbgstr_rect(&work_rect)); TRACE("work_rect:%s.\n", wine_dbgstr_rect(&work_rect));
XFree(work_area); XFree(work_area);

View File

@ -147,7 +147,7 @@ void add_device_bounds( X11DRV_PDEVICE *dev, const RECT *rect )
if (!dev->bounds) return; if (!dev->bounds) return;
if (dev->region && NtGdiGetRgnBox( dev->region, &rc )) if (dev->region && NtGdiGetRgnBox( dev->region, &rc ))
{ {
if (IntersectRect( &rc, &rc, rect )) add_bounds_rect( dev->bounds, &rc ); if (intersect_rect( &rc, &rc, rect )) add_bounds_rect( dev->bounds, &rc );
} }
else add_bounds_rect( dev->bounds, rect ); else add_bounds_rect( dev->bounds, rect );
} }

View File

@ -709,7 +709,7 @@ static BOOL overlap_placed_displays(const RECT *rect, const struct x11drv_displa
for (display_idx = 0; display_idx < display_count; ++display_idx) for (display_idx = 0; display_idx < display_count; ++display_idx)
{ {
if (displays[display_idx].placed && if (displays[display_idx].placed &&
IntersectRect(&intersect, &displays[display_idx].new_rect, rect)) intersect_rect(&intersect, &displays[display_idx].new_rect, rect))
return TRUE; return TRUE;
} }
return FALSE; return FALSE;

View File

@ -2309,7 +2309,7 @@ static inline BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rec
{ {
*surface_rect = NtUserGetVirtualScreenRect(); *surface_rect = NtUserGetVirtualScreenRect();
if (!IntersectRect( surface_rect, surface_rect, visible_rect )) return FALSE; if (!intersect_rect( surface_rect, surface_rect, visible_rect )) return FALSE;
OffsetRect( surface_rect, -visible_rect->left, -visible_rect->top ); OffsetRect( surface_rect, -visible_rect->left, -visible_rect->top );
surface_rect->left &= ~31; surface_rect->left &= ~31;
surface_rect->top &= ~31; surface_rect->top &= ~31;
@ -2761,7 +2761,7 @@ BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info,
if (info->prcDirty) if (info->prcDirty)
{ {
IntersectRect( &rect, &rect, info->prcDirty ); intersect_rect( &rect, &rect, info->prcDirty );
memcpy( src_bits, dst_bits, bmi->bmiHeader.biSizeImage ); memcpy( src_bits, dst_bits, bmi->bmiHeader.biSizeImage );
NtGdiPatBlt( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, BLACKNESS ); NtGdiPatBlt( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, BLACKNESS );
} }

View File

@ -885,6 +885,15 @@ static inline HWND get_active_window(void)
return NtUserGetGUIThreadInfo( GetCurrentThreadId(), &info ) ? info.hwndActive : 0; return NtUserGetGUIThreadInfo( GetCurrentThreadId(), &info ) ? info.hwndActive : 0;
} }
static inline BOOL intersect_rect( RECT *dst, const RECT *src1, const RECT *src2 )
{
dst->left = max( src1->left, src2->left );
dst->top = max( src1->top, src2->top );
dst->right = min( src1->right, src2->right );
dst->bottom = min( src1->bottom, src2->bottom );
return !IsRectEmpty( dst );
}
/* registry helpers */ /* registry helpers */
extern HKEY open_hkcu_key( const char *name ) DECLSPEC_HIDDEN; extern HKEY open_hkcu_key( const char *name ) DECLSPEC_HIDDEN;