mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-01 18:58:29 +00:00
win32u: Move UpdateLayeredWindow implementation out of the drivers.
This commit is contained in:
parent
091883d4b6
commit
83a143efe0
|
@ -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 )
|
||||
|
|
|
@ -2123,9 +2123,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) ||
|
||||
|
@ -2174,18 +2173,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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -578,15 +578,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 )
|
||||
{
|
||||
|
@ -1418,46 +1409,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
|
||||
|
|
|
@ -147,8 +147,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,
|
||||
|
|
|
@ -1909,51 +1909,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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -3004,46 +3004,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 )
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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**);
|
||||
|
|
Loading…
Reference in a new issue