[SHELL32]

When creating a shortcut icon and we have 32 bpp, use GdiAlphaBlend to create the final bitmap. This is neccessary, since we want to support alpha channels and those are destroyed when using SRCPAINT or any similar ROPs on the alpha bitmap (not a bug, Windows works like that, too). We could use MaskBlt, if it would work correctly, but on reactos it destroys the alpha channel as well (bug!), it's also most likely slower then the current solution.
Fixes broken overlay icons.
See issue #5455 for more details.

svn path=/trunk/; revision=48463
This commit is contained in:
Timo Kreuzer 2010-08-05 14:42:56 +00:00
parent 1eac149580
commit b51cf52307

View file

@ -171,11 +171,25 @@ static HICON SIC_OverlayShortcutImage(HICON SourceIcon, BOOL large)
goto fail;
}
/* Copy the source color bitmap to the target */
if (! BitBlt(TargetDC, 0, 0, SourceBitmapInfo.bmWidth, SourceBitmapInfo.bmHeight,
SourceDC, 0, 0, SRCCOPY)) goto fail;
/* Check if we can use alpha blending */
if (ShortcutBitmapInfo.bmBitsPixel == 32)
{
/* Use alpha blending to make sure the target alpha channel stays valid */
if (NULL == SelectObject(ShortcutDC, ShortcutIconInfo.hbmColor)) goto fail;
if (!GdiAlphaBlend(TargetDC, 0, SourceBitmapInfo.bmHeight - ShortcutBitmapInfo.bmHeight,
ShortcutBitmapInfo.bmWidth, ShortcutBitmapInfo.bmHeight,
ShortcutDC, 0, 0, ShortcutBitmapInfo.bmWidth, ShortcutBitmapInfo.bmHeight,
(BLENDFUNCTION){AC_SRC_OVER, 0, 255, AC_SRC_ALPHA})) goto fail;
}
else
{
/* Copy the source xor bitmap to the target and clear out part of it by using
the shortcut mask */
if (! BitBlt(TargetDC, 0, 0, SourceBitmapInfo.bmWidth, SourceBitmapInfo.bmHeight,
SourceDC, 0, 0, SRCCOPY) ||
! BitBlt(TargetDC, 0, SourceBitmapInfo.bmHeight - ShortcutBitmapInfo.bmHeight,
if (! BitBlt(TargetDC, 0, SourceBitmapInfo.bmHeight - ShortcutBitmapInfo.bmHeight,
ShortcutBitmapInfo.bmWidth, ShortcutBitmapInfo.bmHeight,
ShortcutDC, 0, 0, SRCAND))
{
@ -191,6 +205,7 @@ static HICON SIC_OverlayShortcutImage(HICON SourceIcon, BOOL large)
{
goto fail;
}
}
/* Clean up, we're not goto'ing to 'fail' after this so we can be lazy and not set
handles to NULL */