From d2372d60f0976b2e7a9740491eaebe38b828b690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 4 Jun 2024 11:29:20 +0200 Subject: [PATCH] win32u: Get rid of move_window_bits_parent, using move_window_bits. --- dlls/win32u/dce.c | 47 +++++++----------------------------- dlls/win32u/win32u_private.h | 2 -- dlls/win32u/window.c | 2 +- 3 files changed, 10 insertions(+), 41 deletions(-) diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index 47c624cacc6..57a3ae59eff 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -1189,26 +1189,10 @@ static BOOL send_erase( HWND hwnd, UINT flags, HRGN client_rgn, return need_erase; } -/*********************************************************************** - * copy_bits_from_surface - * - * Copy bits from a window surface; helper for move_window_bits and move_window_bits_parent. - */ -static void copy_bits_from_surface( HWND hwnd, const RECT *dst, const RECT *src ) -{ - UINT flags = UPDATE_NOCHILDREN | UPDATE_CLIPCHILDREN; - HRGN rgn = get_update_region( hwnd, &flags, NULL ); - HDC hdc = NtUserGetDCEx( hwnd, rgn, DCX_CACHE | DCX_WINDOW | DCX_EXCLUDERGN ); - - NtGdiStretchBlt( hdc, dst->left, dst->top, dst->right - dst->left, dst->bottom - dst->top, - hdc, src->left, src->top, src->right - src->left, src->bottom - src->top, SRCCOPY, 0 ); - NtUserReleaseDC( hwnd, hdc ); -} - /*********************************************************************** * move_window_bits * - * Move the window bits when a window is resized. + * Move the window bits when a window is resized, or moved within a parent window. */ void move_window_bits( HWND hwnd, const RECT *visible_rect, const RECT *old_visible_rect, const RECT *window_rect, const RECT *valid_rects ) @@ -1219,10 +1203,17 @@ void move_window_bits( HWND hwnd, const RECT *visible_rect, const RECT *old_visi if (src.left - old_visible_rect->left != dst.left - visible_rect->left || src.top - old_visible_rect->top != dst.top - visible_rect->top) { + UINT flags = UPDATE_NOCHILDREN | UPDATE_CLIPCHILDREN; + HRGN rgn = get_update_region( hwnd, &flags, NULL ); + HDC hdc = NtUserGetDCEx( hwnd, rgn, DCX_CACHE | DCX_WINDOW | DCX_EXCLUDERGN ); + TRACE( "copying %s -> %s\n", wine_dbgstr_rect( &src ), wine_dbgstr_rect( &dst )); OffsetRect( &src, -window_rect->left, -window_rect->top ); OffsetRect( &dst, -window_rect->left, -window_rect->top ); - copy_bits_from_surface( hwnd, &dst, &src ); + + NtGdiStretchBlt( hdc, dst.left, dst.top, dst.right - dst.left, dst.bottom - dst.top, + hdc, src.left, src.top, src.right - src.left, src.bottom - src.top, SRCCOPY, 0 ); + NtUserReleaseDC( hwnd, hdc ); } } @@ -1260,26 +1251,6 @@ void move_window_bits_surface( HWND hwnd, const RECT *window_rect, struct window } -/*********************************************************************** - * move_window_bits_parent - * - * Move the window bits in the parent surface when a child is moved. - */ -void move_window_bits_parent( HWND hwnd, const RECT *window_rect, const RECT *valid_rects ) -{ - RECT dst = valid_rects[0]; - RECT src = valid_rects[1]; - - if (src.left != dst.left || src.top != dst.top) - { - TRACE( "copying %s -> %s\n", wine_dbgstr_rect( &src ), wine_dbgstr_rect( &dst )); - OffsetRect( &src, -window_rect->left, -window_rect->top ); - OffsetRect( &dst, -window_rect->left, -window_rect->top ); - - copy_bits_from_surface( hwnd, &dst, &src ); - } -} - /*********************************************************************** * NtUserBeginPaint (win32u.@) */ diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 9ec941ca7d4..6539fb0bff1 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -53,8 +53,6 @@ extern void move_window_bits( HWND hwnd, const RECT *visible_rect, const RECT *o const RECT *window_rect, const RECT *valid_rects ); extern void move_window_bits_surface( HWND hwnd, const RECT *window_rect, struct window_surface *old_surface, const RECT *old_visible_rect, const RECT *valid_rects ); -extern void move_window_bits_parent( HWND hwnd, const RECT *window_rect, - const RECT *valid_rects ); extern void register_window_surface( struct window_surface *old, struct window_surface *new ); diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index b868053796d..0122ac2e4f7 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -1959,7 +1959,7 @@ static BOOL apply_window_pos( HWND hwnd, HWND insert_after, UINT swp_flags, rects[1] = old_visible_rect; valid_rects = rects; } - move_window_bits_parent( hwnd, window_rect, valid_rects ); + move_window_bits( hwnd, &visible_rect, &visible_rect, window_rect, valid_rects ); valid_rects = NULL; /* prevent the driver from trying to also move the bits */ } }