Henri Verbeet : wined3d: Make sure transparent hardware cursors are really transparent.

Alexandre Julliard julliard at winehq.org
Fri Jan 27 11:30:40 CST 2012


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Jan 26 23:04:19 2012 +0100

wined3d: Make sure transparent hardware cursors are really transparent.

Loosely based on a patch by Stefan Dösinger.

---

 dlls/wined3d/device.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index e5f3506..2d014ab 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5004,14 +5004,16 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
 
         if (cursor_image->resource.width == 32 && cursor_image->resource.height == 32)
         {
-            /* Draw a hardware cursor */
+            UINT mask_size = cursor_image->resource.width * cursor_image->resource.height / 8;
             ICONINFO cursorInfo;
+            DWORD *maskBits;
             HCURSOR cursor;
-            /* Create and clear maskBits because it is not needed for
-             * 32-bit cursors.  32x32 bits split into 32-bit chunks == 32
-             * chunks. */
-            DWORD *maskBits = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
-                    (cursor_image->resource.width * cursor_image->resource.height / 8));
+
+            /* 32-bit user32 cursors ignore the alpha channel if it's all
+             * zeroes, and use the mask instead. Fill the mask with all ones
+             * to ensure we still get a fully transparent cursor. */
+            maskBits = HeapAlloc(GetProcessHeap(), 0, mask_size);
+            memset(maskBits, 0xff, mask_size);
             wined3d_surface_map(cursor_image, &mapped_rect, NULL,
                     WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY);
             TRACE("width: %u height: %u.\n", cursor_image->resource.width, cursor_image->resource.height);




More information about the wine-cvs mailing list