From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/dce.c | 27 +++++---------------------- dlls/win32u/dibdrv/dc.c | 2 +- dlls/wineandroid.drv/window.c | 25 ++++++------------------- dlls/winemac.drv/surface.c | 25 ++++++------------------- dlls/winemac.drv/window.c | 6 ++---- dlls/winewayland.drv/window_surface.c | 18 +++--------------- dlls/winex11.drv/bitblt.c | 24 +++++------------------- dlls/winex11.drv/window.c | 2 +- include/wine/gdi_driver.h | 2 +- 9 files changed, 30 insertions(+), 101 deletions(-)
diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index 2fa149d8d90..a97a21d072c 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -74,12 +74,6 @@ static void *dummy_surface_get_bitmap_info( struct window_surface *window_surfac return &dummy_data; }
-static RECT *dummy_surface_get_bounds( struct window_surface *window_surface ) -{ - static RECT dummy_bounds; - return &dummy_bounds; -} - static void dummy_surface_set_region( struct window_surface *window_surface, HRGN region ) { /* nothing to do */ @@ -98,7 +92,6 @@ static void dummy_surface_destroy( struct window_surface *window_surface ) static const struct window_surface_funcs dummy_surface_funcs = { dummy_surface_get_bitmap_info, - dummy_surface_get_bounds, dummy_surface_set_region, dummy_surface_flush, dummy_surface_destroy @@ -113,7 +106,6 @@ struct window_surface dummy_surface = { &dummy_surface_funcs, { NULL, NULL }, 1, struct offscreen_window_surface { struct window_surface header; - RECT bounds; char *bits; BITMAPINFO info; }; @@ -126,12 +118,6 @@ static struct offscreen_window_surface *impl_from_window_surface( struct window_ return CONTAINING_RECORD( base, struct offscreen_window_surface, header ); }
-static RECT *offscreen_window_surface_get_bounds( struct window_surface *base ) -{ - struct offscreen_window_surface *impl = impl_from_window_surface( base ); - return &impl->bounds; -} - static void *offscreen_window_surface_get_bitmap_info( struct window_surface *base, BITMAPINFO *info ) { struct offscreen_window_surface *impl = impl_from_window_surface( base ); @@ -143,12 +129,11 @@ static void offscreen_window_surface_set_region( struct window_surface *base, HR { }
-static void offscreen_window_surface_flush( struct window_surface *base ) +static void offscreen_window_surface_flush( struct window_surface *surface ) { - struct offscreen_window_surface *impl = impl_from_window_surface( base ); - window_surface_lock( base ); - reset_bounds( &impl->bounds ); - window_surface_unlock( base ); + window_surface_lock( surface ); + reset_bounds( &surface->bounds ); + window_surface_unlock( surface ); }
static void offscreen_window_surface_destroy( struct window_surface *base ) @@ -160,7 +145,6 @@ static void offscreen_window_surface_destroy( struct window_surface *base ) static const struct window_surface_funcs offscreen_window_surface_funcs = { offscreen_window_surface_get_bitmap_info, - offscreen_window_surface_get_bounds, offscreen_window_surface_set_region, offscreen_window_surface_flush, offscreen_window_surface_destroy @@ -193,8 +177,6 @@ void create_offscreen_window_surface( const RECT *visible_rect, struct window_su if (!(impl = calloc(1, offsetof( struct offscreen_window_surface, info.bmiColors[0] ) + size))) return; window_surface_init( &impl->header, &offscreen_window_surface_funcs, &surface_rect );
- reset_bounds( &impl->bounds ); - impl->bits = (char *)&impl->info.bmiColors[0]; impl->info.bmiHeader.biSize = sizeof( impl->info ); impl->info.bmiHeader.biWidth = surface_rect.right; @@ -217,6 +199,7 @@ W32KAPI void window_surface_init( struct window_surface *surface, const struct w surface->ref = 1; surface->rect = *rect; pthread_mutex_init( &surface->mutex, NULL ); + reset_bounds( &surface->bounds ); }
W32KAPI void window_surface_add_ref( struct window_surface *surface ) diff --git a/dlls/win32u/dibdrv/dc.c b/dlls/win32u/dibdrv/dc.c index f1e5f2c9d6b..6050923b9c4 100644 --- a/dlls/win32u/dibdrv/dc.c +++ b/dlls/win32u/dibdrv/dc.c @@ -806,7 +806,7 @@ void dibdrv_set_window_surface( DC *dc, struct window_surface *surface ) init_dib_info_from_bitmapinfo( &dibdrv->dib, info, bits ); dibdrv->dib.rect = dc->attr->vis_rect; OffsetRect( &dibdrv->dib.rect, -dc->device_rect.left, -dc->device_rect.top ); - dibdrv->bounds = surface->funcs->get_bounds( surface ); + dibdrv->bounds = &surface->bounds; DC_InitDC( dc ); } else if (windev) diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index 669ad7a6b2e..8314876f1c4 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -573,7 +573,6 @@ struct android_window_surface struct window_surface header; HWND hwnd; ANativeWindow *window; - RECT bounds; BOOL byteswap; RGNDATA *region_data; HRGN region; @@ -656,16 +655,6 @@ static void *android_surface_get_bitmap_info( struct window_surface *window_surf return surface->bits; }
-/*********************************************************************** - * android_surface_get_bounds - */ -static RECT *android_surface_get_bounds( struct window_surface *window_surface ) -{ - struct android_window_surface *surface = get_android_surface( window_surface ); - - return &surface->bounds; -} - /*********************************************************************** * android_surface_set_region */ @@ -704,8 +693,8 @@ static void 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 = intersect_rect( &rect, &rect, &surface->bounds ); - reset_bounds( &surface->bounds ); + needs_flush = intersect_rect( &rect, &rect, &window_surface->bounds ); + reset_bounds( &window_surface->bounds ); window_surface_unlock( window_surface ); if (!needs_flush) return;
@@ -792,7 +781,6 @@ static void android_surface_destroy( struct window_surface *window_surface ) static const struct window_surface_funcs android_surface_funcs = { android_surface_get_bitmap_info, - android_surface_get_bounds, android_surface_set_region, android_surface_flush, android_surface_destroy @@ -865,7 +853,7 @@ done: window_surface_lock( window_surface ); free( surface->region_data ); surface->region_data = data; - *window_surface->funcs->get_bounds( window_surface ) = surface->header.rect; + window_surface->bounds = surface->header.rect; window_surface_unlock( window_surface ); if (region != win_region) NtGdiDeleteObjectApp( region ); } @@ -894,7 +882,6 @@ 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 );
if (!(surface->bits = malloc( surface->info.bmiHeader.biSizeImage ))) goto failed; @@ -926,7 +913,7 @@ static void set_surface_layered( struct window_surface *window_surface, BYTE alp surface->alpha = alpha; set_color_key( surface, color_key ); if (alpha != prev_alpha || surface->color_key != prev_key) /* refresh */ - *window_surface->funcs->get_bounds( window_surface ) = surface->header.rect; + window_surface->bounds = surface->header.rect; window_surface_unlock( window_surface ); }
@@ -1579,7 +1566,7 @@ BOOL ANDROID_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info if (ret) { memcpy( dst_bits, src_bits, bmi->bmiHeader.biSizeImage ); - add_bounds_rect( surface->funcs->get_bounds( surface ), &rect ); + add_bounds_rect( &surface->bounds, &rect ); }
window_surface_unlock( surface ); @@ -1613,7 +1600,7 @@ LRESULT ANDROID_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) if (surface) { window_surface_lock( surface ); - *surface->funcs->get_bounds( surface ) = surface->rect; + surface->bounds = surface->rect; window_surface_unlock( surface ); if (is_argb_surface( surface )) surface->funcs->flush( surface ); } diff --git a/dlls/winemac.drv/surface.c b/dlls/winemac.drv/surface.c index 82cf7f57eb7..314e9e68542 100644 --- a/dlls/winemac.drv/surface.c +++ b/dlls/winemac.drv/surface.c @@ -64,7 +64,6 @@ struct macdrv_window_surface { struct window_surface header; macdrv_window window; - RECT bounds; HRGN region; HRGN drawn; BOOL use_alpha; @@ -108,16 +107,6 @@ static void *macdrv_surface_get_bitmap_info(struct window_surface *window_surfac return surface->bits; }
-/*********************************************************************** - * macdrv_surface_get_bounds - */ -static RECT *macdrv_surface_get_bounds(struct window_surface *window_surface) -{ - struct macdrv_window_surface *surface = get_mac_surface(window_surface); - - return &surface->bounds; -} - /*********************************************************************** * macdrv_surface_set_region */ @@ -156,14 +145,14 @@ static void 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(&window_surface->bounds), surface->bits);
- rect = cgrect_from_rect(surface->bounds); + rect = cgrect_from_rect(window_surface->bounds); rect = CGRectOffset(rect, surface->header.rect.left, surface->header.rect.top);
- if (!IsRectEmpty(&surface->bounds) && - (region = NtGdiCreateRectRgn(surface->bounds.left, surface->bounds.top, - surface->bounds.right, surface->bounds.bottom))) + if (!IsRectEmpty(&window_surface->bounds) && + (region = NtGdiCreateRectRgn(window_surface->bounds.left, window_surface->bounds.top, + window_surface->bounds.right, window_surface->bounds.bottom))) { if (surface->drawn) { @@ -174,7 +163,7 @@ static void macdrv_surface_flush(struct window_surface *window_surface) surface->drawn = region; } update_blit_data(surface); - reset_bounds(&surface->bounds); + reset_bounds(&window_surface->bounds);
window_surface_unlock(window_surface);
@@ -200,7 +189,6 @@ static void macdrv_surface_destroy(struct window_surface *window_surface) static const struct window_surface_funcs macdrv_surface_funcs = { macdrv_surface_get_bitmap_info, - macdrv_surface_get_bounds, macdrv_surface_set_region, macdrv_surface_flush, macdrv_surface_destroy, @@ -243,7 +231,6 @@ struct window_surface *create_surface(macdrv_window window, const RECT *rect, colors[2] = 0x000000ff;
surface->window = window; - reset_bounds(&surface->bounds); if (old_mac_surface && old_mac_surface->drawn) { surface->drawn = NtGdiCreateRectRgn(rect->left, rect->top, rect->right, rect->bottom); diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index d04ebe39bfa..05ba3e994d7 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -504,14 +504,12 @@ static void sync_window_opacity(struct macdrv_win_data *data, COLORREF key, BYTE
if (needs_flush && data->surface) { - RECT *bounds; RECT rect;
rect = data->whole_rect; OffsetRect(&rect, -data->whole_rect.left, -data->whole_rect.top); window_surface_lock(data->surface); - bounds = data->surface->funcs->get_bounds(data->surface); - add_bounds_rect(bounds, &rect); + add_bounds_rect(&data->surface->bounds, &rect); window_surface_unlock(data->surface); } } @@ -1985,7 +1983,7 @@ BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, { window_surface_lock(surface); memcpy(dst_bits, src_bits, bmi->bmiHeader.biSizeImage); - add_bounds_rect(surface->funcs->get_bounds(surface), &rect); + add_bounds_rect(&surface->bounds, &rect); window_surface_unlock(surface); surface->funcs->flush(surface); } diff --git a/dlls/winewayland.drv/window_surface.c b/dlls/winewayland.drv/window_surface.c index 4c8d3956408..adcbf593984 100644 --- a/dlls/winewayland.drv/window_surface.c +++ b/dlls/winewayland.drv/window_surface.c @@ -46,7 +46,6 @@ struct wayland_window_surface HWND hwnd; struct wayland_surface *wayland_surface; struct wayland_buffer_queue *wayland_buffer_queue; - RECT bounds; void *bits; BITMAPINFO info; }; @@ -231,15 +230,6 @@ static void *wayland_window_surface_get_bitmap_info(struct window_surface *windo return surface->bits; }
-/*********************************************************************** - * wayland_window_surface_get_bounds - */ -static RECT *wayland_window_surface_get_bounds(struct window_surface *window_surface) -{ - struct wayland_window_surface *wws = wayland_window_surface_cast(window_surface); - return &wws->bounds; -} - /*********************************************************************** * wayland_window_surface_set_region */ @@ -362,7 +352,7 @@ static void wayland_window_surface_flush(struct window_surface *window_surface)
window_surface_lock(window_surface);
- if (!intersect_rect(&damage_rect, &wws->header.rect, &wws->bounds)) goto done; + if (!intersect_rect(&damage_rect, &wws->header.rect, &window_surface->bounds)) goto done;
if (!wws->wayland_surface || !wws->wayland_buffer_queue) { @@ -372,7 +362,7 @@ static void wayland_window_surface_flush(struct window_surface *window_surface) }
TRACE("surface=%p hwnd=%p surface_rect=%s bounds=%s\n", wws, wws->hwnd, - wine_dbgstr_rect(&wws->header.rect), wine_dbgstr_rect(&wws->bounds)); + wine_dbgstr_rect(&wws->header.rect), wine_dbgstr_rect(&window_surface->bounds));
surface_damage_region = NtGdiCreateRectRgn(damage_rect.left, damage_rect.top, damage_rect.right, damage_rect.bottom); @@ -448,7 +438,7 @@ static void wayland_window_surface_flush(struct window_surface *window_surface) wayland_shm_buffer_ref((wws->wayland_surface->latest_window_buffer = shm_buffer));
done: - if (flushed) reset_bounds(&wws->bounds); + if (flushed) reset_bounds(&window_surface->bounds); if (surface_damage_region) NtGdiDeleteObjectApp(surface_damage_region); window_surface_unlock(window_surface); } @@ -471,7 +461,6 @@ static void wayland_window_surface_destroy(struct window_surface *window_surface static const struct window_surface_funcs wayland_window_surface_funcs = { wayland_window_surface_get_bitmap_info, - wayland_window_surface_get_bounds, wayland_window_surface_set_region, wayland_window_surface_flush, wayland_window_surface_destroy @@ -502,7 +491,6 @@ struct window_surface *wayland_window_surface_create(HWND hwnd, const RECT *rect wws->info.bmiHeader.biSizeImage = width * height * 4;
wws->hwnd = hwnd; - reset_bounds(&wws->bounds);
if (!(wws->bits = malloc(wws->info.bmiHeader.biSizeImage))) goto failed; diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index c19836c31a3..ad262d84496 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -1577,7 +1577,6 @@ struct x11drv_window_surface Window window; GC gc; XImage *image; - RECT bounds; BOOL byteswap; BOOL is_argb; DWORD alpha_bits; @@ -1838,16 +1837,6 @@ static void *x11drv_surface_get_bitmap_info( struct window_surface *window_surfa return surface->bits; }
-/*********************************************************************** - * x11drv_surface_get_bounds - */ -static RECT *x11drv_surface_get_bounds( struct window_surface *window_surface ) -{ - struct x11drv_window_surface *surface = get_x11_surface( window_surface ); - - return &surface->bounds; -} - /*********************************************************************** * x11drv_surface_set_region */ @@ -1895,11 +1884,10 @@ 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 (intersect_rect( &coords.visrect, &coords.visrect, &surface->bounds )) + if (intersect_rect( &coords.visrect, &coords.visrect, &window_surface->bounds )) { - TRACE( "flushing %p %dx%d bounds %s bits %p\n", - surface, coords.width, coords.height, - wine_dbgstr_rect( &surface->bounds ), surface->bits ); + TRACE( "flushing %p %dx%d bounds %s bits %p\n", surface, coords.width, coords.height, + wine_dbgstr_rect( &window_surface->bounds ), surface->bits );
if (surface->is_argb || surface->color_key != CLR_INVALID) update_surface_region( surface );
@@ -1942,7 +1930,7 @@ static void x11drv_surface_flush( struct window_surface *window_surface ) coords.visrect.bottom - coords.visrect.top ); XFlush( gdi_display ); } - reset_bounds( &surface->bounds ); + reset_bounds( &window_surface->bounds ); window_surface_unlock( window_surface ); }
@@ -1978,7 +1966,6 @@ static void x11drv_surface_destroy( struct window_surface *window_surface ) static const struct window_surface_funcs x11drv_surface_funcs = { x11drv_surface_get_bitmap_info, - x11drv_surface_get_bounds, x11drv_surface_set_region, x11drv_surface_flush, x11drv_surface_destroy @@ -2010,7 +1997,6 @@ 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 );
#ifdef HAVE_LIBXXSHM surface->image = create_shm_image( vis, width, height, &surface->shminfo ); @@ -2080,7 +2066,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( &window_surface->bounds, &rc ); if (surface->region) { region = NtGdiCreateRectRgn( rect->left, rect->top, rect->right, rect->bottom ); diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index eb9c5d4d8a8..27f4b10011c 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -3046,7 +3046,7 @@ BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, if (ret) { memcpy( dst_bits, src_bits, bmi->bmiHeader.biSizeImage ); - add_bounds_rect( surface->funcs->get_bounds( surface ), &rect ); + add_bounds_rect( &surface->bounds, &rect ); }
window_surface_unlock( surface ); diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 0104cdbe8ba..cd3e8c6abdc 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -212,7 +212,6 @@ struct window_surface; struct window_surface_funcs { void* (*get_info)( struct window_surface *surface, BITMAPINFO *info ); - RECT* (*get_bounds)( struct window_surface *surface ); void (*set_region)( struct window_surface *surface, HRGN region ); void (*flush)( struct window_surface *surface ); void (*destroy)( struct window_surface *surface ); @@ -226,6 +225,7 @@ struct window_surface RECT rect; /* constant, no locking needed */
pthread_mutex_t mutex; + RECT bounds; /* dirty area rect, requires locking */ DWORD draw_start_ticks; /* start ticks of fresh draw */ /* driver-specific fields here */ };