From c537a6efb826c9848832a9fc5e68e1856c60309d Mon Sep 17 00:00:00 2001 From: James Tabor Date: Wed, 7 Jun 2006 01:28:44 +0000 Subject: [PATCH] Cleanup coding of IntGdiPolyPolygon and IntGdiPolygon. svn path=/trunk/; revision=22262 --- .../win32/win32k/objects/fillshap.c | 55 ++++++------------- 1 file changed, 18 insertions(+), 37 deletions(-) diff --git a/reactos/subsystems/win32/win32k/objects/fillshap.c b/reactos/subsystems/win32/win32k/objects/fillshap.c index a5e995594cf..f98d1005500 100644 --- a/reactos/subsystems/win32/win32k/objects/fillshap.c +++ b/reactos/subsystems/win32/win32k/objects/fillshap.c @@ -94,7 +94,7 @@ IntGdiPolygon(PDC dc, if (FillBrushObj && !(FillBrushObj->flAttrs & GDIBRUSH_IS_NULL)) { IntGdiInitBrushInstance(&FillBrushInst, FillBrushObj, dc->XlateBrush); - ret = FillPolygon ( dc, BitmapObj, &FillBrushInst.BrushObject, ROP2_TO_MIX(dc->w.ROPmode), UnsafePoints, Count, DestRect ); + ret = FillPolygon ( dc, BitmapObj, &FillBrushInst.BrushObject, ROP2_TO_MIX(dc->w.ROPmode), UnsafePoints, Count, DestRect ); } BRUSHOBJ_UnlockBrush(FillBrushObj); @@ -104,35 +104,29 @@ IntGdiPolygon(PDC dc, if (PenBrushObj && !(PenBrushObj->flAttrs & GDIBRUSH_IS_NULL)) { IntGdiInitBrushInstance(&PenBrushInst, PenBrushObj, dc->XlatePen); - for ( CurrentPoint = 0; CurrentPoint < Count; ++CurrentPoint ) - { - POINT To, From; //, Next; - /* Let CurrentPoint be i - * if i+1 > Count, Draw a line from Points[i] to Points[0] - * Draw a line from Points[i] to Points[i+1] - */ - From = UnsafePoints[CurrentPoint]; - if (Count <= CurrentPoint + 1) - To = UnsafePoints[0]; - else - To = UnsafePoints[CurrentPoint + 1]; + while(Count-- >1) + { - //DPRINT("Polygon Making line from (%d,%d) to (%d,%d)\n", From.x, From.y, To.x, To.y ); - ret = IntEngLineTo(&BitmapObj->SurfObj, +// DPRINT1("Polygon Making line from (%d,%d) to (%d,%d)\n", +// UnsafePoints[0].x, UnsafePoints[0].y, +// UnsafePoints[1].x, UnsafePoints[1].y ); + + ret = IntEngLineTo(&BitmapObj->SurfObj, dc->CombinedClip, &PenBrushInst.BrushObject, - From.x, - From.y, - To.x, - To.y, + UnsafePoints[0].x, /* From */ + UnsafePoints[0].y, + UnsafePoints[1].x, /* To */ + UnsafePoints[1].y, &DestRect, ROP2_TO_MIX(dc->w.ROPmode)); /* MIX */ + if(!ret) break; + UnsafePoints++; } } PENOBJ_UnlockPen(PenBrushObj); } - BITMAPOBJ_UnlockBitmap(BitmapObj); return ret; @@ -144,25 +138,12 @@ IntGdiPolyPolygon(DC *dc, LPINT PolyCounts, int Count) { - int i; - LPPOINT pt; - LPINT pc; - BOOL ret = FALSE; // default to failure - - pt = Points; - pc = PolyCounts; - - for (i=0;i=0) { - ret = IntGdiPolygon ( dc, pt, *pc ); - if (ret == FALSE) - { - return ret; - } - pt+=*pc++; + if(!IntGdiPolygon ( dc, Points, *PolyCounts )) return FALSE; + Points+=*PolyCounts++; } - - return ret; + return TRUE; } /******************************************************************************/