mirror of
https://github.com/reactos/reactos.git
synced 2024-07-08 21:55:08 +00:00
Cleanup coding of IntGdiPolyPolygon and IntGdiPolygon.
svn path=/trunk/; revision=22262
This commit is contained in:
parent
fb9a28f2b5
commit
c537a6efb8
|
@ -94,7 +94,7 @@ IntGdiPolygon(PDC dc,
|
||||||
if (FillBrushObj && !(FillBrushObj->flAttrs & GDIBRUSH_IS_NULL))
|
if (FillBrushObj && !(FillBrushObj->flAttrs & GDIBRUSH_IS_NULL))
|
||||||
{
|
{
|
||||||
IntGdiInitBrushInstance(&FillBrushInst, FillBrushObj, dc->XlateBrush);
|
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);
|
BRUSHOBJ_UnlockBrush(FillBrushObj);
|
||||||
|
|
||||||
|
@ -104,35 +104,29 @@ IntGdiPolygon(PDC dc,
|
||||||
if (PenBrushObj && !(PenBrushObj->flAttrs & GDIBRUSH_IS_NULL))
|
if (PenBrushObj && !(PenBrushObj->flAttrs & GDIBRUSH_IS_NULL))
|
||||||
{
|
{
|
||||||
IntGdiInitBrushInstance(&PenBrushInst, PenBrushObj, dc->XlatePen);
|
IntGdiInitBrushInstance(&PenBrushInst, PenBrushObj, dc->XlatePen);
|
||||||
for ( CurrentPoint = 0; CurrentPoint < Count; ++CurrentPoint )
|
|
||||||
{
|
|
||||||
POINT To, From; //, Next;
|
|
||||||
|
|
||||||
/* Let CurrentPoint be i
|
while(Count-- >1)
|
||||||
* 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];
|
|
||||||
|
|
||||||
//DPRINT("Polygon Making line from (%d,%d) to (%d,%d)\n", From.x, From.y, To.x, To.y );
|
// DPRINT1("Polygon Making line from (%d,%d) to (%d,%d)\n",
|
||||||
ret = IntEngLineTo(&BitmapObj->SurfObj,
|
// UnsafePoints[0].x, UnsafePoints[0].y,
|
||||||
|
// UnsafePoints[1].x, UnsafePoints[1].y );
|
||||||
|
|
||||||
|
ret = IntEngLineTo(&BitmapObj->SurfObj,
|
||||||
dc->CombinedClip,
|
dc->CombinedClip,
|
||||||
&PenBrushInst.BrushObject,
|
&PenBrushInst.BrushObject,
|
||||||
From.x,
|
UnsafePoints[0].x, /* From */
|
||||||
From.y,
|
UnsafePoints[0].y,
|
||||||
To.x,
|
UnsafePoints[1].x, /* To */
|
||||||
To.y,
|
UnsafePoints[1].y,
|
||||||
&DestRect,
|
&DestRect,
|
||||||
ROP2_TO_MIX(dc->w.ROPmode)); /* MIX */
|
ROP2_TO_MIX(dc->w.ROPmode)); /* MIX */
|
||||||
|
if(!ret) break;
|
||||||
|
UnsafePoints++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PENOBJ_UnlockPen(PenBrushObj);
|
PENOBJ_UnlockPen(PenBrushObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
BITMAPOBJ_UnlockBitmap(BitmapObj);
|
BITMAPOBJ_UnlockBitmap(BitmapObj);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -144,25 +138,12 @@ IntGdiPolyPolygon(DC *dc,
|
||||||
LPINT PolyCounts,
|
LPINT PolyCounts,
|
||||||
int Count)
|
int Count)
|
||||||
{
|
{
|
||||||
int i;
|
while(--Count >=0)
|
||||||
LPPOINT pt;
|
|
||||||
LPINT pc;
|
|
||||||
BOOL ret = FALSE; // default to failure
|
|
||||||
|
|
||||||
pt = Points;
|
|
||||||
pc = PolyCounts;
|
|
||||||
|
|
||||||
for (i=0;i<Count;i++)
|
|
||||||
{
|
{
|
||||||
ret = IntGdiPolygon ( dc, pt, *pc );
|
if(!IntGdiPolygon ( dc, Points, *PolyCounts )) return FALSE;
|
||||||
if (ret == FALSE)
|
Points+=*PolyCounts++;
|
||||||
{
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
pt+=*pc++;
|
|
||||||
}
|
}
|
||||||
|
return TRUE;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
Loading…
Reference in a new issue