[ros-diffs] [cwittich] 30790: fix TAG_BITMAP redzone overwrite for colordepths != 32 bit

cwittich at svn.reactos.org cwittich at svn.reactos.org
Mon Nov 26 21:45:06 CET 2007


Author: cwittich
Date: Mon Nov 26 23:45:05 2007
New Revision: 30790

URL: http://svn.reactos.org/svn/reactos?rev=30790&view=rev
Log:
fix TAG_BITMAP redzone overwrite for colordepths != 32 bit

Modified:
    trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c?rev=30790&r1=30789&r2=30790&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c Mon Nov 26 23:45:05 2007
@@ -1401,8 +1401,7 @@
    }
 
    /* NtGdiCreateCompatibleBitmap will create a monochrome bitmap
-      when cxWidth or cyHeight is 0
-   */
+      when cxWidth or cyHeight is 0 */
    if ((bmpColor.bmBitsPixel == 32) && (cxWidth != 0) && (cyHeight != 0))
    {
       bAlpha = TRUE;
@@ -1425,6 +1424,9 @@
    if (DoFlickerFree || bAlpha)
    {
       RECT r;
+      BITMAP bm;
+      BITMAPOBJ *BitmapObj = NULL;
+
       r.right = cxWidth;
       r.bottom = cyHeight;
 
@@ -1441,6 +1443,21 @@
          DPRINT1("NtGdiCreateCompatibleBitmap() failed!\n");
          goto cleanup;
       }
+
+      /* make sure we have a 32 bit offscreen bitmap
+        otherwise we can't do alpha blending */
+      BitmapObj = BITMAPOBJ_LockBitmap(hbmOff);
+      if (BitmapObj == NULL)
+      {
+          DPRINT1("GDIOBJ_LockObj() failed!\n");
+          goto cleanup;
+      }
+      BITMAP_GetObject(BitmapObj, sizeof(BITMAP), &bm);
+
+      if (bm.bmBitsPixel != 32)
+        bAlpha = FALSE;
+
+      BITMAPOBJ_UnlockBitmap(BitmapObj);
 
       hOldOffBmp = NtGdiSelectObject(hdcOff, hbmOff);
       if (!hOldOffBmp)




More information about the Ros-diffs mailing list