From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/driver.c | 11 ++++---- dlls/win32u/window.c | 47 ++++++++++++++++++++++++---------- dlls/wineandroid.drv/android.h | 2 -- dlls/wineandroid.drv/init.c | 1 - dlls/wineandroid.drv/window.c | 37 -------------------------- dlls/winemac.drv/macdrv.h | 4 +-- dlls/winemac.drv/window.c | 37 +++----------------------- dlls/winex11.drv/init.c | 1 - dlls/winex11.drv/window.c | 37 -------------------------- dlls/winex11.drv/x11drv.h | 2 -- include/wine/gdi_driver.h | 4 +-- 11 files changed, 45 insertions(+), 138 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..92aba14223d 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,40 @@ 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 = surface->rect, src_rect; + UINT alpha = 0xff; + HDC hdc = NULL; + + 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 1b5a991f812..b9df5f5b301 100644 --- a/dlls/wineandroid.drv/window.c +++ b/dlls/wineandroid.drv/window.c @@ -1423,43 +1423,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; - - 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 adee3ffe412..97f734f2367 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1934,48 +1934,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; - - 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 3b669c5260b..11d2364121a 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -3007,43 +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; - - 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**);