-- v2: win32u: Move UpdateLayeredWindow implementation out of the drivers. win32u: Introduce a new CreateLayeredWindow driver entry. winex11: Use the surface bitmap directly in UpdateLayeredWindow. winex11: Always clear UpdateLayeredWindow target rectangle. winemac: Blend alpha with NtGdiAlphaBlend instead of window opacity. winemac: Use the surface bitmap directly in UpdateLayeredWindow. winemac: Always clear UpdateLayeredWindow target rectangle. wineandroid: Use the surface bitmap directly in UpdateLayeredWindow. wineandroid: Always clear UpdateLayeredWindow target rectangle.
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/wineandroid.drv/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index fa7b87522c5..71664ec2c3f 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -1449,8 +1449,8 @@ BOOL ANDROID_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info { intersect_rect( &rect, &rect, info->prcDirty ); memcpy( src_bits, dst_bits, bmi->bmiHeader.biSizeImage ); - NtGdiPatBlt( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, BLACKNESS ); } + NtGdiPatBlt( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, BLACKNESS ); src_rect = rect; if (info->pptSrc) OffsetRect( &src_rect, info->pptSrc->x, info->pptSrc->y ); NtGdiTransformPoints( info->hdcSrc, (POINT *)&src_rect, (POINT *)&src_rect, 2, NtGdiDPtoLP );
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/wineandroid.drv/window.c | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-)
diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index 71664ec2c3f..55ca444f970 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -1397,12 +1397,8 @@ BOOL ANDROID_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info struct android_win_data *data; BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, 0 }; COLORREF color_key = (info->dwFlags & ULW_COLORKEY) ? info->crKey : CLR_INVALID; - char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; - BITMAPINFO *bmi = (BITMAPINFO *)buffer; - void *src_bits, *dst_bits; RECT rect, src_rect; - HDC hdc = 0; - HBITMAP dib; + HDC hdc; BOOL ret = FALSE;
if (!(data = get_win_data( hwnd ))) return FALSE; @@ -1435,21 +1431,11 @@ BOOL ANDROID_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info return TRUE; }
- dst_bits = surface->funcs->get_info( surface, bmi ); - - if (!(dib = NtGdiCreateDIBSection( info->hdcDst, NULL, 0, bmi, DIB_RGB_COLORS, 0, 0, 0, &src_bits ))) - goto done; if (!(hdc = NtGdiCreateCompatibleDC( 0 ))) goto done; - - NtGdiSelectBitmap( hdc, dib ); - window_surface_lock( surface ); + NtGdiSelectBitmap( hdc, surface->color_bitmap );
- if (info->prcDirty) - { - intersect_rect( &rect, &rect, info->prcDirty ); - memcpy( src_bits, dst_bits, bmi->bmiHeader.biSizeImage ); - } + if (info->prcDirty) intersect_rect( &rect, &rect, info->prcDirty ); NtGdiPatBlt( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, BLACKNESS ); src_rect = rect; if (info->pptSrc) OffsetRect( &src_rect, info->pptSrc->x, info->pptSrc->y ); @@ -1460,19 +1446,14 @@ BOOL ANDROID_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info info->hdcSrc, src_rect.left, src_rect.top, src_rect.right - src_rect.left, src_rect.bottom - src_rect.top, *(DWORD *)&blend, 0 ); - if (ret) - { - memcpy( dst_bits, src_bits, bmi->bmiHeader.biSizeImage ); - add_bounds_rect( &surface->bounds, &rect ); - } + if (ret) add_bounds_rect( &surface->bounds, &rect );
+ NtGdiDeleteObjectApp( hdc ); window_surface_unlock( surface ); window_surface_flush( surface );
done: window_surface_release( surface ); - if (hdc) NtGdiDeleteObjectApp( hdc ); - if (dib) NtGdiDeleteObjectApp( dib ); return ret; }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winemac.drv/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 84668b44c51..0e7d89a5305 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1965,8 +1965,8 @@ BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, window_surface_lock(surface); memcpy(src_bits, dst_bits, bmi->bmiHeader.biSizeImage); window_surface_unlock(surface); - NtGdiPatBlt(hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, BLACKNESS); } + NtGdiPatBlt(hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, BLACKNESS); src_rect = rect; if (info->pptSrc) OffsetRect( &src_rect, info->pptSrc->x, info->pptSrc->y ); NtGdiTransformPoints(info->hdcSrc, (POINT *)&src_rect, (POINT *)&src_rect, 2, NtGdiDPtoLP);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winemac.drv/window.c | 38 +++++++++----------------------------- 1 file changed, 9 insertions(+), 29 deletions(-)
diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 0e7d89a5305..315edda5b92 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1896,12 +1896,8 @@ BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, struct macdrv_win_data *data; BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, 0 }; BYTE alpha; - char buffer[FIELD_OFFSET(BITMAPINFO, bmiColors[256])]; - BITMAPINFO *bmi = (BITMAPINFO *)buffer; - void *src_bits, *dst_bits; RECT rect, src_rect; - HDC hdc = 0; - HBITMAP dib; + HDC hdc; BOOL ret = FALSE;
if (!(data = get_win_data(hwnd))) return FALSE; @@ -1952,20 +1948,11 @@ BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, else alpha = 0xff;
- dst_bits = surface->funcs->get_info(surface, bmi); - - if (!(dib = NtGdiCreateDIBSection(info->hdcDst, NULL, 0, bmi, DIB_RGB_COLORS, - 0, 0, 0, &src_bits))) goto done; if (!(hdc = NtGdiCreateCompatibleDC(0))) goto done; + window_surface_lock(surface); + NtGdiSelectBitmap(hdc, surface->color_bitmap);
- NtGdiSelectBitmap(hdc, dib); - if (info->prcDirty) - { - intersect_rect(&rect, &rect, info->prcDirty); - window_surface_lock(surface); - memcpy(src_bits, dst_bits, bmi->bmiHeader.biSizeImage); - window_surface_unlock(surface); - } + if (info->prcDirty) intersect_rect(&rect, &rect, info->prcDirty); NtGdiPatBlt(hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, BLACKNESS); src_rect = rect; if (info->pptSrc) OffsetRect( &src_rect, info->pptSrc->x, info->pptSrc->y ); @@ -1976,28 +1963,21 @@ BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, src_rect.right - src_rect.left, src_rect.bottom - src_rect.top, *(DWORD *)&blend, 0))) goto done; + if (ret) add_bounds_rect( &surface->bounds, &rect ); + + NtGdiDeleteObjectApp( hdc ); + window_surface_unlock( surface ); + window_surface_flush( surface );
if ((data = get_win_data(hwnd))) { - if (surface == data->surface) - { - window_surface_lock(surface); - memcpy(dst_bits, src_bits, bmi->bmiHeader.biSizeImage); - add_bounds_rect(&surface->bounds, &rect); - window_surface_unlock(surface); - window_surface_flush(surface); - } - /* The ULW flags are a superset of the LWA flags. */ sync_window_opacity(data, info->crKey, alpha, TRUE, info->dwFlags); - release_win_data(data); }
done: window_surface_release(surface); - if (hdc) NtGdiDeleteObjectApp(hdc); - if (dib) NtGdiDeleteObjectApp(dib); return ret; }
From: Rémi Bernon rbernon@codeweavers.com
This seems equivalent but makes the code similar to other drivers. --- dlls/winemac.drv/window.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 315edda5b92..9d5d20b8f92 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1895,7 +1895,6 @@ BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, struct window_surface *surface; struct macdrv_win_data *data; BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, 0 }; - BYTE alpha; RECT rect, src_rect; HDC hdc; BOOL ret = FALSE; @@ -1938,16 +1937,6 @@ BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, return TRUE; }
- if (info->dwFlags & ULW_ALPHA) - { - /* Apply SourceConstantAlpha via window alpha, not blend. */ - alpha = info->pblend->SourceConstantAlpha; - blend = *info->pblend; - blend.SourceConstantAlpha = 0xff; - } - else - alpha = 0xff; - if (!(hdc = NtGdiCreateCompatibleDC(0))) goto done; window_surface_lock(surface); NtGdiSelectBitmap(hdc, surface->color_bitmap); @@ -1958,6 +1947,7 @@ BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, if (info->pptSrc) OffsetRect( &src_rect, info->pptSrc->x, info->pptSrc->y ); NtGdiTransformPoints(info->hdcSrc, (POINT *)&src_rect, (POINT *)&src_rect, 2, NtGdiDPtoLP);
+ if (info->dwFlags & ULW_ALPHA) blend = *info->pblend; if (!(ret = NtGdiAlphaBlend(hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, info->hdcSrc, src_rect.left, src_rect.top, src_rect.right - src_rect.left, src_rect.bottom - src_rect.top, @@ -1972,7 +1962,7 @@ BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, if ((data = get_win_data(hwnd))) { /* The ULW flags are a superset of the LWA flags. */ - sync_window_opacity(data, info->crKey, alpha, TRUE, info->dwFlags); + sync_window_opacity(data, info->crKey, 255, TRUE, info->dwFlags); release_win_data(data); }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index f975986a9d9..6a7796a2af7 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -3032,8 +3032,8 @@ BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, { intersect_rect( &rect, &rect, info->prcDirty ); memcpy( src_bits, dst_bits, bmi->bmiHeader.biSizeImage ); - NtGdiPatBlt( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, BLACKNESS ); } + NtGdiPatBlt( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, BLACKNESS ); src_rect = rect; if (info->pptSrc) OffsetRect( &src_rect, info->pptSrc->x, info->pptSrc->y ); NtGdiTransformPoints( info->hdcSrc, (POINT *)&src_rect, (POINT *)&src_rect, 2, NtGdiDPtoLP );
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/window.c | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 6a7796a2af7..bf1b2bab325 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2972,12 +2972,8 @@ BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, struct x11drv_win_data *data; BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, 0 }; COLORREF color_key = (info->dwFlags & ULW_COLORKEY) ? info->crKey : CLR_INVALID; - char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; - BITMAPINFO *bmi = (BITMAPINFO *)buffer; - void *src_bits, *dst_bits; RECT rect, src_rect; - HDC hdc = 0; - HBITMAP dib; + HDC hdc; BOOL mapped, ret = FALSE;
if (!(data = get_win_data( hwnd ))) return FALSE; @@ -3018,21 +3014,11 @@ BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, return TRUE; }
- dst_bits = surface->funcs->get_info( surface, bmi ); - - if (!(dib = NtGdiCreateDIBSection( info->hdcDst, NULL, 0, bmi, DIB_RGB_COLORS, 0, 0, 0, &src_bits ))) - goto done; if (!(hdc = NtGdiCreateCompatibleDC( 0 ))) goto done; - - NtGdiSelectBitmap( hdc, dib ); - window_surface_lock( surface ); + NtGdiSelectBitmap( hdc, surface->color_bitmap );
- if (info->prcDirty) - { - intersect_rect( &rect, &rect, info->prcDirty ); - memcpy( src_bits, dst_bits, bmi->bmiHeader.biSizeImage ); - } + if (info->prcDirty) intersect_rect( &rect, &rect, info->prcDirty ); NtGdiPatBlt( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, BLACKNESS ); src_rect = rect; if (info->pptSrc) OffsetRect( &src_rect, info->pptSrc->x, info->pptSrc->y ); @@ -3043,19 +3029,14 @@ BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, info->hdcSrc, src_rect.left, src_rect.top, src_rect.right - src_rect.left, src_rect.bottom - src_rect.top, *(DWORD *)&blend, 0 ); - if (ret) - { - memcpy( dst_bits, src_bits, bmi->bmiHeader.biSizeImage ); - add_bounds_rect( &surface->bounds, &rect ); - } + if (ret) add_bounds_rect( &surface->bounds, &rect );
+ NtGdiDeleteObjectApp( hdc ); window_surface_unlock( surface ); window_surface_flush( surface );
done: window_surface_release( surface ); - if (hdc) NtGdiDeleteObjectApp( hdc ); - if (dib) NtGdiDeleteObjectApp( dib ); return ret; }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/driver.c | 21 ++++++++++++++--- dlls/win32u/window.c | 10 +++++++- dlls/wineandroid.drv/android.h | 4 +++- dlls/wineandroid.drv/init.c | 1 + dlls/wineandroid.drv/window.c | 42 +++++++++++++++++++-------------- dlls/winemac.drv/gdi.c | 1 + dlls/winemac.drv/macdrv.h | 4 +++- dlls/winemac.drv/window.c | 41 +++++++++++++++++++------------- dlls/winex11.drv/init.c | 1 + dlls/winex11.drv/window.c | 43 ++++++++++++++++++++-------------- dlls/winex11.drv/x11drv.h | 4 +++- include/wine/gdi_driver.h | 3 ++- 12 files changed, 115 insertions(+), 60 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index 4bb59536efe..fdba2524300 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -867,8 +867,15 @@ static LRESULT nulldrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam ) return -1; }
+static BOOL nulldrv_CreateLayeredWindow( HWND hwnd, const RECT *window_rect, COLORREF color_key, + struct window_surface **surface ) +{ + *surface = NULL; + return TRUE; +} + static BOOL nulldrv_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, - const RECT *window_rect ) + const RECT *window_rect, struct window_surface *surface ) { return TRUE; } @@ -1208,10 +1215,16 @@ static void loaderdrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw ) load_driver()->pSetWindowRgn( hwnd, hrgn, redraw ); }
+static BOOL loaderdrv_CreateLayeredWindow( HWND hwnd, const RECT *window_rect, COLORREF color_key, + struct window_surface **surface ) +{ + return load_driver()->pCreateLayeredWindow( hwnd, window_rect, color_key, surface ); +} + static BOOL loaderdrv_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, - const RECT *window_rect ) + const RECT *window_rect, struct window_surface *surface ) { - return load_driver()->pUpdateLayeredWindow( hwnd, info, window_rect ); + return load_driver()->pUpdateLayeredWindow( hwnd, info, window_rect, surface ); }
static UINT loaderdrv_VulkanInit( UINT version, void *vulkan_handle, const struct vulkan_driver_funcs **driver_funcs ) @@ -1278,6 +1291,7 @@ static const struct user_driver_funcs lazy_load_driver = nulldrv_SetWindowText, nulldrv_ShowWindow, nulldrv_SysCommand, + loaderdrv_CreateLayeredWindow, loaderdrv_UpdateLayeredWindow, nulldrv_WindowMessage, nulldrv_WindowPosChanging, @@ -1364,6 +1378,7 @@ void __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT version SET_USER_FUNC(SetWindowText); SET_USER_FUNC(ShowWindow); SET_USER_FUNC(SysCommand); + SET_USER_FUNC(CreateLayeredWindow); SET_USER_FUNC(UpdateLayeredWindow); SET_USER_FUNC(WindowMessage); SET_USER_FUNC(WindowPosChanging); diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 12f2a9027f0..0c70b90a8e8 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -2119,9 +2119,11 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_ const BLENDFUNCTION *blend, DWORD flags, const RECT *dirty ) { DWORD swp_flags = SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW; + struct window_surface *surface; RECT window_rect, client_rect; UPDATELAYEREDWINDOWINFO info; SIZE offset; + BOOL ret;
if (flags & ~(ULW_COLORKEY | ULW_ALPHA | ULW_OPAQUE | ULW_EX_NORESIZE) || !(get_window_long( hwnd, GWL_EXSTYLE ) & WS_EX_LAYERED) || @@ -2167,6 +2169,9 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_
apply_window_pos( hwnd, 0, swp_flags, &window_rect, &client_rect, NULL );
+ if (!(flags & ULW_COLORKEY)) key = CLR_INVALID; + if (!(user_driver->pCreateLayeredWindow( hwnd, &window_rect, key, &surface )) || !surface) return FALSE; + info.cbSize = sizeof(info); info.hdcDst = hdc_dst; info.pptDst = pts_dst; @@ -2177,7 +2182,10 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_ info.pblend = blend; info.dwFlags = flags; info.prcDirty = dirty; - return user_driver->pUpdateLayeredWindow( hwnd, &info, &window_rect ); + ret = user_driver->pUpdateLayeredWindow( hwnd, &info, &window_rect, surface ); + + window_surface_release( surface ); + return ret; }
/*********************************************************************** diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h index 2512976089b..7831bb20ee2 100644 --- a/dlls/wineandroid.drv/android.h +++ b/dlls/wineandroid.drv/android.h @@ -98,8 +98,10 @@ extern void ANDROID_SetParent( HWND hwnd, HWND parent, HWND old_parent ); 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 ); +extern BOOL ANDROID_CreateLayeredWindow( HWND hwnd, const RECT *window_rect, COLORREF color_key, + struct window_surface **surface ); extern BOOL ANDROID_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, - const RECT *window_rect ); + const RECT *window_rect, struct window_surface *surface ); extern LRESULT ANDROID_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); extern BOOL ANDROID_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index 5b4ec59d2fa..cda9cd657b7 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -348,6 +348,7 @@ static const struct user_driver_funcs android_drv_funcs = .pSetParent = ANDROID_SetParent, .pSetWindowStyle = ANDROID_SetWindowStyle, .pShowWindow = ANDROID_ShowWindow, + .pCreateLayeredWindow = ANDROID_CreateLayeredWindow, .pUpdateLayeredWindow = ANDROID_UpdateLayeredWindow, .pWindowMessage = ANDROID_WindowMessage, .pWindowPosChanging = ANDROID_WindowPosChanging, diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index 55ca444f970..26d0dd364e1 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -1388,18 +1388,14 @@ void ANDROID_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DW
/***************************************************************************** - * ANDROID_UpdateLayeredWindow + * ANDROID_CreateLayeredWindow */ -BOOL ANDROID_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, - const RECT *window_rect ) +BOOL ANDROID_CreateLayeredWindow( HWND hwnd, const RECT *window_rect, COLORREF color_key, + struct window_surface **window_surface ) { struct window_surface *surface; struct android_win_data *data; - BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, 0 }; - COLORREF color_key = (info->dwFlags & ULW_COLORKEY) ? info->crKey : CLR_INVALID; - RECT rect, src_rect; - HDC hdc; - BOOL ret = FALSE; + RECT rect;
if (!(data = get_win_data( hwnd ))) return FALSE;
@@ -1421,17 +1417,29 @@ BOOL ANDROID_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info } else set_surface_layered( surface, 255, color_key );
- if (surface) window_surface_add_ref( surface ); + if ((*window_surface = surface)) window_surface_add_ref( surface ); release_win_data( data );
- if (!surface) return FALSE; - if (!info->hdcSrc) - { - window_surface_release( surface ); - return TRUE; - } + return TRUE; +}
- if (!(hdc = NtGdiCreateCompatibleDC( 0 ))) goto done; +/***************************************************************************** + * ANDROID_UpdateLayeredWindow + */ +BOOL ANDROID_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, + const RECT *window_rect, struct window_surface *surface ) +{ + BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, 0 }; + RECT rect, src_rect; + HDC hdc; + BOOL ret; + + rect = *window_rect; + OffsetRect( &rect, -window_rect->left, -window_rect->top ); + + if (!info->hdcSrc) return TRUE; + + if (!(hdc = NtGdiCreateCompatibleDC( 0 ))) return FALSE; window_surface_lock( surface ); NtGdiSelectBitmap( hdc, surface->color_bitmap );
@@ -1452,8 +1460,6 @@ BOOL ANDROID_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info window_surface_unlock( surface ); window_surface_flush( surface );
-done: - window_surface_release( surface ); return ret; }
diff --git a/dlls/winemac.drv/gdi.c b/dlls/winemac.drv/gdi.c index a06314ed62c..9d3c2adb26c 100644 --- a/dlls/winemac.drv/gdi.c +++ b/dlls/winemac.drv/gdi.c @@ -301,6 +301,7 @@ static const struct user_driver_funcs macdrv_funcs = .pToUnicodeEx = macdrv_ToUnicodeEx, .pUnregisterHotKey = macdrv_UnregisterHotKey, .pUpdateClipboard = macdrv_UpdateClipboard, + .pCreateLayeredWindow = macdrv_CreateLayeredWindow, .pUpdateLayeredWindow = macdrv_UpdateLayeredWindow, .pVkKeyScanEx = macdrv_VkKeyScanEx, .pImeProcessKey = macdrv_ImeProcessKey, diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index a7905050f16..9f9782864ec 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -147,8 +147,10 @@ extern void macdrv_SetLayeredWindowAttributes(HWND hwnd, COLORREF key, BYTE alph extern void macdrv_SetWindowText(HWND hwnd, LPCWSTR text); extern UINT macdrv_ShowWindow(HWND hwnd, INT cmd, RECT *rect, UINT swp); extern LRESULT macdrv_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam); +extern BOOL macdrv_CreateLayeredWindow(HWND hwnd, const RECT *window_rect, COLORREF color_key, + struct window_surface **surface); extern BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, - const RECT *window_rect); + const RECT *window_rect, struct window_surface *surface); extern LRESULT macdrv_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); extern BOOL macdrv_WindowPosChanging(HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 9d5d20b8f92..e0dd23623c4 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1887,17 +1887,14 @@ done:
/*********************************************************************** - * UpdateLayeredWindow (MACDRV.@) + * CreateLayeredWindow (MACDRV.@) */ -BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, - const RECT *window_rect) +BOOL macdrv_CreateLayeredWindow(HWND hwnd, const RECT *window_rect, COLORREF color_key, + struct window_surface **window_surface) { struct window_surface *surface; struct macdrv_win_data *data; - BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, 0 }; - RECT rect, src_rect; - HDC hdc; - BOOL ret = FALSE; + RECT rect;
if (!(data = get_win_data(hwnd))) return FALSE;
@@ -1922,7 +1919,7 @@ BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, } else set_surface_use_alpha(surface, TRUE);
- if (surface) window_surface_add_ref(surface); + if ((*window_surface = surface)) window_surface_add_ref(surface);
/* Since layered attributes are now set, can now show the window */ if (data->cocoa_window && !data->on_screen && NtUserGetWindowLongW(hwnd, GWL_STYLE) & WS_VISIBLE) @@ -1930,14 +1927,27 @@ BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info,
release_win_data(data);
- if (!surface) return FALSE; - if (!info->hdcSrc) - { - window_surface_release(surface); - return TRUE; - } + return TRUE; +} + +/*********************************************************************** + * UpdateLayeredWindow (MACDRV.@) + */ +BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, + const RECT *window_rect, struct window_surface *surface) +{ + struct macdrv_win_data *data; + BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, 0 }; + RECT rect, src_rect; + HDC hdc; + BOOL ret = FALSE; + + rect = *window_rect; + OffsetRect(&rect, -window_rect->left, -window_rect->top); + + if (!info->hdcSrc) return TRUE;
- if (!(hdc = NtGdiCreateCompatibleDC(0))) goto done; + if (!(hdc = NtGdiCreateCompatibleDC(0))) return FALSE; window_surface_lock(surface); NtGdiSelectBitmap(hdc, surface->color_bitmap);
@@ -1967,7 +1977,6 @@ BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, }
done: - window_surface_release(surface); return ret; }
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index e3b3a3e2557..66e73035ddb 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -420,6 +420,7 @@ static const struct user_driver_funcs x11drv_funcs = .pSysCommand = X11DRV_SysCommand, .pClipboardWindowProc = X11DRV_ClipboardWindowProc, .pUpdateClipboard = X11DRV_UpdateClipboard, + .pCreateLayeredWindow = X11DRV_CreateLayeredWindow, .pUpdateLayeredWindow = X11DRV_UpdateLayeredWindow, .pWindowMessage = X11DRV_WindowMessage, .pWindowPosChanging = X11DRV_WindowPosChanging, diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index bf1b2bab325..d5ee997dd44 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2963,18 +2963,15 @@ void X11DRV_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWO
/***************************************************************************** - * UpdateLayeredWindow (X11DRV.@) + * CreateLayeredWindow (X11DRV.@) */ -BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, - const RECT *window_rect ) +BOOL X11DRV_CreateLayeredWindow( HWND hwnd, const RECT *window_rect, COLORREF color_key, + struct window_surface **window_surface ) { struct window_surface *surface; struct x11drv_win_data *data; - BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, 0 }; - COLORREF color_key = (info->dwFlags & ULW_COLORKEY) ? info->crKey : CLR_INVALID; - RECT rect, src_rect; - HDC hdc; - BOOL mapped, ret = FALSE; + BOOL mapped; + RECT rect;
if (!(data = get_win_data( hwnd ))) return FALSE;
@@ -2994,7 +2991,7 @@ BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, } else set_surface_color_key( surface, color_key );
- if (surface) window_surface_add_ref( surface ); + if ((*window_surface = surface)) window_surface_add_ref( surface ); mapped = data->mapped; release_win_data( data );
@@ -3007,14 +3004,26 @@ BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, map_window( hwnd, style ); }
- if (!surface) return FALSE; - if (!info->hdcSrc) - { - window_surface_release( surface ); - return TRUE; - } + return TRUE; +}
- if (!(hdc = NtGdiCreateCompatibleDC( 0 ))) goto done; +/***************************************************************************** + * UpdateLayeredWindow (X11DRV.@) + */ +BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, + const RECT *window_rect, struct window_surface *surface ) +{ + BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, 0 }; + RECT rect, src_rect; + HDC hdc; + BOOL ret; + + rect = *window_rect; + OffsetRect( &rect, -window_rect->left, -window_rect->top ); + + if (!info->hdcSrc) return TRUE; + + if (!(hdc = NtGdiCreateCompatibleDC( 0 ))) return FALSE; window_surface_lock( surface ); NtGdiSelectBitmap( hdc, surface->color_bitmap );
@@ -3035,8 +3044,6 @@ BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, window_surface_unlock( surface ); window_surface_flush( surface );
-done: - window_surface_release( surface ); return ret; }
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 2a326b07a4c..42b6048cdb5 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -240,8 +240,10 @@ extern UINT X11DRV_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp ); extern LRESULT X11DRV_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam ); extern LRESULT X11DRV_ClipboardWindowProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); extern void X11DRV_UpdateClipboard(void); +extern BOOL X11DRV_CreateLayeredWindow( HWND hwnd, const RECT *window_rect, COLORREF color_key, + struct window_surface **surface ); extern BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, - const RECT *window_rect ); + const RECT *window_rect, struct window_surface *surface ); extern LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); extern BOOL X11DRV_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect, diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index ce954a7f4d8..723a40f5474 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -336,7 +336,8 @@ struct user_driver_funcs void (*pSetWindowText)(HWND,LPCWSTR); UINT (*pShowWindow)(HWND,INT,RECT*,UINT); LRESULT (*pSysCommand)(HWND,WPARAM,LPARAM); - BOOL (*pUpdateLayeredWindow)(HWND,const struct tagUPDATELAYEREDWINDOWINFO *,const RECT *); + BOOL (*pCreateLayeredWindow)(HWND,const RECT *,COLORREF,struct window_surface **); + BOOL (*pUpdateLayeredWindow)(HWND,const struct tagUPDATELAYEREDWINDOWINFO*,const RECT*,struct window_surface*); LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM); BOOL (*pWindowPosChanging)(HWND,HWND,UINT,const RECT *,const RECT *,RECT *, struct window_surface**);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/driver.c | 11 ++++---- dlls/win32u/window.c | 48 ++++++++++++++++++++++++--------- dlls/wineandroid.drv/android.h | 2 -- dlls/wineandroid.drv/init.c | 1 - dlls/wineandroid.drv/window.c | 49 ---------------------------------- dlls/winemac.drv/macdrv.h | 4 +-- dlls/winemac.drv/window.c | 40 +++------------------------ dlls/winex11.drv/init.c | 1 - dlls/winex11.drv/window.c | 40 --------------------------- dlls/winex11.drv/x11drv.h | 2 -- include/wine/gdi_driver.h | 4 +-- 11 files changed, 46 insertions(+), 156 deletions(-)
diff --git a/dlls/win32u/driver.c b/dlls/win32u/driver.c index fdba2524300..b4afba45a0a 100644 --- a/dlls/win32u/driver.c +++ b/dlls/win32u/driver.c @@ -874,10 +874,9 @@ static BOOL nulldrv_CreateLayeredWindow( HWND hwnd, const RECT *window_rect, COL return TRUE; }
-static BOOL nulldrv_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, - const RECT *window_rect, struct window_surface *surface ) +static void nulldrv_UpdateLayeredWindow( HWND hwnd, const RECT *window_rect, COLORREF color_key, + BYTE alpha, UINT flags ) { - return TRUE; }
static LRESULT nulldrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) @@ -1221,10 +1220,10 @@ static BOOL loaderdrv_CreateLayeredWindow( HWND hwnd, const RECT *window_rect, C return load_driver()->pCreateLayeredWindow( hwnd, window_rect, color_key, surface ); }
-static BOOL loaderdrv_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, - const RECT *window_rect, struct window_surface *surface ) +static void loaderdrv_UpdateLayeredWindow( HWND hwnd, const RECT *window_rect, COLORREF color_key, + BYTE alpha, UINT flags ) { - return load_driver()->pUpdateLayeredWindow( hwnd, info, window_rect, surface ); + load_driver()->pUpdateLayeredWindow( hwnd, window_rect, color_key, alpha, flags ); }
static UINT loaderdrv_VulkanInit( UINT version, void *vulkan_handle, const struct vulkan_driver_funcs **driver_funcs ) diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 0c70b90a8e8..fef5faa9168 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -2121,9 +2121,8 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_ DWORD swp_flags = SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW; struct window_surface *surface; RECT window_rect, client_rect; - UPDATELAYEREDWINDOWINFO info; SIZE offset; - BOOL ret; + BOOL ret = FALSE;
if (flags & ~(ULW_COLORKEY | ULW_ALPHA | ULW_OPAQUE | ULW_EX_NORESIZE) || !(get_window_long( hwnd, GWL_EXSTYLE ) & WS_EX_LAYERED) || @@ -2172,18 +2171,41 @@ BOOL WINAPI NtUserUpdateLayeredWindow( HWND hwnd, HDC hdc_dst, const POINT *pts_ if (!(flags & ULW_COLORKEY)) key = CLR_INVALID; if (!(user_driver->pCreateLayeredWindow( hwnd, &window_rect, key, &surface )) || !surface) return FALSE;
- info.cbSize = sizeof(info); - info.hdcDst = hdc_dst; - info.pptDst = pts_dst; - info.psize = size; - info.hdcSrc = hdc_src; - info.pptSrc = pts_src; - info.crKey = key; - info.pblend = blend; - info.dwFlags = flags; - info.prcDirty = dirty; - ret = user_driver->pUpdateLayeredWindow( hwnd, &info, &window_rect, surface ); + if (!hdc_src) ret = TRUE; + else + { + BLENDFUNCTION src_blend = { AC_SRC_OVER, 0, 255, 0 }; + RECT rect = window_rect, src_rect; + UINT alpha = 0xff; + HDC hdc = NULL; + + OffsetRect( &rect, -rect.left, -rect.top ); + + if (!(hdc = NtGdiCreateCompatibleDC( 0 ))) goto done; + window_surface_lock( surface ); + NtGdiSelectBitmap( hdc, surface->color_bitmap ); + + if (dirty) intersect_rect( &rect, &rect, dirty ); + NtGdiPatBlt( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, BLACKNESS );
+ src_rect = rect; + if (pts_src) OffsetRect( &src_rect, pts_src->x, pts_src->y ); + NtGdiTransformPoints( hdc_src, (POINT *)&src_rect, (POINT *)&src_rect, 2, NtGdiDPtoLP ); + + if (flags & ULW_ALPHA) src_blend = *blend; + ret = NtGdiAlphaBlend( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, + hdc_src, src_rect.left, src_rect.top, src_rect.right - src_rect.left, src_rect.bottom - src_rect.top, + *(DWORD *)&src_blend, 0 ); + if (ret) add_bounds_rect( &surface->bounds, &rect ); + + NtGdiDeleteObjectApp( hdc ); + window_surface_unlock( surface ); + window_surface_flush( surface ); + + user_driver->pUpdateLayeredWindow( hwnd, &window_rect, key, alpha, flags ); + } + +done: window_surface_release( surface ); return ret; } diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h index 7831bb20ee2..e8ab3493afc 100644 --- a/dlls/wineandroid.drv/android.h +++ b/dlls/wineandroid.drv/android.h @@ -100,8 +100,6 @@ extern void ANDROID_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style ); extern UINT ANDROID_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp ); extern BOOL ANDROID_CreateLayeredWindow( HWND hwnd, const RECT *window_rect, COLORREF color_key, struct window_surface **surface ); -extern BOOL ANDROID_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, - const RECT *window_rect, struct window_surface *surface ); extern LRESULT ANDROID_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); extern BOOL ANDROID_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index cda9cd657b7..ac4aa602bcf 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -349,7 +349,6 @@ static const struct user_driver_funcs android_drv_funcs = .pSetWindowStyle = ANDROID_SetWindowStyle, .pShowWindow = ANDROID_ShowWindow, .pCreateLayeredWindow = ANDROID_CreateLayeredWindow, - .pUpdateLayeredWindow = ANDROID_UpdateLayeredWindow, .pWindowMessage = ANDROID_WindowMessage, .pWindowPosChanging = ANDROID_WindowPosChanging, .pWindowPosChanged = ANDROID_WindowPosChanged, diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c index 26d0dd364e1..4cbdb9a3539 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -583,15 +583,6 @@ static struct android_window_surface *get_android_surface( struct window_surface return (struct android_window_surface *)surface; }
-static inline void add_bounds_rect( RECT *bounds, const RECT *rect ) -{ - if (rect->left >= rect->right || rect->top >= rect->bottom) return; - bounds->left = min( bounds->left, rect->left ); - bounds->top = min( bounds->top, rect->top ); - bounds->right = max( bounds->right, rect->right ); - bounds->bottom = max( bounds->bottom, rect->bottom ); -} - /* store the palette or color mask data in the bitmap info structure */ static void set_color_info( BITMAPINFO *info, BOOL has_alpha ) { @@ -1423,46 +1414,6 @@ BOOL ANDROID_CreateLayeredWindow( HWND hwnd, const RECT *window_rect, COLORREF c return TRUE; }
-/***************************************************************************** - * ANDROID_UpdateLayeredWindow - */ -BOOL ANDROID_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, - const RECT *window_rect, struct window_surface *surface ) -{ - BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, 0 }; - RECT rect, src_rect; - HDC hdc; - BOOL ret; - - rect = *window_rect; - OffsetRect( &rect, -window_rect->left, -window_rect->top ); - - if (!info->hdcSrc) return TRUE; - - if (!(hdc = NtGdiCreateCompatibleDC( 0 ))) return FALSE; - window_surface_lock( surface ); - NtGdiSelectBitmap( hdc, surface->color_bitmap ); - - if (info->prcDirty) intersect_rect( &rect, &rect, info->prcDirty ); - NtGdiPatBlt( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, BLACKNESS ); - src_rect = rect; - if (info->pptSrc) OffsetRect( &src_rect, info->pptSrc->x, info->pptSrc->y ); - NtGdiTransformPoints( info->hdcSrc, (POINT *)&src_rect, (POINT *)&src_rect, 2, NtGdiDPtoLP ); - - if (info->dwFlags & ULW_ALPHA) blend = *info->pblend; - ret = NtGdiAlphaBlend( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, - info->hdcSrc, src_rect.left, src_rect.top, - src_rect.right - src_rect.left, src_rect.bottom - src_rect.top, - *(DWORD *)&blend, 0 ); - if (ret) add_bounds_rect( &surface->bounds, &rect ); - - NtGdiDeleteObjectApp( hdc ); - window_surface_unlock( surface ); - window_surface_flush( surface ); - - return ret; -} -
/********************************************************************** * ANDROID_WindowMessage diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 9f9782864ec..079c25947f4 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -149,8 +149,8 @@ extern void macdrv_SetLayeredWindowAttributes(HWND hwnd, COLORREF key, BYTE alph extern LRESULT macdrv_SysCommand(HWND hwnd, WPARAM wparam, LPARAM lparam); extern BOOL macdrv_CreateLayeredWindow(HWND hwnd, const RECT *window_rect, COLORREF color_key, struct window_surface **surface); -extern BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, - const RECT *window_rect, struct window_surface *surface); +extern void macdrv_UpdateLayeredWindow(HWND hwnd, const RECT *window_rect, COLORREF color_key, + BYTE alpha, UINT flags); extern LRESULT macdrv_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); extern BOOL macdrv_WindowPosChanging(HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index e0dd23623c4..b7f24636800 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1933,51 +1933,17 @@ BOOL macdrv_CreateLayeredWindow(HWND hwnd, const RECT *window_rect, COLORREF col /*********************************************************************** * UpdateLayeredWindow (MACDRV.@) */ -BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, - const RECT *window_rect, struct window_surface *surface) +void macdrv_UpdateLayeredWindow(HWND hwnd, const RECT *window_rect, COLORREF color_key, + BYTE alpha, UINT flags) { struct macdrv_win_data *data; - BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, 0 }; - RECT rect, src_rect; - HDC hdc; - BOOL ret = FALSE; - - rect = *window_rect; - OffsetRect(&rect, -window_rect->left, -window_rect->top); - - if (!info->hdcSrc) return TRUE; - - if (!(hdc = NtGdiCreateCompatibleDC(0))) return FALSE; - window_surface_lock(surface); - NtGdiSelectBitmap(hdc, surface->color_bitmap); - - if (info->prcDirty) intersect_rect(&rect, &rect, info->prcDirty); - NtGdiPatBlt(hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, BLACKNESS); - src_rect = rect; - if (info->pptSrc) OffsetRect( &src_rect, info->pptSrc->x, info->pptSrc->y ); - NtGdiTransformPoints(info->hdcSrc, (POINT *)&src_rect, (POINT *)&src_rect, 2, NtGdiDPtoLP); - - if (info->dwFlags & ULW_ALPHA) blend = *info->pblend; - if (!(ret = NtGdiAlphaBlend(hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, - info->hdcSrc, src_rect.left, src_rect.top, - src_rect.right - src_rect.left, src_rect.bottom - src_rect.top, - *(DWORD *)&blend, 0))) - goto done; - if (ret) add_bounds_rect( &surface->bounds, &rect ); - - NtGdiDeleteObjectApp( hdc ); - window_surface_unlock( surface ); - window_surface_flush( surface );
if ((data = get_win_data(hwnd))) { /* The ULW flags are a superset of the LWA flags. */ - sync_window_opacity(data, info->crKey, 255, TRUE, info->dwFlags); + sync_window_opacity(data, color_key, 255, TRUE, flags); release_win_data(data); } - -done: - return ret; }
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 66e73035ddb..987e2ef38c0 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -421,7 +421,6 @@ static const struct user_driver_funcs x11drv_funcs = .pClipboardWindowProc = X11DRV_ClipboardWindowProc, .pUpdateClipboard = X11DRV_UpdateClipboard, .pCreateLayeredWindow = X11DRV_CreateLayeredWindow, - .pUpdateLayeredWindow = X11DRV_UpdateLayeredWindow, .pWindowMessage = X11DRV_WindowMessage, .pWindowPosChanging = X11DRV_WindowPosChanging, .pWindowPosChanged = X11DRV_WindowPosChanged, diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index d5ee997dd44..11d2364121a 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -3007,46 +3007,6 @@ BOOL X11DRV_CreateLayeredWindow( HWND hwnd, const RECT *window_rect, COLORREF co return TRUE; }
-/***************************************************************************** - * UpdateLayeredWindow (X11DRV.@) - */ -BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, - const RECT *window_rect, struct window_surface *surface ) -{ - BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, 0 }; - RECT rect, src_rect; - HDC hdc; - BOOL ret; - - rect = *window_rect; - OffsetRect( &rect, -window_rect->left, -window_rect->top ); - - if (!info->hdcSrc) return TRUE; - - if (!(hdc = NtGdiCreateCompatibleDC( 0 ))) return FALSE; - window_surface_lock( surface ); - NtGdiSelectBitmap( hdc, surface->color_bitmap ); - - if (info->prcDirty) intersect_rect( &rect, &rect, info->prcDirty ); - NtGdiPatBlt( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, BLACKNESS ); - src_rect = rect; - if (info->pptSrc) OffsetRect( &src_rect, info->pptSrc->x, info->pptSrc->y ); - NtGdiTransformPoints( info->hdcSrc, (POINT *)&src_rect, (POINT *)&src_rect, 2, NtGdiDPtoLP ); - - if (info->dwFlags & ULW_ALPHA) blend = *info->pblend; - ret = NtGdiAlphaBlend( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, - info->hdcSrc, src_rect.left, src_rect.top, - src_rect.right - src_rect.left, src_rect.bottom - src_rect.top, - *(DWORD *)&blend, 0 ); - if (ret) add_bounds_rect( &surface->bounds, &rect ); - - NtGdiDeleteObjectApp( hdc ); - window_surface_unlock( surface ); - window_surface_flush( surface ); - - return ret; -} - /* Add a window to taskbar */ static void taskbar_add_tab( HWND hwnd ) { diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 42b6048cdb5..c76f3fe62dc 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -242,8 +242,6 @@ extern LRESULT X11DRV_ClipboardWindowProc( HWND hwnd, UINT msg, WPARAM wp, LPARA extern void X11DRV_UpdateClipboard(void); extern BOOL X11DRV_CreateLayeredWindow( HWND hwnd, const RECT *window_rect, COLORREF color_key, struct window_surface **surface ); -extern BOOL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info, - const RECT *window_rect, struct window_surface *surface ); extern LRESULT X11DRV_WindowMessage( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ); extern BOOL X11DRV_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags, const RECT *window_rect, const RECT *client_rect, RECT *visible_rect, diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 723a40f5474..839573ef2ec 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -271,8 +271,6 @@ struct gdi_device_manager
#define WINE_DM_UNSUPPORTED 0x80000000
-struct tagUPDATELAYEREDWINDOWINFO; - struct vulkan_driver_funcs;
struct user_driver_funcs @@ -337,7 +335,7 @@ struct user_driver_funcs UINT (*pShowWindow)(HWND,INT,RECT*,UINT); LRESULT (*pSysCommand)(HWND,WPARAM,LPARAM); BOOL (*pCreateLayeredWindow)(HWND,const RECT *,COLORREF,struct window_surface **); - BOOL (*pUpdateLayeredWindow)(HWND,const struct tagUPDATELAYEREDWINDOWINFO*,const RECT*,struct window_surface*); + void (*pUpdateLayeredWindow)(HWND,const RECT *,COLORREF,BYTE,UINT); LRESULT (*pWindowMessage)(HWND,UINT,WPARAM,LPARAM); BOOL (*pWindowPosChanging)(HWND,HWND,UINT,const RECT *,const RECT *,RECT *, struct window_surface**);
Should be working again, some incorrect return value on winemac, also used the window rect rather than the surface rect (which is rounded) for the blit.
Huw Davies (@huw) commented about dlls/winemac.drv/window.c:
- }
- return TRUE;
+}
+/***********************************************************************
UpdateLayeredWindow (MACDRV.@)
- */
+BOOL macdrv_UpdateLayeredWindow(HWND hwnd, const UPDATELAYEREDWINDOWINFO *info,
const RECT *window_rect, struct window_surface *surface)
+{
- struct macdrv_win_data *data;
- BLENDFUNCTION blend = { AC_SRC_OVER, 0, 255, 0 };
- RECT rect, src_rect;
- HDC hdc;
- BOOL ret = FALSE;
```suggestion:-0+0
``` There's a trailing space here.