Index: win32ss/gdi/eng/copybits.c
===================================================================
--- win32ss/gdi/eng/copybits.c	(revision 75304)
+++ win32ss/gdi/eng/copybits.c	(working copy)
@@ -171,6 +171,7 @@
     }
 
 cleanup:
+    if (!ret) {DPRINT1("EngCopyBits: return FALSE\n");}
     return ret;
 }
 
Index: win32ss/gdi/eng/gradient.c
===================================================================
--- win32ss/gdi/eng/gradient.c	(revision 75304)
+++ win32ss/gdi/eng/gradient.c	(working copy)
@@ -226,7 +226,7 @@
 #define STEPCOL(a,b,line,col,id) \
   ec[line][id] += dc[line][id]; \
   while(ec[line][id] > 0) \
-  { \
+  { DPRINT1("STEPCOL ec %d dy %d\n",ec[line][id],dy[line] ); \
     c[line][id] += ic[line][id]; \
     ec[line][id] -= dy[line]; \
   }
@@ -264,12 +264,16 @@
   }
 
 #define DOLINE(a,b,line) \
+  DPRINT1("DOLINE 1\n"); \
   STEPCOL(a, b, line, Red, 0); \
+  DPRINT1("DOLINE 2\n"); \
   STEPCOL(a, b, line, Green, 1); \
+  DPRINT1("DOLINE 3\n"); \
   STEPCOL(a, b, line, Blue, 2); \
+  DPRINT1("DOLINE 4\n"); \
   ex[line] += dx[line]; \
   while(ex[line] > 0 && x[line] != destx[line]) \
