[PATCH 3/5] user32: Add RECT bounds member to struct window_surface.
Rémi Bernon
rbernon at codeweavers.com
Mon May 10 02:55:11 CDT 2021
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/gdi.exe16/gdi.c | 3 +--
dlls/wineandroid.drv/window.c | 9 ++++-----
dlls/winemac.drv/surface.c | 13 ++++++-------
dlls/winex11.drv/bitblt.c | 13 ++++++-------
include/wine/gdi_driver.h | 1 +
5 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/dlls/gdi.exe16/gdi.c b/dlls/gdi.exe16/gdi.c
index 9afa4532fde..2a0b245e190 100644
--- a/dlls/gdi.exe16/gdi.c
+++ b/dlls/gdi.exe16/gdi.c
@@ -435,7 +435,6 @@ static void free_segptr_bits( HBITMAP16 bmp )
struct dib_window_surface
{
struct window_surface header;
- RECT bounds;
void *bits;
UINT info_size;
BITMAPINFO info; /* variable size, must be last */
@@ -480,7 +479,7 @@ static RECT *CDECL dib_surface_get_bounds( struct window_surface *window_surface
{
struct dib_window_surface *surface = get_dib_surface( window_surface );
- return &surface->bounds;
+ return &surface->header.bounds;
}
/***********************************************************************
diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c
index 53b0ef5a11e..0f84a186d5d 100644
--- a/dlls/wineandroid.drv/window.c
+++ b/dlls/wineandroid.drv/window.c
@@ -580,7 +580,6 @@ struct android_window_surface
struct window_surface header;
HWND hwnd;
ANativeWindow *window;
- RECT bounds;
BOOL byteswap;
RGNDATA *region_data;
HRGN region;
@@ -670,7 +669,7 @@ static RECT *CDECL android_surface_get_bounds( struct window_surface *window_sur
{
struct android_window_surface *surface = get_android_surface( window_surface );
- return &surface->bounds;
+ return &surface->header.bounds;
}
/***********************************************************************
@@ -711,8 +710,8 @@ static void CDECL android_surface_flush( struct window_surface *window_surface )
window_surface_lock( window_surface );
SetRect( &rect, 0, 0, surface->header.rect.right - surface->header.rect.left,
surface->header.rect.bottom - surface->header.rect.top );
- needs_flush = IntersectRect( &rect, &rect, &surface->bounds );
- reset_bounds( &surface->bounds );
+ needs_flush = IntersectRect( &rect, &rect, &surface->header.bounds );
+ reset_bounds( &surface->header.bounds );
window_surface_unlock( window_surface );
if (!needs_flush) return;
@@ -910,7 +909,7 @@ static struct window_surface *create_surface( HWND hwnd, const RECT *rect,
surface->alpha = alpha;
set_color_key( surface, color_key );
set_surface_region( &surface->header, (HRGN)1 );
- reset_bounds( &surface->bounds );
+ reset_bounds( &surface->header.bounds );
if (!(surface->bits = HeapAlloc( GetProcessHeap(), 0, surface->info.bmiHeader.biSizeImage )))
goto failed;
diff --git a/dlls/winemac.drv/surface.c b/dlls/winemac.drv/surface.c
index 65bbe31b89d..757a0b16cca 100644
--- a/dlls/winemac.drv/surface.c
+++ b/dlls/winemac.drv/surface.c
@@ -60,7 +60,6 @@ struct macdrv_window_surface
{
struct window_surface header;
macdrv_window window;
- RECT bounds;
HRGN region;
HRGN drawn;
BOOL use_alpha;
@@ -132,7 +131,7 @@ static RECT *CDECL macdrv_surface_get_bounds(struct window_surface *window_surfa
{
struct macdrv_window_surface *surface = get_mac_surface(window_surface);
- return &surface->bounds;
+ return &surface->header.bounds;
}
/***********************************************************************
@@ -173,12 +172,12 @@ static void CDECL macdrv_surface_flush(struct window_surface *window_surface)
window_surface_lock(window_surface);
TRACE("flushing %p %s bounds %s bits %p\n", surface, wine_dbgstr_rect(&surface->header.rect),
- wine_dbgstr_rect(&surface->bounds), surface->bits);
+ wine_dbgstr_rect(&surface->header.bounds), surface->bits);
- rect = cgrect_from_rect(surface->bounds);
+ rect = cgrect_from_rect(surface->header.bounds);
rect = CGRectOffset(rect, surface->header.rect.left, surface->header.rect.top);
- if (!IsRectEmpty(&surface->bounds) && (region = CreateRectRgnIndirect(&surface->bounds)))
+ if (!IsRectEmpty(&surface->header.bounds) && (region = CreateRectRgnIndirect(&surface->header.bounds)))
{
if (surface->drawn)
{
@@ -189,7 +188,7 @@ static void CDECL macdrv_surface_flush(struct window_surface *window_surface)
surface->drawn = region;
}
update_blit_data(surface);
- reset_bounds(&surface->bounds);
+ reset_bounds(&surface->header.bounds);
window_surface_unlock(window_surface);
@@ -280,7 +279,7 @@ struct window_surface *create_surface(macdrv_window window, const RECT *rect,
surface->header.rect = *rect;
surface->header.ref = 1;
surface->window = window;
- reset_bounds(&surface->bounds);
+ reset_bounds(&surface->header.bounds);
if (old_mac_surface && old_mac_surface->drawn)
{
surface->drawn = CreateRectRgnIndirect(rect);
diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c
index 731be11a181..44bdb02deb6 100644
--- a/dlls/winex11.drv/bitblt.c
+++ b/dlls/winex11.drv/bitblt.c
@@ -1563,7 +1563,6 @@ struct x11drv_window_surface
Window window;
GC gc;
XImage *image;
- RECT bounds;
BOOL byteswap;
BOOL is_argb;
DWORD alpha_bits;
@@ -1831,7 +1830,7 @@ static RECT *CDECL x11drv_surface_get_bounds( struct window_surface *window_surf
{
struct x11drv_window_surface *surface = get_x11_surface( window_surface );
- return &surface->bounds;
+ return &surface->header.bounds;
}
/***********************************************************************
@@ -1881,11 +1880,11 @@ static void CDECL 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 (IntersectRect( &coords.visrect, &coords.visrect, &surface->header.bounds ))
{
TRACE( "flushing %p %dx%d bounds %s bits %p\n",
surface, coords.width, coords.height,
- wine_dbgstr_rect( &surface->bounds ), surface->bits );
+ wine_dbgstr_rect( &surface->header.bounds ), surface->bits );
if (surface->is_argb || surface->color_key != CLR_INVALID) update_surface_region( surface );
@@ -1928,7 +1927,7 @@ static void CDECL x11drv_surface_flush( struct window_surface *window_surface )
coords.visrect.bottom - coords.visrect.top );
XFlush( gdi_display );
}
- reset_bounds( &surface->bounds );
+ reset_bounds( &surface->header.bounds );
window_surface_unlock( window_surface );
}
@@ -2004,7 +2003,7 @@ struct window_surface *create_surface( Window window, const XVisualInfo *vis, co
surface->window = window;
surface->is_argb = (use_alpha && vis->depth == 32 && surface->info.bmiHeader.biCompression == BI_RGB);
set_color_key( surface, color_key );
- reset_bounds( &surface->bounds );
+ reset_bounds( &surface->header.bounds );
#ifdef HAVE_LIBXXSHM
surface->image = create_shm_image( vis, width, height, &surface->shminfo );
@@ -2075,7 +2074,7 @@ HRGN expose_surface( struct window_surface *window_surface, const RECT *rect )
window_surface_lock( window_surface );
OffsetRect( &rc, -window_surface->rect.left, -window_surface->rect.top );
- add_bounds_rect( &surface->bounds, &rc );
+ add_bounds_rect( &surface->header.bounds, &rc );
if (surface->region)
{
region = CreateRectRgnIndirect( rect );
diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h
index 0667b3758a3..8cc69521505 100644
--- a/include/wine/gdi_driver.h
+++ b/include/wine/gdi_driver.h
@@ -253,6 +253,7 @@ struct window_surface
LONG ref; /* reference count */
RECT rect; /* constant, no locking needed */
CRITICAL_SECTION cs; /* critical section for locking */
+ RECT bounds; /* access requires locking */
/* driver-specific fields here */
};
--
2.31.0
More information about the wine-devel
mailing list