[ros-diffs] [fireball] 45594: - Calculate correct bounding rectangle and pass it to GrePolygon. Fixes non-filled polygon bug (because GrepFillPolygon relies on a correct bounding rect), issue #31 in the Arwinss wiki. - Pass bounding rect to GrepFillPolygon by pointer instead of by value. - Update line brush in GrePolyline.

fireball at svn.reactos.org fireball at svn.reactos.org
Sun Feb 14 21:45:32 CET 2010


Author: fireball
Date: Sun Feb 14 21:45:31 2010
New Revision: 45594

URL: http://svn.reactos.org/svn/reactos?rev=45594&view=rev
Log:
- Calculate correct bounding rectangle and pass it to GrePolygon. Fixes non-filled polygon bug (because GrepFillPolygon relies on a correct bounding rect), issue #31 in the Arwinss wiki.
- Pass bounding rect to GrepFillPolygon by pointer instead of by value.
- Update line brush in GrePolyline.

Modified:
    branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c
    branches/arwinss/reactos/subsystems/win32/win32k/gre/lineto.c
    branches/arwinss/reactos/subsystems/win32/win32k/gre/polyfill.c
    branches/arwinss/reactos/subsystems/win32/win32k/gre/rect.c
    branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h

Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c?rev=45594&r1=45593&r2=45594&view=diff
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c [iso-8859-1] Sun Feb 14 21:45:31 2010
@@ -151,6 +151,7 @@
     NTSTATUS Status = STATUS_SUCCESS;
     POINT pStackBuf[16];
     POINT *pPoints = pStackBuf;
+    RECTL rcBound;
     ULONG i;
 
     /* Get a pointer to the DC */
@@ -186,15 +187,28 @@
         return FALSE;
     }
 
-    /* Offset points data */
-    for (i=0; i<count; i++)
+    /* Calculate bounding rect and offset points data */
+    pPoints[0].x += pDC->rcDcRect.left + pDC->rcVport.left;
+    pPoints[0].y += pDC->rcDcRect.top + pDC->rcVport.top;
+
+    rcBound.left   = pPoints[0].x;
+    rcBound.right  = pPoints[0].x;
+    rcBound.top    = pPoints[0].y;
+    rcBound.bottom = pPoints[0].y;
+
+    for (i=1; i<count; i++)
     {
         pPoints[i].x += pDC->rcDcRect.left + pDC->rcVport.left;
         pPoints[i].y += pDC->rcDcRect.top + pDC->rcVport.top;
+
+        rcBound.left   = min(rcBound.left, pPoints[i].x);
+        rcBound.right  = max(rcBound.right, pPoints[i].x);
+        rcBound.top    = min(rcBound.top, pPoints[i].y);
+        rcBound.bottom = max(rcBound.bottom, pPoints[i].y);
     }
 
     /* Draw the polygon */
-    GrePolygon(pDC, pPoints, count);
+    GrePolygon(pDC, pPoints, count, &rcBound);
 
     /* Release the object */
     DC_Unlock(pDC);

Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/lineto.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/gre/lineto.c?rev=45594&r1=45593&r2=45594&view=diff
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gre/lineto.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gre/lineto.c [iso-8859-1] Sun Feb 14 21:45:31 2010
@@ -112,6 +112,7 @@
     /* Draw pen-based polygon */
     if (!(pDC->pLineBrush->flAttrs & GDIBRUSH_IS_NULL))
     {
+        GreUpdateBrush(pDC->pLineBrush, pDC);
         Mix = ROP2_TO_MIX(R2_COPYPEN);/*pdcattr->jROP2*/
         for (i=0; i<count-1; i++)
         {

Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/polyfill.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/gre/polyfill.c?rev=45594&r1=45593&r2=45594&view=diff
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gre/polyfill.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gre/polyfill.c [iso-8859-1] Sun Feb 14 21:45:31 2010
@@ -605,7 +605,7 @@
     BRUSHOBJ *BrushObj,
     CONST POINT *Points,
     int Count,
-    RECTL DestRect, 
+    CONST PRECTL DestRect,
     POINTL *BrushOrigin)
 {
     FILL_EDGE_LIST *list = 0;
@@ -622,7 +622,7 @@
         return FALSE;
 
     /* For each Scanline from DestRect.top to DestRect.bottom, determine line segments to draw */
-    for ( ScanLine = DestRect.top; ScanLine < DestRect.bottom; ++ScanLine )
+    for ( ScanLine = DestRect->top; ScanLine < DestRect->bottom; ++ScanLine )
     {
         POLYGONFILL_BuildActiveList(ScanLine, list, &ActiveHead);
         //DEBUG_PRINT_ACTIVE_EDGELIST(ActiveHead);

Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/rect.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/gre/rect.c?rev=45594&r1=45593&r2=45594&view=diff
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gre/rect.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gre/rect.c [iso-8859-1] Sun Feb 14 21:45:31 2010
@@ -98,19 +98,13 @@
 NTAPI
 GrePolygon(PDC pDC,
            const POINT *ptPoints,
-           INT count)
+           INT count,
+           PRECTL DestRect)
 {
     BOOLEAN bRet;
-    RECTL DestRect;
     MIX Mix;
     INT i;
     POINT BrushOrigin;
-
-    // HACK
-    DestRect.left = 0;
-    DestRect.top = 0;
-    DestRect.bottom = PrimarySurface.GDIInfo.ulVertRes;
-    DestRect.right = PrimarySurface.GDIInfo.ulHorzRes;
 
     BrushOrigin.x = pDC->ptBrushOrg.x + pDC->rcDcRect.left;
     BrushOrigin.y = pDC->ptBrushOrg.y + pDC->rcDcRect.top;
@@ -145,7 +139,7 @@
                              ptPoints[i].y,
                              ptPoints[i+1].x,
                              ptPoints[i+1].y,
-                             &DestRect, // Bounding rectangle
+                             DestRect,
                              Mix);
         }
     }

Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h?rev=45594&r1=45593&r2=45594&view=diff
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h [iso-8859-1] Sun Feb 14 21:45:31 2010
@@ -189,7 +189,7 @@
     BRUSHOBJ *BrushObj,
     CONST POINT *Points,
     int Count,
-    RECTL DestRect,
+    PRECTL DestRect,
     POINTL *BrushOrigin);
 
 /* rect.c */
@@ -203,7 +203,8 @@
 VOID NTAPI
 GrePolygon(PDC pDC,
            const POINT *ptPoints,
-           INT count);
+           INT count,
+           PRECTL pDestRect);
 
 VOID NTAPI
 GrePolyline(PDC pDC,




More information about the Ros-diffs mailing list