-  { \
+  { DPRINT1("DOLINE 5 loop\n"); \
     x[line] += incx[line]; \
     sx[line] += incx[line]; \
     ex[line] -= dy[line]; \
@@ -319,19 +323,19 @@
 {
     SURFOBJ *psoOutput;
     PTRIVERTEX v1, v2, v3;
-    //RECT_ENUM RectEnum;
-    //BOOL EnumMore;
-    //ULONG i;
+    RECT_ENUM RectEnum;
+    BOOL EnumMore;
+    ULONG i;
     POINTL Translate;
     INTENG_ENTER_LEAVE EnterLeave;
     RECTL FillRect = { 0, 0, 0, 0 };
-    //ULONG Color;
+    ULONG Color, Count;
 
-    //BOOL sx[NLINES];
-    //LONG x[NLINES], dx[NLINES], dy[NLINES], incx[NLINES], ex[NLINES], destx[NLINES];
-    //LONG c[NLINES][3], dc[NLINES][3], ec[NLINES][3], ic[NLINES][3]; /* colors on lines */
-    //LONG g, gx, gxi, gc[3], gd[3], ge[3], gi[3]; /* colors in triangle */
-    //LONG sy, y, bt;
+    BOOL sx[NLINES];
+    LONG x[NLINES], dx[NLINES], dy[NLINES], incx[NLINES], ex[NLINES], destx[NLINES];
+    LONG c[NLINES][3], dc[NLINES][3], ec[NLINES][3], ic[NLINES][3]; /* colors on lines */
+    LONG g, gx, gxi, gc[3], gd[3], ge[3], gi[3]; /* colors in triangle */
+    LONG sy, y, bt;
 
     v1 = (pVertex + gTriangle->Vertex1);
     v2 = (pVertex + gTriangle->Vertex2);
@@ -354,9 +358,9 @@
         }
     }
 
-    DPRINT("Triangle: (%i,%i) (%i,%i) (%i,%i)\n", v1->x, v1->y, v2->x, v2->y, v3->x, v3->y);
+    DPRINT1("Triangle: (%i,%i) (%i,%i) (%i,%i)\n", v1->x, v1->y, v2->x, v2->y, v3->x, v3->y);
     /* FIXME: commented out because of an endless loop - fix triangles first */
-    DPRINT("FIXME: IntEngGradientFillTriangle is broken\n");
+    DPRINT1("FIXME: IntEngGradientFillTriangle is broken\n");
 
     if (!IntEngEnter(&EnterLeave, psoDest, &FillRect, FALSE, &Translate, &psoOutput))
     {
@@ -363,95 +367,102 @@
         return FALSE;
     }
 
-    //if (VCMPCLRS(v1, v2, v3))
-    //{
-    //  CLIPOBJ_cEnumStart(pco, FALSE, CT_RECTANGLES, CD_RIGHTDOWN, 0);
-    //  do
-    //  {
-    //    EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
-    //    for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= prclExtents->bottom; i++)
-    //    {
-    //      if (RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], prclExtents))
-    //      {
-    //        BOOL InY;
+    if (VCMPCLRS(v1, v2, v3))
+    {
+      Count = CLIPOBJ_cEnumStart(pco, FALSE, CT_RECTANGLES, CD_RIGHTDOWN, 0);
+      DPRINT1("IntEngGradientFillTriangle loop 1 Count %d\n",Count);
+      do
+      {
+        EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
+        DPRINT1("IntEngGradientFillTriangle in loop 1 EnumMore %d\n",EnumMore);
+        for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= prclExtents->bottom; i++)
+        {
+          if (RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], prclExtents))
+          {
+            BOOL InY;
 
-    //        DOINIT(v1, v3, 0);
-    //        DOINIT(v1, v2, 1);
-    //        DOINIT(v2, v3, 2);
+            DOINIT(v1, v3, 0);
+            DOINIT(v1, v2, 1);
+            DOINIT(v2, v3, 2);
 
-    //        y = v1->y;
-    //        sy = v1->y + pptlDitherOrg->y;
-    //        bt = min(v3->y + pptlDitherOrg->y, FillRect.bottom);
+            y = v1->y;
+            sy = v1->y + pptlDitherOrg->y;
+            bt = min(v3->y + pptlDitherOrg->y, FillRect.bottom);
+            DPRINT1("IntEngGradientFillTriangle in loop 1a y %d sy %d bt %d\n",y,sy,bt);
+            while (sy < bt)
+            {
+              InY = !(sy < FillRect.top || sy >= FillRect.bottom);
+              GOLINE(v1, v3, 0);
+              DOLINE(v1, v3, 0);
+              ENDLINE(v1, v3, 0);
+              DPRINT1("IntEngGradientFillTriangle in loop 1a 1\n");
+              GOLINE(v1, v2, 1);
+              DPRINT1("IntEngGradientFillTriangle in loop 1a 1a\n");
+              DOLINE(v1, v2, 1);
+              DPRINT1("IntEngGradientFillTriangle in loop 1a 1b\n");
+              FILLLINE(0, 1);
+              DPRINT1("IntEngGradientFillTriangle in loop 1a 1c\n");
+              ENDLINE(v1, v2, 1);
+              DPRINT1("IntEngGradientFillTriangle in loop 1a 2\n");
+              GOLINE(v2, v3, 2);
+              DOLINE(v2, v3, 2);
+              FILLLINE(0, 2);
+              ENDLINE(23, v3, 2);
+              DPRINT1("IntEngGradientFillTriangle in loop 1b y %d sy %d bt %d\n",y,sy,bt);
+              y++;
+              sy++;
+            }
+          }
+        }
+      } while (EnumMore);
 
-    //        while (sy < bt)
-    //        {
-    //          InY = !(sy < FillRect.top || sy >= FillRect.bottom);
-    //          GOLINE(v1, v3, 0);
-    //          DOLINE(v1, v3, 0);
-    //          ENDLINE(v1, v3, 0);
+      return IntEngLeave(&EnterLeave);
+    }
 
-    //          GOLINE(v1, v2, 1);
-    //          DOLINE(v1, v2, 1);
-    //          FILLLINE(0, 1);
-    //          ENDLINE(v1, v2, 1);
+    /* fill triangle with one solid color */
 
