Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
5c5a0608
Commit
5c5a0608
authored
Jun 28, 2004
by
Robert Shearman
Committed by
Alexandre Julliard
Jun 28, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Clean up the mask drawing code.
- Improve bitmap not found message.
parent
f3b681a2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
45 deletions
+45
-45
toolbar.c
dlls/comctl32/toolbar.c
+45
-45
No files found.
dlls/comctl32/toolbar.c
View file @
5c5a0608
...
...
@@ -407,7 +407,7 @@ TOOLBAR_GetImageListForDrawing (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, IMA
if
(
!
TOOLBAR_IsValidBitmapIndex
(
infoPtr
,
btnPtr
->
iBitmap
))
{
if
(
btnPtr
->
iBitmap
==
I_IMAGENONE
)
return
NULL
;
ERR
(
"
index %d,%d is not valid, max
%d
\n
"
,
ERR
(
"
bitmap for ID %d, index %d is not valid, number of bitmaps in imagelist:
%d
\n
"
,
HIWORD
(
btnPtr
->
iBitmap
),
LOWORD
(
btnPtr
->
iBitmap
),
infoPtr
->
nNumBitmaps
);
return
NULL
;
}
...
...
@@ -641,54 +641,46 @@ TOOLBAR_DrawPattern (LPRECT lpRect, NMTBCUSTOMDRAW *tbcd)
}
static
void
TOOLBAR_DrawMasked
(
TOOLBAR_INFO
*
infoPtr
,
TBUTTON_INFO
*
btnPtr
,
HDC
hdc
,
INT
x
,
INT
y
)
static
void
TOOLBAR_DrawMasked
(
HIMAGELIST
himl
,
int
index
,
HDC
hdc
,
INT
x
,
INT
y
,
UINT
draw_flags
)
{
int
index
;
H
IMAGELIST
himl
=
TOOLBAR_GetImageListForDrawing
(
infoPtr
,
btnPtr
,
IMAGE_LIST_DEFAULT
,
&
index
)
;
INT
cx
,
cy
;
H
BITMAP
hbmMask
,
hbmImage
;
HDC
hdcMask
,
hdcImage
;
if
(
himl
)
{
INT
cx
,
cy
;
HBITMAP
hbmMask
,
hbmImage
;
HDC
hdcMask
,
hdcImage
;
ImageList_GetIconSize
(
himl
,
&
cx
,
&
cy
);
ImageList_GetIconSize
(
himl
,
&
cx
,
&
cy
);
/* Create src image */
hdcImage
=
CreateCompatibleDC
(
hdc
);
hbmImage
=
CreateBitmap
(
cx
,
cy
,
GetDeviceCaps
(
hdc
,
PLANES
),
GetDeviceCaps
(
hdc
,
BITSPIXEL
),
NULL
);
SelectObject
(
hdcImage
,
hbmImage
);
ImageList_DrawEx
(
himl
,
index
,
hdcImage
,
0
,
0
,
cx
,
cy
,
RGB
(
0xff
,
0xff
,
0xff
),
RGB
(
0
,
0
,
0
),
ILD_NORMAL
);
/* Create src image */
hdcImage
=
CreateCompatibleDC
(
hdc
);
hbmImage
=
CreateBitmap
(
cx
,
cy
,
GetDeviceCaps
(
hdc
,
PLANES
),
GetDeviceCaps
(
hdc
,
BITSPIXEL
),
NULL
);
SelectObject
(
hdcImage
,
hbmImage
);
ImageList_DrawEx
(
himl
,
index
,
hdcImage
,
0
,
0
,
cx
,
cy
,
RGB
(
0xff
,
0xff
,
0xff
),
RGB
(
0
,
0
,
0
),
draw_flags
);
/* Create Mask */
hdcMask
=
CreateCompatibleDC
(
0
);
hbmMask
=
CreateBitmap
(
cx
,
cy
,
1
,
1
,
NULL
);
SelectObject
(
hdcMask
,
hbmMask
);
/* Create Mask */
hdcMask
=
CreateCompatibleDC
(
0
);
hbmMask
=
CreateBitmap
(
cx
,
cy
,
1
,
1
,
NULL
);
SelectObject
(
hdcMask
,
hbmMask
);
/* Remove the background and all white pixels */
SetBkColor
(
hdcImage
,
ImageList_GetBkColor
(
himl
));
BitBlt
(
hdcMask
,
0
,
0
,
cx
,
cy
,
hdcImage
,
0
,
0
,
SRCCOPY
);
SetBkColor
(
hdcImage
,
RGB
(
0xff
,
0xff
,
0xff
));
BitBlt
(
hdcMask
,
0
,
0
,
cx
,
cy
,
hdcImage
,
0
,
0
,
NOTSRCERASE
);
/* Remove the background and all white pixels */
SetBkColor
(
hdcImage
,
ImageList_GetBkColor
(
himl
));
BitBlt
(
hdcMask
,
0
,
0
,
cx
,
cy
,
hdcImage
,
0
,
0
,
SRCCOPY
);
SetBkColor
(
hdcImage
,
RGB
(
0xff
,
0xff
,
0xff
));
BitBlt
(
hdcMask
,
0
,
0
,
cx
,
cy
,
hdcImage
,
0
,
0
,
NOTSRCERASE
);
/* draw the new mask 'etched' to hdc */
SetBkColor
(
hdc
,
RGB
(
255
,
255
,
255
));
SelectObject
(
hdc
,
GetSysColorBrush
(
COLOR_3DHILIGHT
));
/* E20746 op code is (Dst ^ (Src & (Pat ^ Dst))) */
BitBlt
(
hdc
,
x
+
1
,
y
+
1
,
cx
,
cy
,
hdcMask
,
0
,
0
,
0xE20746
);
SelectObject
(
hdc
,
GetSysColorBrush
(
COLOR_3DSHADOW
));
BitBlt
(
hdc
,
x
,
y
,
cx
,
cy
,
hdcMask
,
0
,
0
,
0xE20746
);
/* draw the new mask 'etched' to hdc */
SetBkColor
(
hdc
,
RGB
(
255
,
255
,
255
));
SelectObject
(
hdc
,
GetSysColorBrush
(
COLOR_3DHILIGHT
));
/* E20746 op code is (Dst ^ (Src & (Pat ^ Dst))) */
BitBlt
(
hdc
,
x
+
1
,
y
+
1
,
cx
,
cy
,
hdcMask
,
0
,
0
,
0xE20746
);
SelectObject
(
hdc
,
GetSysColorBrush
(
COLOR_3DSHADOW
));
BitBlt
(
hdc
,
x
,
y
,
cx
,
cy
,
hdcMask
,
0
,
0
,
0xE20746
);
/* Cleanup */
DeleteObject
(
hbmImage
);
DeleteDC
(
hdcImage
);
DeleteObject
(
hbmMask
);
DeleteDC
(
hdcMask
);
}
/* Cleanup */
DeleteObject
(
hbmImage
);
DeleteDC
(
hdcImage
);
DeleteObject
(
hbmMask
);
DeleteDC
(
hdcMask
);
}
...
...
@@ -721,7 +713,10 @@ TOOLBAR_DrawImage(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top
{
himl
=
TOOLBAR_GetImageListForDrawing
(
infoPtr
,
btnPtr
,
IMAGE_LIST_DISABLED
,
&
index
);
if
(
!
himl
)
draw_masked
=
TRUE
;
{
himl
=
TOOLBAR_GetImageListForDrawing
(
infoPtr
,
btnPtr
,
IMAGE_LIST_DEFAULT
,
&
index
);
draw_masked
=
TRUE
;
}
}
else
if
((
tbcd
->
nmcd
.
uItemState
&
CDIS_HOT
)
&&
(
infoPtr
->
dwStyle
&
TBSTYLE_FLAT
))
{
...
...
@@ -734,6 +729,9 @@ TOOLBAR_DrawImage(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top
else
himl
=
TOOLBAR_GetImageListForDrawing
(
infoPtr
,
btnPtr
,
IMAGE_LIST_DEFAULT
,
&
index
);
if
(
!
himl
)
return
;
if
(
!
(
infoPtr
->
dwItemCDFlag
&
TBCDRF_NOOFFSET
)
&&
(
tbcd
->
nmcd
.
uItemState
&
(
CDIS_SELECTED
|
CDIS_CHECKED
)))
offset
=
1
;
...
...
@@ -746,8 +744,8 @@ TOOLBAR_DrawImage(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top
index
,
himl
,
left
,
top
,
offset
);
if
(
draw_masked
)
TOOLBAR_DrawMasked
(
infoPtr
,
btnPtr
,
tbcd
->
nmcd
.
hdc
,
left
+
offset
,
top
+
offset
);
else
if
(
himl
)
TOOLBAR_DrawMasked
(
himl
,
index
,
tbcd
->
nmcd
.
hdc
,
left
+
offset
,
top
+
offset
,
draw_flags
);
else
ImageList_Draw
(
himl
,
index
,
tbcd
->
nmcd
.
hdc
,
left
+
offset
,
top
+
offset
,
draw_flags
);
}
...
...
@@ -5313,6 +5311,8 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
NMTOOLBARA
nmtb
;
BOOL
bDragKeyPressed
;
TRACE
(
"
\n
"
);
if
(
infoPtr
->
dwStyle
&
TBSTYLE_ALTDRAG
)
bDragKeyPressed
=
(
GetKeyState
(
VK_MENU
)
<
0
);
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment