Module: wine Branch: master Commit: 39f79d73fa129e950001387ea0540be84fec9d4a URL: https://gitlab.winehq.org/wine/wine/-/commit/39f79d73fa129e950001387ea0540be...
Author: Rémi Bernon rbernon@codeweavers.com Date: Wed May 29 14:50:58 2024 +0200
wineandroid: Remove now unnecessary set_surface_region calls.
---
dlls/wineandroid.drv/android.h | 1 - dlls/wineandroid.drv/init.c | 1 - dlls/wineandroid.drv/window.c | 81 ++++++++---------------------------------- 3 files changed, 14 insertions(+), 69 deletions(-)
diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h index e793d103788..2512976089b 100644 --- a/dlls/wineandroid.drv/android.h +++ b/dlls/wineandroid.drv/android.h @@ -95,7 +95,6 @@ extern LRESULT ANDROID_DesktopWindowProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM extern void ANDROID_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags ); extern void ANDROID_SetParent( HWND hwnd, HWND parent, HWND old_parent ); -extern void ANDROID_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw ); extern void ANDROID_SetCapture( HWND hwnd, UINT flags ); extern void ANDROID_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style ); extern UINT ANDROID_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp ); diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index d48c4153b06..5b4ec59d2fa 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -346,7 +346,6 @@ static const struct user_driver_funcs android_drv_funcs = .pSetCapture = ANDROID_SetCapture, .pSetLayeredWindowAttributes = ANDROID_SetLayeredWindowAttributes, .pSetParent = ANDROID_SetParent, - .pSetWindowRgn = ANDROID_SetWindowRgn, .pSetWindowStyle = ANDROID_SetWindowStyle, .pShowWindow = ANDROID_ShowWindow, .pUpdateLayeredWindow = ANDROID_UpdateLayeredWindow, diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index 61ebc097f47..d04649da69f 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -70,8 +70,6 @@ static inline int context_idx( HWND hwnd ) return LOWORD( hwnd ) >> 1; }
-static void set_surface_region( struct window_surface *window_surface, HRGN win_region ); - /* only for use on sanitized BITMAPINFO structures */ static inline int get_dib_info_size( const BITMAPINFO *info, UINT coloruse ) { @@ -654,6 +652,8 @@ static void *android_surface_get_bitmap_info( struct window_surface *window_surf static void android_surface_set_region( struct window_surface *window_surface, HRGN region ) { struct android_window_surface *surface = get_android_surface( window_surface ); + RGNDATA *data; + UINT size;
TRACE( "updating surface %p hwnd %p with %p\n", surface, window_surface->hwnd, region );
@@ -668,8 +668,19 @@ static void android_surface_set_region( struct window_surface *window_surface, H if (!surface->region) surface->region = NtGdiCreateRectRgn( 0, 0, 0, 0 ); NtGdiCombineRgn( surface->region, region, 0, RGN_COPY ); } + + if (!(size = NtGdiGetRegionData( region, 0, NULL ))) goto done; + if (!(data = malloc( size ))) goto done; + if (!NtGdiGetRegionData( region, size, data )) + { + free( data ); + data = NULL; + } + free( surface->region_data ); + surface->region_data = data; + +done: window_surface_unlock( window_surface ); - set_surface_region( &surface->header, (HRGN)1 ); }
/*********************************************************************** @@ -791,53 +802,6 @@ static void set_color_key( struct android_window_surface *surface, COLORREF key surface->color_key = (GetRValue(key) << 16) | (GetGValue(key) << 8) | GetBValue(key); }
-/*********************************************************************** - * set_surface_region - */ -static void set_surface_region( struct window_surface *window_surface, HRGN win_region ) -{ - struct android_window_surface *surface = get_android_surface( window_surface ); - struct android_win_data *win_data; - HRGN region = win_region; - RGNDATA *data = NULL; - DWORD size; - int offset_x, offset_y; - - if (window_surface->funcs != &android_surface_funcs) return; /* we may get the null surface */ - - if (!(win_data = get_win_data( window_surface->hwnd ))) return; - offset_x = win_data->window_rect.left - win_data->whole_rect.left; - offset_y = win_data->window_rect.top - win_data->whole_rect.top; - release_win_data( win_data ); - - if (win_region == (HRGN)1) /* hack: win_region == 1 means retrieve region from server */ - { - region = NtGdiCreateRectRgn( 0, 0, win_data->window_rect.right - win_data->window_rect.left, - win_data->window_rect.bottom - win_data->window_rect.top ); - if (NtUserGetWindowRgnEx( window_surface->hwnd, region, 0 ) == ERROR && !surface->region) goto done; - } - - NtGdiOffsetRgn( region, offset_x, offset_y ); - if (surface->region) NtGdiCombineRgn( region, region, surface->region, RGN_AND ); - - if (!(size = NtGdiGetRegionData( region, 0, NULL ))) goto done; - if (!(data = malloc( size ))) goto done; - - if (!NtGdiGetRegionData( region, size, data )) - { - free( data ); - data = NULL; - } - -done: - window_surface_lock( window_surface ); - free( surface->region_data ); - surface->region_data = data; - window_surface->bounds = surface->header.rect; - window_surface_unlock( window_surface ); - if (region != win_region) NtGdiDeleteObjectApp( region ); -} - /*********************************************************************** * create_surface */ @@ -860,7 +824,6 @@ static struct window_surface *create_surface( HWND hwnd, const RECT *rect, surface->window = get_ioctl_window( hwnd ); surface->alpha = alpha; set_color_key( surface, color_key ); - set_surface_region( &surface->header, (HRGN)1 );
if (!(surface->bits = malloc( surface->info.bmiHeader.biSizeImage ))) goto failed; @@ -1435,22 +1398,6 @@ void ANDROID_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style ) }
-/*********************************************************************** - * ANDROID_SetWindowRgn - */ -void ANDROID_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw ) -{ - struct android_win_data *data; - - if ((data = get_win_data( hwnd ))) - { - if (data->surface) set_surface_region( data->surface, hrgn ); - release_win_data( data ); - } - else FIXME( "not supported on other process window %p\n", hwnd ); -} - - /*********************************************************************** * ANDROID_SetLayeredWindowAttributes */