Author: tkreuzer
Date: Mon Apr 23 10:12:35 2012
New Revision: 56392

URL: http://svn.reactos.org/svn/reactos?rev=56392&view=rev
Log:
[WIN32K]
- Fix calculation of the brush origin. The coordinates passed to EngBitBlt 
"defines which pixel in the mask corresponds to the upper left corner of the 
destination rectangle." Our code was using it as corresponding to the surface 
origin.
The fix is currently only used when the new dib code is compiled. The old dib 
code is broken and expects the broken behaviour

Modified:
    trunk/reactos/win32ss/gdi/eng/bitblt.c
    trunk/reactos/win32ss/gdi/ntgdi/bitblt.c

Modified: trunk/reactos/win32ss/gdi/eng/bitblt.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/bitblt.c?rev=56392&r1=56391&r2=56392&view=diff
==============================================================================
--- trunk/reactos/win32ss/gdi/eng/bitblt.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/eng/bitblt.c [iso-8859-1] Mon Apr 23 10:12:35 2012
@@ -471,6 +471,13 @@
             ClipRect.bottom = ClipRegion->rclBounds.bottom;
             if (RECTL_bIntersectRect(&CombinedRect, &OutputRect, &ClipRect))
             {
+#ifdef _USE_DIBLIB_
+                if (BrushOrigin)
+                {
+                    AdjustedBrushOrigin.x = BrushOrigin->x + CombinedRect.left 
- OutputRect.left;
+                    AdjustedBrushOrigin.y = BrushOrigin->y + CombinedRect.top 
- OutputRect.top;
+                }
+#endif
                 Pt.x = InputPoint.x + CombinedRect.left - OutputRect.left;
                 Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top;
                 Ret = (*BltRectFunc)(OutputObj, InputObj, Mask, 
ColorTranslation,
@@ -511,6 +518,13 @@
                     ClipRect.bottom = RectEnum.arcl[i].bottom;
                     if (RECTL_bIntersectRect(&CombinedRect, &OutputRect, 
&ClipRect))
                     {
+#ifdef _USE_DIBLIB_
+                        if (BrushOrigin)
+                        {
+                            AdjustedBrushOrigin.x = BrushOrigin->x + 
CombinedRect.left - OutputRect.left;
+                            AdjustedBrushOrigin.y = BrushOrigin->y + 
CombinedRect.top - OutputRect.top;
+                        }
+#endif
                         Pt.x = InputPoint.x + CombinedRect.left - 
OutputRect.left;
                         Pt.y = InputPoint.y + CombinedRect.top - 
OutputRect.top;
                         Ret = (*BltRectFunc)(OutputObj, InputObj, Mask,
@@ -546,6 +560,7 @@
     BOOL bResult;
     RECTL rclClipped;
     RECTL rclSrc;
+    POINTL ptlBrush;
     PFN_DrvBitBlt pfnBitBlt;
 
     ASSERT(psoTrg);
@@ -589,6 +604,16 @@
     {
         psoSrc = NULL;
         psurfSrc = NULL;
+    }
+
+    if (pptlBrush)
+    {
+#ifdef _USE_DIBLIB_
+        ptlBrush.x = pptlBrush->x + rclClipped.left - prclTrg->left;
+        ptlBrush.y = pptlBrush->y + rclClipped.top - prclTrg->top;
+#else
+        ptlBrush = *pptlBrush;
+#endif
     }
 
     /* Is the target surface device managed? */
@@ -623,7 +648,7 @@
                         (POINTL*)&rclSrc,
                         pptlMask,
                         pbo,
-                        pptlBrush,
+                        pptlBrush ? &ptlBrush : NULL,
                         Rop4);
 
     // FIXME: cleanup temp surface!

Modified: trunk/reactos/win32ss/gdi/ntgdi/bitblt.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/bitblt.c?rev=56392&r1=56391&r2=56392&view=diff
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/bitblt.c [iso-8859-1] Mon Apr 23 10:12:35 
2012
@@ -778,9 +778,13 @@
     DestRect.top    += pdc->ptlDCOrig.y;
     DestRect.right  += pdc->ptlDCOrig.x;
     DestRect.bottom += pdc->ptlDCOrig.y;
-
+#ifdef _USE_DIBLIB_
+    BrushOrigin.x = pbrush->ptOrigin.x + pdc->ptlDCOrig.x + XLeft;
+    BrushOrigin.y = pbrush->ptOrigin.y + pdc->ptlDCOrig.y + YLeft;
+#else
     BrushOrigin.x = pbrush->ptOrigin.x + pdc->ptlDCOrig.x;
     BrushOrigin.y = pbrush->ptOrigin.y + pdc->ptlDCOrig.y;
+#endif
 
     DC_vPrepareDCsForBlit(pdc, DestRect, NULL, DestRect);
 
@@ -881,6 +885,8 @@
         return NtGdiMaskBlt(hDC, XLeft, YLeft, Width, Height, 
0,0,0,0,0,0,ROP,0);
     }
 
+if ((XLeft == 0) && (YLeft == 0) && (Width == 592) && (Height == 362)) 
__debugbreak();
+
     dc = DC_LockDc(hDC);
     if (dc == NULL)
     {


Reply via email to