Nikolay Sivov : comctl32/button: Use duplicated image for drawing.
Alexandre Julliard
julliard at winehq.org
Wed Apr 1 15:51:00 CDT 2020
Module: wine
Branch: master
Commit: 5fcd20396fb29a1f2ce87645cbb0d045ce5cf2d8
URL: https://source.winehq.org/git/wine.git/?a=commit;h=5fcd20396fb29a1f2ce87645cbb0d045ce5cf2d8
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed Apr 1 15:17:50 2020 +0300
comctl32/button: Use duplicated image for drawing.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47794
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/comctl32/button.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c
index 0078bd0fc6..b615df4a16 100644
--- a/dlls/comctl32/button.c
+++ b/dlls/comctl32/button.c
@@ -90,11 +90,12 @@ typedef struct _BUTTON_INFO
HIMAGELIST glyph; /* this is a font character code when split_style doesn't have BCSS_IMAGE */
SIZE glyph_size;
RECT text_margin;
+ HANDLE image; /* Original handle set with BM_SETIMAGE and returned with BM_GETIMAGE. */
union
{
HICON icon;
HBITMAP bitmap;
- HANDLE image;
+ HANDLE image; /* Duplicated handle used for drawing. */
} u;
} BUTTON_INFO;
@@ -488,6 +489,10 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
case WM_NCDESTROY:
SetWindowLongPtrW( hWnd, 0, 0 );
+ if (infoPtr->image_type == IMAGE_BITMAP)
+ DeleteObject(infoPtr->u.bitmap);
+ else if (infoPtr->image_type == IMAGE_ICON)
+ DestroyIcon(infoPtr->u.icon);
heap_free(infoPtr->note);
heap_free(infoPtr);
break;
@@ -859,13 +864,14 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
case BM_SETIMAGE:
infoPtr->image_type = (DWORD)wParam;
- oldHbitmap = infoPtr->u.image;
- infoPtr->u.image = (HANDLE)lParam;
- InvalidateRect( hWnd, NULL, FALSE );
- return (LRESULT)oldHbitmap;
+ oldHbitmap = infoPtr->image;
+ infoPtr->u.image = CopyImage((HANDLE)lParam, infoPtr->image_type, 0, 0, 0);
+ infoPtr->image = (HANDLE)lParam;
+ InvalidateRect( hWnd, NULL, FALSE );
+ return (LRESULT)oldHbitmap;
case BM_GETIMAGE:
- return (LRESULT)infoPtr->u.image;
+ return (LRESULT)infoPtr->image;
case BCM_SETIMAGELIST:
{
More information about the wine-cvs
mailing list