[PATCH 0/1] MR11102: win32u: Always consider newly created shape updated in set_surface_shape().
From: Paul Gofman <pgofman@codeweavers.com> --- dlls/win32u/dce.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index cf641c4ec2b..ad27cb143ae 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -416,20 +416,23 @@ static BOOL set_surface_shape( struct window_surface *surface, const RECT *rect, char shape_buf[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; BITMAPINFO *shape_info = (BITMAPINFO *)shape_buf; COLORREF color_key = surface->color_key; - void *shape_bits, *old_shape; + void *shape_bits, *old_shape = NULL; RECT *shape_rect, tmp_rect; WINEREGION *data; - BOOL ret; + BOOL ret, is_new; width = color_info->bmiHeader.biWidth; height = abs( color_info->bmiHeader.biHeight ); assert( !(width & 7) ); /* expect 1bpp bitmap to be aligned on bytes */ - if (!surface->shape_bitmap) surface->shape_bitmap = NtGdiCreateBitmap( width, height, 1, 1, NULL ); + if ((is_new = !surface->shape_bitmap)) surface->shape_bitmap = NtGdiCreateBitmap( width, height, 1, 1, NULL ); if (!(shape_bits = window_surface_get_shape( surface, shape_info ))) return FALSE; - old_shape = malloc( shape_info->bmiHeader.biSizeImage ); - memcpy( old_shape, shape_bits, shape_info->bmiHeader.biSizeImage ); + if (!is_new) + { + old_shape = malloc( shape_info->bmiHeader.biSizeImage ); + memcpy( old_shape, shape_bits, shape_info->bmiHeader.biSizeImage ); + } color_stride = color_info->bmiHeader.biSizeImage / height; shape_stride = shape_info->bmiHeader.biSizeImage / abs( shape_info->bmiHeader.biHeight ); @@ -499,7 +502,7 @@ static BOOL set_surface_shape( struct window_surface *surface, const RECT *rect, } } - ret = memcmp( old_shape, shape_bits, shape_info->bmiHeader.biSizeImage ); + ret = is_new || memcmp( old_shape, shape_bits, shape_info->bmiHeader.biSizeImage ); free( old_shape ); return ret; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11102
Currently when the new shape bitmap is created for the first time and if color key is white the resulting shape is all 0 which compares as unchanged with the newly created shape bitmap data, and so the surface flush does not set the new shape (until something is changed in it). That helps Imperiums: Greek Wars launcher under Gamescope which now shows white background behind the launcher window. That regressed with commit 18339eb0f5048500efb668e6a9b679ed2f62d7a3 ("win32u: Initialize surface with white colour on creation.") while the same underlying issue was present before, just for black color key instead of white. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11102#note_142572
participants (2)
-
Paul Gofman -
Paul Gofman (@gofman)