From: Rémi Bernon rbernon@codeweavers.com
--- dlls/wineandroid.drv/window.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index 764b202d6e5..8b39852ee08 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -670,8 +670,7 @@ static BOOL android_surface_flush( struct window_surface *window_surface, const locked.bottom = rc.bottom; intersect_rect( &locked, &locked, rect );
- src = (DWORD *)window_surface->color_bits + (locked.top - rect->top) * surface->info.bmiHeader.biWidth + - (locked.left - rect->left); + src = (DWORD *)window_surface->color_bits + locked.top * surface->info.bmiHeader.biWidth + locked.left; dst = (DWORD *)buffer.bits + locked.top * buffer.stride + locked.left; width = min( locked.right - locked.left, buffer.stride );
@@ -1121,15 +1120,13 @@ static struct android_win_data *create_win_data( HWND hwnd, const RECT *window_r }
-static inline BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rect ) +static RECT get_surface_rect( RECT rect ) { - if (!intersect_rect( surface_rect, visible_rect, &virtual_screen_rect )) return FALSE; - OffsetRect( surface_rect, -visible_rect->left, -visible_rect->top ); - surface_rect->left &= ~31; - surface_rect->top &= ~31; - surface_rect->right = max( surface_rect->left + 32, (surface_rect->right + 31) & ~31 ); - surface_rect->bottom = max( surface_rect->top + 32, (surface_rect->bottom + 31) & ~31 ); - return TRUE; + OffsetRect( &rect, -rect.left, -rect.top ); + /* round surface size to avoid re-creating them on every resize */ + rect.right = max( rect.left + 32, (rect.right + 31) & ~31 ); + rect.bottom = max( rect.top + 32, (rect.bottom + 31) & ~31 ); + return rect; }
@@ -1139,7 +1136,7 @@ static inline BOOL get_surface_rect( const RECT *visible_rect, RECT *surface_rec BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect ) { struct android_win_data *data = get_win_data( hwnd ); - RECT surface_rect; + RECT virtual_rect; BOOL ret = FALSE;
TRACE( "win %p window %s client %s style %08x flags %08x\n", @@ -1151,7 +1148,9 @@ BOOL ANDROID_WindowPosChanging( HWND hwnd, UINT swp_flags, const RECT *window_re if (data->parent) goto done; /* use default surface */ if (swp_flags & SWP_HIDEWINDOW) goto done; /* use default surface */ if (is_argb_surface( data->surface )) goto done; /* use default surface */ - if (!get_surface_rect( visible_rect, &surface_rect )) goto done; /* use default surface */ + + virtual_rect = NtUserGetVirtualScreenRect(); + if (!intersect_rect( &virtual_rect, &virtual_rect, visible_rect )) goto done; /* use default surface */
ret = TRUE;
@@ -1176,8 +1175,8 @@ BOOL ANDROID_CreateWindowSurface( HWND hwnd, UINT swp_flags, const RECT *visible TRACE( "hwnd %p, swp_flags %08x, visible %s, surface %p\n", hwnd, swp_flags, wine_dbgstr_rect( visible_rect ), surface );
if (!(data = get_win_data( hwnd ))) return TRUE; /* use default surface */ - if (!get_surface_rect( visible_rect, &surface_rect )) goto done; /* use default surface */
+ surface_rect = get_surface_rect( *visible_rect ); if (data->surface) { if (!memcmp( &data->surface->rect, &surface_rect, sizeof(surface_rect) ))