[PATCH v2 5/8] winex11: Use inline intersect_rect helper instead of IntersectRect.
Jacek Caban
wine at gitlab.winehq.org
Thu Apr 28 07:31:11 CDT 2022
From: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
---
dlls/winex11.drv/bitblt.c | 2 +-
dlls/winex11.drv/display.c | 4 ++--
dlls/winex11.drv/init.c | 2 +-
dlls/winex11.drv/settings.c | 2 +-
dlls/winex11.drv/window.c | 4 ++--
dlls/winex11.drv/x11drv.h | 9 +++++++++
6 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c
index 550c5f06f37..e21f975ef4a 100644
--- a/dlls/winex11.drv/bitblt.c
+++ b/dlls/winex11.drv/bitblt.c
@@ -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.height = surface->header.rect.bottom - surface->header.rect.top;
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",
surface, coords.width, coords.height,
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c
index f90cc455c36..aef4ed0b5b0 100644
--- a/dlls/winex11.drv/display.c
+++ b/dlls/winex11.drv/display.c
@@ -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.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));
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],
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));
XFree(work_area);
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c
index 9c5c394581b..27e070ef9b4 100644
--- a/dlls/winex11.drv/init.c
+++ b/dlls/winex11.drv/init.c
@@ -147,7 +147,7 @@ void add_device_bounds( X11DRV_PDEVICE *dev, const RECT *rect )
if (!dev->bounds) return;
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 );
}
diff --git a/dlls/winex11.drv/settings.c b/dlls/winex11.drv/settings.c
index 652dedce601..44c61776b4b 100644
--- a/dlls/winex11.drv/settings.c
+++ b/dlls/winex11.drv/settings.c
@@ -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)
{
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 FALSE;
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 6771368671a..d7027032465 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -2309,7 +2309,7 @@ static inline BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rec
{
*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 );
surface_rect->left &= ~31;
surface_rect->top &= ~31;
@@ -2761,7 +2761,7 @@ BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info,
if (info->prcDirty)
{
- IntersectRect( &rect, &rect, info->prcDirty );
+ intersect_rect( &rect, &rect, info->prcDirty );
memcpy( src_bits, dst_bits, bmi->bmiHeader.biSizeImage );
NtGdiPatBlt( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, BLACKNESS );
}
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 69aa69404f4..4576564fda3 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -885,6 +885,15 @@ static inline HWND get_active_window(void)
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 */
extern HKEY open_hkcu_key( const char *name ) DECLSPEC_HIDDEN;
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/11
More information about the wine-devel
mailing list