From 3f8eea6f21f8ee2eea42df6b90abcb7b6ce9d9c8 Mon Sep 17 00:00:00 2001 From: Andrew Riedi Date: Thu, 20 Nov 2008 06:39:53 -0800 Subject: [PATCH] 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; -- 1.5.6.3