Alexandre Julliard : user32: Make DrawIcon simply call DrawIconEx.
Alexandre Julliard
julliard at winehq.org
Fri May 7 09:41:14 CDT 2010
Module: wine
Branch: master
Commit: 159145cefe10d5a75a5d80c3115e6923c0b43344
URL: http://source.winehq.org/git/wine.git/?a=commit;h=159145cefe10d5a75a5d80c3115e6923c0b43344
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri May 7 12:45:39 2010 +0200
user32: Make DrawIcon simply call DrawIconEx.
---
dlls/user32/cursoricon.c | 83 +---------------------------------------------
1 files changed, 1 insertions(+), 82 deletions(-)
diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index bafe4a7..856d900 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -1656,88 +1656,7 @@ static void premultiply_alpha_channel( unsigned char *destBitmap,
*/
BOOL WINAPI DrawIcon( HDC hdc, INT x, INT y, HICON hIcon )
{
- CURSORICONINFO *ptr;
- HDC hMemDC;
- HBITMAP hXorBits = NULL, hAndBits = NULL, hBitTemp = NULL;
- COLORREF oldFg, oldBg;
- unsigned char *xorBitmapBits;
- unsigned int dibLength;
-
- TRACE("%p, (%d,%d), %p\n", hdc, x, y, hIcon);
-
- if (!(ptr = get_icon_ptr( hIcon ))) return FALSE;
- if (!(hMemDC = CreateCompatibleDC( hdc )))
- {
- release_icon_ptr( hIcon, ptr );
- return FALSE;
- }
-
- dibLength = ptr->nHeight * get_bitmap_width_bytes(
- ptr->nWidth, ptr->bBitsPerPixel);
-
- xorBitmapBits = (unsigned char *)(ptr + 1) + ptr->nHeight *
- get_bitmap_width_bytes(ptr->nWidth, 1);
-
- oldFg = SetTextColor( hdc, RGB(0,0,0) );
- oldBg = SetBkColor( hdc, RGB(255,255,255) );
-
- if(bitmap_has_alpha_channel(ptr->bBitsPerPixel, xorBitmapBits, dibLength))
- {
- BITMAPINFOHEADER bmih;
- unsigned char *dibBits;
-
- memset(&bmih, 0, sizeof(BITMAPINFOHEADER));
- bmih.biSize = sizeof(BITMAPINFOHEADER);
- bmih.biWidth = ptr->nWidth;
- bmih.biHeight = -ptr->nHeight;
- bmih.biPlanes = ptr->bPlanes;
- bmih.biBitCount = 32;
- bmih.biCompression = BI_RGB;
-
- hXorBits = CreateDIBSection(hdc, (BITMAPINFO*)&bmih, DIB_RGB_COLORS,
- (void*)&dibBits, NULL, 0);
-
- if (hXorBits && dibBits)
- {
- BLENDFUNCTION pixelblend = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
-
- /* Do the alpha blending render */
- premultiply_alpha_channel(dibBits, xorBitmapBits, dibLength);
- hBitTemp = SelectObject( hMemDC, hXorBits );
- /* Destination width/height has to be "System Large" size */
- GdiAlphaBlend(hdc, x, y, GetSystemMetrics(SM_CXICON),
- GetSystemMetrics(SM_CYICON), hMemDC,
- 0, 0, ptr->nWidth, ptr->nHeight, pixelblend);
- SelectObject( hMemDC, hBitTemp );
- }
- }
- else
- {
- hAndBits = CreateBitmap( ptr->nWidth, ptr->nHeight, 1, 1, ptr + 1 );
- hXorBits = CreateBitmap( ptr->nWidth, ptr->nHeight, ptr->bPlanes,
- ptr->bBitsPerPixel, xorBitmapBits);
-
- if (hXorBits && hAndBits)
- {
- hBitTemp = SelectObject( hMemDC, hAndBits );
- StretchBlt( hdc, x, y, GetSystemMetrics(SM_CXICON),
- GetSystemMetrics(SM_CYICON), hMemDC, 0, 0,
- ptr->nWidth, ptr->nHeight, SRCAND );
- SelectObject( hMemDC, hXorBits );
- StretchBlt( hdc, x, y, GetSystemMetrics(SM_CXICON),
- GetSystemMetrics(SM_CYICON), hMemDC, 0, 0,
- ptr->nWidth, ptr->nHeight, SRCINVERT );
- SelectObject( hMemDC, hBitTemp );
- }
- }
-
- DeleteDC( hMemDC );
- if (hXorBits) DeleteObject( hXorBits );
- if (hAndBits) DeleteObject( hAndBits );
- release_icon_ptr( hIcon, ptr );
- SetTextColor( hdc, oldFg );
- SetBkColor( hdc, oldBg );
- return TRUE;
+ return DrawIconEx( hdc, x, y, hIcon, 0, 0, 0, 0, DI_NORMAL | DI_COMPAT | DI_DEFAULTSIZE );
}
/***********************************************************************
More information about the wine-cvs
mailing list