comctl32/imagelist: Support flag ILS_SATURATE for ImageList_DrawIndirect().
Signed-off-by: Ziqing Hui <zhui@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7a1727004b
commit
d6305e1bdb
|
@ -1242,7 +1242,7 @@ ImageList_DrawEx (HIMAGELIST himl, INT i, HDC hdc, INT x, INT y,
|
|||
|
||||
static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int dest_y,
|
||||
int src_x, int src_y, int cx, int cy, BLENDFUNCTION func,
|
||||
UINT style, COLORREF blend_col, BOOL has_alpha )
|
||||
UINT style, COLORREF blend_col, BOOL has_alpha, BOOL grayscale )
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
HDC hdc;
|
||||
|
@ -1293,6 +1293,18 @@ static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int des
|
|||
}
|
||||
}
|
||||
|
||||
if (grayscale)
|
||||
{
|
||||
for (i = 0, ptr = bits; i < cx * cy; i++, ptr++)
|
||||
{
|
||||
DWORD gray = (((*ptr & 0x00ff0000) >> 16) * 299 +
|
||||
((*ptr & 0x0000ff00) >> 8) * 587 +
|
||||
((*ptr & 0x000000ff) >> 0) * 114 + 500) / 1000;
|
||||
if (has_alpha) gray = gray * (*ptr >> 24) / 255;
|
||||
*ptr = (*ptr & 0xff000000)| (gray << 16) | (gray << 8) | gray;
|
||||
}
|
||||
}
|
||||
|
||||
if (has_alpha) /* we already have an alpha channel in this case */
|
||||
{
|
||||
/* pre-multiply by the alpha channel */
|
||||
|
@ -1422,7 +1434,7 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
|
|||
oldImageBk = SetBkColor( hImageDC, RGB( 0xff, 0xff, 0xff ) );
|
||||
|
||||
has_alpha = (himl->has_alpha && himl->has_alpha[pimldp->i]);
|
||||
if (!bMask && (has_alpha || (fState & ILS_ALPHA)))
|
||||
if (!bMask && (has_alpha || (fState & ILS_ALPHA) || (fState & ILS_SATURATE)))
|
||||
{
|
||||
COLORREF colour, blend_col = CLR_NONE;
|
||||
BLENDFUNCTION func;
|
||||
|
@ -1441,8 +1453,8 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
|
|||
|
||||
if (bIsTransparent)
|
||||
{
|
||||
bResult = alpha_blend_image( himl, pimldp->hdcDst, pimldp->x, pimldp->y,
|
||||
pt.x, pt.y, cx, cy, func, fStyle, blend_col, has_alpha );
|
||||
bResult = alpha_blend_image( himl, pimldp->hdcDst, pimldp->x, pimldp->y, pt.x, pt.y, cx, cy,
|
||||
func, fStyle, blend_col, has_alpha, fState & ILS_SATURATE );
|
||||
goto end;
|
||||
}
|
||||
colour = pimldp->rgbBk;
|
||||
|
@ -1451,7 +1463,8 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
|
|||
|
||||
hOldBrush = SelectObject (hImageDC, CreateSolidBrush (colour));
|
||||
PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY );
|
||||
alpha_blend_image( himl, hImageDC, 0, 0, pt.x, pt.y, cx, cy, func, fStyle, blend_col, has_alpha );
|
||||
alpha_blend_image( himl, hImageDC, 0, 0, pt.x, pt.y, cx, cy, func,
|
||||
fStyle, blend_col, has_alpha, fState & ILS_SATURATE );
|
||||
DeleteObject (SelectObject (hImageDC, hOldBrush));
|
||||
bResult = BitBlt( pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, hImageDC, 0, 0, SRCCOPY );
|
||||
goto end;
|
||||
|
@ -1545,7 +1558,6 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
|
|||
}
|
||||
}
|
||||
|
||||
if (fState & ILS_SATURATE) FIXME("ILS_SATURATE: unimplemented!\n");
|
||||
if (fState & ILS_GLOW) FIXME("ILS_GLOW: unimplemented!\n");
|
||||
if (fState & ILS_SHADOW) FIXME("ILS_SHADOW: unimplemented!\n");
|
||||
|
||||
|
|
|
@ -1475,7 +1475,6 @@ static void check_ImageList_DrawIndirect_grayscale(HDC hdc, HIMAGELIST himl, UIN
|
|||
expected = (gray << 16) | (gray << 8) | gray;
|
||||
expected_winxp = (gray_winxp << 16) | (gray_winxp << 8) | gray_winxp;
|
||||
|
||||
todo_wine_if(expected != 0 && expected != 0x00FFFFFF)
|
||||
ok(colour_match(dst_bits[i], expected) || broken(colour_match(dst_bits[i], expected_winxp)),
|
||||
"ImageList_DrawIndirect: got Pixel(%d,%d) %08X, Expected a close match to %08X from line %d\n",
|
||||
i % width, i / width, dst_bits[i] & 0x00FFFFFF, expected, line);
|
||||
|
|
Loading…
Reference in New Issue