diff --git "a/win32ss/gdi/eng/gradient.c" "b/win32ss/gdi/eng/gradient.c" index 3fb80c19e35..de19191f91a 100644 --- "a/win32ss/gdi/eng/gradient.c" +++ "b/win32ss/gdi/eng/gradient.c" @@ -18,9 +18,11 @@ const LONG LINC[2] = {-1, 1}; #define VERTEX(n) (pVertex + gt->n) #define COMPAREVERTEX(a, b) ((a)->x == (b)->x && (a)->y == (b)->y) +/* Check if all three vectors are the same color, either R, G, or B */ #define VCMPCLR(a,b,c,color) (a->color != b->color || a->color != c->color) +/* Check if all three vectors have the same colors for R, G, and B */ #define VCMPCLRS(a,b,c) \ - !(!VCMPCLR(a,b,c,Red) || !VCMPCLR(a,b,c,Green) || !VCMPCLR(a,b,c,Blue)) + !(!VCMPCLR(a,b,c,Red) && !VCMPCLR(a,b,c,Green) && !VCMPCLR(a,b,c,Blue)) /* Horizontal/Vertical gradients */ #define HVINITCOL(Col, id) \ @@ -286,7 +288,7 @@ IntEngGradientFillRect( x[line] = a->x; \ sx[line] = a->x + pptlDitherOrg->x; \ dx[line] = abs(b->x - a->x); \ - dy[line] = max(abs(b->y - a->y),1); \ + dy[line] = abs(b->y - a->y); /* HACK: Removed here */ \ incx[line] = LINC[b->x > a->x]; \ ex[line] = -(dy[line]>>1); \ destx[line] = b->x @@ -332,6 +334,10 @@ IntEngGradientFillTriangle( 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; + static int warn_once; + + if (!warn_once++) + DPRINT1("FIXME: IntEngGradientFillTriangle is broken\n"); v1 = (pVertex + gTriangle->Vertex1); v2 = (pVertex + gTriangle->Vertex2); @@ -355,8 +361,6 @@ IntEngGradientFillTriangle( } DPRINT("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"); if (!IntEngEnter(&EnterLeave, psoDest, &FillRect, FALSE, &Translate, &psoOutput)) { @@ -389,16 +393,21 @@ IntEngGradientFillTriangle( GOLINE(v1, v3, 0); DOLINE(v1, v3, 0); ENDLINE(v1, v3, 0); - - GOLINE(v1, v2, 1); - DOLINE(v1, v2, 1); - FILLLINE(0, 1); - ENDLINE(v1, v2, 1); - - GOLINE(v2, v3, 2); - DOLINE(v2, v3, 2); - FILLLINE(0, 2); - ENDLINE(23, v3, 2); + if(v1->y != v2->y) // if y coordinates are not the same + { + GOLINE(v1, v2, 1); + DOLINE(v1, v2, 1); + FILLLINE(0, 1); + ENDLINE(v1, v2, 1); + } + + if(v2->y != v3->y) // if y coordinates are not the same + { + GOLINE(v2, v3, 2); + DOLINE(v2, v3, 2); + FILLLINE(0, 2); + ENDLINE(23, v3, 2); + } y++; sy++;