Andrew Riedi : user32: Fix the loading of stretched cursors.

Alexandre Julliard julliard at winehq.org
Fri Nov 21 06:55:19 CST 2008


Module: wine
Branch: master
Commit: 1425b1b9ef9099933876ba28625bbb5a16fbcabe
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1425b1b9ef9099933876ba28625bbb5a16fbcabe

Author: Andrew Riedi <andrewriedi at gmail.com>
Date:   Thu Nov 20 06:39:53 2008 -0800

user32: Fix the loading of stretched cursors.

Based on patches by Henri Verbeet.

---

 dlls/user32/cursoricon.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index b57ce2a..26676de 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -698,6 +698,13 @@ static HICON CURSORICON_CreateIconFromBMI( BITMAPINFO *bmi,
     DoStretch = (bmi->bmiHeader.biHeight/2 != height) ||
       (bmi->bmiHeader.biWidth != width);
 
+    /* Scale the hotspot */
+    if (DoStretch && 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);
+    }
+
     if (!screen_dc) screen_dc = CreateDCW( DISPLAYW, NULL, NULL, NULL );
     if (screen_dc)
     {
@@ -723,14 +730,7 @@ static HICON CURSORICON_CreateIconFromBMI( BITMAPINFO *bmi,
             /* Create the XOR bitmap */
 
             if (DoStretch) {
-                if(bIcon)
-                {
-                    hXorBits = CreateCompatibleBitmap(screen_dc, width, height);
-                }
-                else
-                {
-                    hXorBits = CreateBitmap(width, height, 1, 1, NULL);
-                }
+                hXorBits = CreateCompatibleBitmap(screen_dc, width, height);
                 if(hXorBits)
                 {
                 HBITMAP hOld;




More information about the wine-cvs mailing list