-    //          GOLINE(v2, v3, 2);
-    //          DOLINE(v2, v3, 2);
-    //          FILLLINE(0, 2);
-    //          ENDLINE(23, v3, 2);
+    Color = XLATEOBJ_iXlate(pxlo, RGB(v1->Red >> 8, v1->Green >> 8, v1->Blue >> 8));
+    Count = CLIPOBJ_cEnumStart(pco, FALSE, CT_RECTANGLES, CD_RIGHTDOWN, 0);
+    DPRINT1("IntEngGradientFillTriangle loop 2 Count %d\n",Count);
+    do
+    {
+      EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
+      DPRINT1("IntEngGradientFillTriangle in loop 2 EnumMore %d\n",EnumMore);
+      for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= prclExtents->bottom; i++)
+      {
+        if (RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], prclExtents))
+        {
+          S_INITLINE(v1, v3, 0);
+          S_INITLINE(v1, v2, 1);
+          S_INITLINE(v2, v3, 2);
 
-    //          y++;
-    //          sy++;
-    //        }
-    //      }
-    //    }
-    //  } while (EnumMore);
+          y = v1->y;
+          sy = v1->y + pptlDitherOrg->y;
+          bt = min(v3->y + pptlDitherOrg->y, FillRect.bottom);
 
-    //  return IntEngLeave(&EnterLeave);
-    //}
+          while (sy < bt)
+          {
+            S_GOLINE(v1, v3, 0);
+            S_DOLINE(v1, v3, 0);
+            S_ENDLINE(v1, v3, 0);
 
-    ///* fill triangle with one solid color */
+            S_GOLINE(v1, v2, 1);
+            S_DOLINE(v1, v2, 1);
+            S_FILLLINE(0, 1);
+            S_ENDLINE(v1, v2, 1);
 
-    //Color = XLATEOBJ_iXlate(pxlo, RGB(v1->Red >> 8, v1->Green >> 8, v1->Blue >> 8));
-    //CLIPOBJ_cEnumStart(pco, FALSE, CT_RECTANGLES, CD_RIGHTDOWN, 0);
-    //do
-    //{
-    //  EnumMore = CLIPOBJ_bEnum(pco, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
-    //  for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= prclExtents->bottom; i++)
-    //  {
-    //    if (RECTL_bIntersectRect(&FillRect, &RectEnum.arcl[i], prclExtents))
-    //    {
-    //      S_INITLINE(v1, v3, 0);
-    //      S_INITLINE(v1, v2, 1);
-    //      S_INITLINE(v2, v3, 2);
+            S_GOLINE(v2, v3, 2);
+            S_DOLINE(v2, v3, 2);
+            S_FILLLINE(0, 2);
+            S_ENDLINE(23, v3, 2);
 
-    //      y = v1->y;
-    //      sy = v1->y + pptlDitherOrg->y;
-    //      bt = min(v3->y + pptlDitherOrg->y, FillRect.bottom);
+            y++;
+            sy++;
+          }
+        }
+      }
+    } while (EnumMore);
 
-    //      while (sy < bt)
-    //      {
-    //        S_GOLINE(v1, v3, 0);
-    //        S_DOLINE(v1, v3, 0);
-    //        S_ENDLINE(v1, v3, 0);
-
-    //        S_GOLINE(v1, v2, 1);
-    //        S_DOLINE(v1, v2, 1);
-    //        S_FILLLINE(0, 1);
-    //        S_ENDLINE(v1, v2, 1);
-
-    //        S_GOLINE(v2, v3, 2);
-    //        S_DOLINE(v2, v3, 2);
-    //        S_FILLLINE(0, 2);
-    //        S_ENDLINE(23, v3, 2);
-
-    //        y++;
-    //        sy++;
-    //      }
-    //    }
-    //  }
-    //} while (EnumMore);
-
     return IntEngLeave(&EnterLeave);
 }
 
@@ -521,10 +532,12 @@
         case GRADIENT_FILL_TRIANGLE:
         {
             PGRADIENT_TRIANGLE gt = (PGRADIENT_TRIANGLE)pMesh;
+            DPRINT1("EngGradientFill : GRADIENT_FILL_TRIANGLE\n");
             for (i = 0; i < nMesh; i++, gt++)
             {
                 if (IntEngIsNULLTriangle(pVertex, gt))
                 {
+                    DPRINT1("EngGradientFill : GRADIENT_FILL_TRIANGLE skip\n");
                     /* skip empty triangles */
                     continue;
                 }
