user32: Restore special handling of monochrome bitmaps removed by c2202929ab4b6d1ce379865dfd8904186814f265.
Dmitry Timoshkov
dmitry at codeweavers.com
Thu Mar 11 02:22:33 CST 2010
This patch fixes the regression in Access 2000 with mouse cursors introduced by
c2202929ab4b6d1ce379865dfd8904186814f265 is the first bad commit
commit c2202929ab4b6d1ce379865dfd8904186814f265
Author: Joel Holdsworth <joel at airwebreathe.org.uk>
Date: Mon Jun 29 19:10:36 2009 +0100
user32: Fixed CURSORICON_CreateIconFromBMI to preserve the alpha channel.
:040000 040000 a16e47d4a4ed568eb8e3fa4f4e84b20b7b7ceffd b2022d036c05cc39c0ae217a9ba0bb2ffa82dfd9 M dlls
---
dlls/user32/cursoricon.c | 49 ++++++++++++++++++++++++++++++++++-----------
1 files changed, 37 insertions(+), 12 deletions(-)
diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index a003cb0..c3d775e 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -765,6 +765,7 @@ static HICON CURSORICON_CreateIconFromBMI( BITMAPINFO *bmi,
int sizeAnd, sizeXor;
HBITMAP hAndBits = 0, hXorBits = 0; /* error condition for later */
BITMAP bmpXor, bmpAnd;
+ BOOL do_stretch;
INT size;
BITMAPINFO *pSrcInfo, *pDestInfo;
@@ -788,10 +789,11 @@ static HICON CURSORICON_CreateIconFromBMI( BITMAPINFO *bmi,
if (!width) width = bmi->bmiHeader.biWidth;
if (!height) height = bmi->bmiHeader.biHeight/2;
+ do_stretch = (bmi->bmiHeader.biHeight/2 != height) ||
+ (bmi->bmiHeader.biWidth != width);
/* Scale the hotspot */
- if (((bmi->bmiHeader.biHeight/2 != height) || (bmi->bmiHeader.biWidth != width)) &&
- hotspot.x != ICON_HOTSPOT && hotspot.y != ICON_HOTSPOT)
+ if (do_stretch && hotspot.x != ICON_HOTSPOT && hotspot.y != ICON_HOTSPOT)
{
hotspot.x = (hotspot.x * width) / bmi->bmiHeader.biWidth;
hotspot.y = (hotspot.y * height) / (bmi->bmiHeader.biHeight / 2);
@@ -842,16 +844,30 @@ static HICON CURSORICON_CreateIconFromBMI( BITMAPINFO *bmi,
}
else
{
- hXorBits = CreateCompatibleBitmap(screen_dc, width, height);
-
- if(hXorBits)
+ if (do_stretch)
{
- if(!stretch_blt_icon(hXorBits, pDestInfo, pSrcInfo, (char*)bmi + size))
+ hXorBits = CreateCompatibleBitmap(screen_dc, width, height);
+ if (hXorBits)
{
- DeleteObject(hXorBits);
- hXorBits = 0;
+ if (!stretch_blt_icon(hXorBits, pDestInfo, pSrcInfo, (char*)bmi + size))
+ {
+ DeleteObject(hXorBits);
+ hXorBits = 0;
+ }
}
}
+ else
+ {
+ if (is_dib_monochrome(bmi))
+ {
+ hXorBits = CreateBitmap(width, height, 1, 1, NULL);
+ SetDIBits(screen_dc, hXorBits, 0, height,
+ (char *)bmi + size, pSrcInfo, DIB_RGB_COLORS);
+ }
+ else
+ hXorBits = CreateDIBitmap(screen_dc, &pSrcInfo->bmiHeader,
+ CBM_INIT, (char *)bmi + size, pSrcInfo, DIB_RGB_COLORS);
+ }
}
if( hXorBits )
@@ -879,12 +895,21 @@ static HICON CURSORICON_CreateIconFromBMI( BITMAPINFO *bmi,
}
/* Create the AND bitmap */
- hAndBits = CreateBitmap(width, height, 1, 1, NULL);
+ if (do_stretch)
+ {
+ hAndBits = CreateBitmap(width, height, 1, 1, NULL);
- if(!stretch_blt_icon(hAndBits, pDestInfo, pSrcInfo, xbits))
+ if (!stretch_blt_icon(hAndBits, pDestInfo, pSrcInfo, xbits))
+ {
+ DeleteObject(hAndBits);
+ hAndBits = 0;
+ }
+ }
+ else
{
- DeleteObject(hAndBits);
- hAndBits = 0;
+ hAndBits = CreateBitmap(width, height, 1, 1, NULL);
+ SetDIBits(screen_dc, hAndBits, 0, height,
+ xbits, pSrcInfo, DIB_RGB_COLORS);
}
if( !hAndBits )
--
1.7.0.1
More information about the wine-patches
mailing list