Commit 32eb1c73 authored by Vitaliy Margolen's avatar Vitaliy Margolen Committed by Alexandre Julliard

Get rid of direct ImageList access hacks.

parent e43edbd5
...@@ -67,7 +67,6 @@ ...@@ -67,7 +67,6 @@
#include "winuser.h" #include "winuser.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "commctrl.h" #include "commctrl.h"
#include "imagelist.h"
#include "comctl32.h" #include "comctl32.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -573,44 +572,35 @@ static void ...@@ -573,44 +572,35 @@ static void
TOOLBAR_DrawMasked (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, TOOLBAR_DrawMasked (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
HDC hdc, INT x, INT y) HDC hdc, INT x, INT y)
{ {
/* FIXME: this function is a hack since it uses image list
internals directly */
HIMAGELIST himl = GETDEFIMAGELIST(infoPtr, 0); HIMAGELIST himl = GETDEFIMAGELIST(infoPtr, 0);
INT cx, cy;
HBITMAP hbmMask; HBITMAP hbmMask;
HDC hdcImageList;
HDC hdcMask; HDC hdcMask;
if (!himl) if (!himl)
return; return;
ImageList_GetIconSize(himl, &cx, &cy);
/* create new dc's */ /* create new dc's */
hdcImageList = CreateCompatibleDC (0);
hdcMask = CreateCompatibleDC (0); hdcMask = CreateCompatibleDC (0);
/* create new bitmap */ /* create new bitmap */
hbmMask = CreateBitmap (himl->cx, himl->cy, 1, 1, NULL); hbmMask = CreateBitmap (cx, cy, 1, 1, NULL);
SelectObject (hdcMask, hbmMask); SelectObject (hdcMask, hbmMask);
/* copy the mask bitmap */ /* copy the mask bitmap */
SelectObject (hdcImageList, himl->hbmMask); ImageList_DrawEx(himl, btnPtr->iBitmap, hdcMask, 0, 0, 0, 0, RGB(255, 255, 255), RGB(0, 0, 0), ILD_MASK);
SetBkColor (hdcImageList, RGB(255, 255, 255));
SetTextColor (hdcImageList, RGB(0, 0, 0));
BitBlt (hdcMask, 0, 0, himl->cx, himl->cy,
hdcImageList, himl->cx * btnPtr->iBitmap, 0, SRCCOPY);
/* draw the new mask */ /* draw the new mask */
SelectObject (hdc, GetSysColorBrush (COLOR_3DHILIGHT)); SelectObject (hdc, GetSysColorBrush (COLOR_3DHILIGHT));
BitBlt (hdc, x+1, y+1, himl->cx, himl->cy, BitBlt (hdc, x+1, y+1, cx, cy, hdcMask, 0, 0, 0xB8074A);
hdcMask, 0, 0, 0xB8074A);
SelectObject (hdc, GetSysColorBrush (COLOR_3DSHADOW)); SelectObject (hdc, GetSysColorBrush (COLOR_3DSHADOW));
BitBlt (hdc, x, y, himl->cx, himl->cy, BitBlt (hdc, x, y, cx, cy, hdcMask, 0, 0, 0xB8074A);
hdcMask, 0, 0, 0xB8074A);
DeleteObject (hbmMask); DeleteObject (hbmMask);
DeleteDC (hdcMask); DeleteDC (hdcMask);
DeleteDC (hdcImageList);
} }
...@@ -3962,11 +3952,8 @@ TOOLBAR_SetBitmapSize (HWND hwnd, WPARAM wParam, LPARAM lParam) ...@@ -3962,11 +3952,8 @@ TOOLBAR_SetBitmapSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr->nBitmapWidth = (INT)LOWORD(lParam); infoPtr->nBitmapWidth = (INT)LOWORD(lParam);
infoPtr->nBitmapHeight = (INT)HIWORD(lParam); infoPtr->nBitmapHeight = (INT)HIWORD(lParam);
/* uses image list internals directly */ if (himlDef)
if (himlDef) { ImageList_SetIconSize(himlDef, infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
himlDef->cx = infoPtr->nBitmapWidth;
himlDef->cy = infoPtr->nBitmapHeight;
}
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment