[win32k]
authorGregor Schneider <grschneider@gmail.com>
Tue, 29 Dec 2009 18:21:00 +0000 (18:21 +0000)
committerGregor Schneider <grschneider@gmail.com>
Tue, 29 Dec 2009 18:21:00 +0000 (18:21 +0000)
- Add mask offset coordinates to GreStretchBltMask parameters, add code to handle a mask offset
- Only fail if the mask is smaller than the color bitmap, print sizes in this case
- Adapt callers to GreStretchBltMask changes
- DrawIcon: use new features to combine mask and color images
- Mouse control panel now shows cursors again (masks still need some work), fixes ~15 user32:cursoricon tests

svn path=/trunk/; revision=44803

reactos/subsystems/win32/win32k/include/intgdi.h
reactos/subsystems/win32/win32k/ntuser/cursoricon.c
reactos/subsystems/win32/win32k/objects/bitblt.c

index 5f3612a..d5e63c9 100644 (file)
@@ -258,7 +258,9 @@ GreStretchBltMask(IN HDC hdcDst,
                   IN INT cySrc,
                   IN DWORD dwRop,
                   IN DWORD dwBackColor,
-                  IN HDC hdcMask);
+                  IN HDC hdcMask,
+                  IN INT xMask,
+                  IN INT yMask);
 
 #endif /* _WIN32K_INTGDI_H */
 
index b937259..40b6c68 100644 (file)
@@ -1362,13 +1362,14 @@ UserDrawIconEx(
                           cyHeight,
                           hdcImage ? hdcImage : hdcMask,
                           0,
-                          ((diFlags & DI_MASK && !(diFlags & DI_IMAGE)) ||
-                           (diFlags & DI_IMAGE && hbmColor) ? 0 : IconSize.cy),
+                          0,
                           IconSize.cx,
                           IconSize.cy,
                           SRCCOPY,
                           0,
-                          hdcImage ? hdcMask : NULL);
+                          hdcMask,
+                          0,
+                          hdcImage ? 0 : IconSize.cy);
     }
 
     if (hOldMask) NtGdiSelectBitmap(hdcMask, hOldMask);
index 61942aa..a02d652 100644 (file)
@@ -703,7 +703,9 @@ GreStretchBltMask(
     INT HeightSrc,
     DWORD ROP,
     IN DWORD dwBackColor,
-    HDC hDCMask)
+    HDC hDCMask,
+    INT XOriginMask,
+    INT YOriginMask)
 {
     PDC DCDest;
     PDC DCSrc  = NULL;
@@ -713,6 +715,7 @@ GreStretchBltMask(
     SURFACE *BitmapMask = NULL;
     RECTL DestRect;
     RECTL SourceRect;
+    POINTL MaskPoint;
     BOOL Status = FALSE;
     EXLATEOBJ exlo;
     XLATEOBJ *XlateObj = NULL;
@@ -827,12 +830,20 @@ GreStretchBltMask(
         {
             BitmapMask = DCMask->dclevel.pSurface;
             if (BitmapMask &&
-                (BitmapMask->SurfObj.sizlBitmap.cx != WidthSrc ||
-                 BitmapMask->SurfObj.sizlBitmap.cy != HeightSrc))
+                (BitmapMask->SurfObj.sizlBitmap.cx < WidthSrc ||
+                 BitmapMask->SurfObj.sizlBitmap.cy < HeightSrc))
             {
-                DPRINT1("Mask and bitmap sizes don't match!\n");
+                DPRINT1("%dx%d mask is smaller than %dx%d bitmap\n", 
+                        BitmapMask->SurfObj.sizlBitmap.cx, BitmapMask->SurfObj.sizlBitmap.cy, 
+                        WidthSrc, HeightSrc);
                 goto failed;
             }
+            /* Create mask offset point */
+            MaskPoint.x = XOriginMask;
+            MaskPoint.y = YOriginMask;
+            IntLPtoDP(DCMask, &MaskPoint, 1);
+            MaskPoint.x += DCMask->ptlDCOrig.x;
+            MaskPoint.y += DCMask->ptlDCOrig.x;
         }
     }
 
@@ -844,7 +855,7 @@ GreStretchBltMask(
                               XlateObj,
                               &DestRect,
                               &SourceRect,
-                              NULL,
+                              BitmapMask ? &MaskPoint : NULL,
                               &DCDest->eboFill.BrushObject,
                               &BrushOrigin,
                               ROP3_TO_ROP4(ROP));
@@ -896,7 +907,9 @@ NtGdiStretchBlt(
                 HeightSrc,
                 ROP,
                 dwBackColor,
-                NULL);
+                NULL,
+                0,
+                0);
 }