From 25178094e45777a41988b7414b0697456b393d58 Mon Sep 17 00:00:00 2001 From: "dcone%netscape.com" Date: Thu, 11 May 2000 03:58:58 +0000 Subject: [PATCH] Added some rasterization of polygons, moved some point definitions to correct locations. --- gfx/public/nsIRenderingContext.h | 6 + gfx/public/nsPoint.h | 6 +- gfx/public/nsRenderingContextImpl.h | 22 ++- gfx/src/nsRenderingContextImpl.cpp | 196 ++++++++++++++++++++-- gfx/src/shared/nsRenderingContextImpl.cpp | 196 ++++++++++++++++++++-- 5 files changed, 393 insertions(+), 33 deletions(-) diff --git a/gfx/public/nsIRenderingContext.h b/gfx/public/nsIRenderingContext.h index 7168897b2778..aed5c9688b45 100644 --- a/gfx/public/nsIRenderingContext.h +++ b/gfx/public/nsIRenderingContext.h @@ -379,6 +379,12 @@ public: */ NS_IMETHOD FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints) = 0; + /** + * Rasterize a polygon with the current fill color. + * @param aPoints points to use for the drawing, last must equal first + * @param aNumPonts number of points in the polygon + */ + NS_IMETHOD RasterPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)=0; /** * Fill a poly in the current foreground color, without transformation taking place diff --git a/gfx/public/nsPoint.h b/gfx/public/nsPoint.h index 98d13d5be8c1..32bd4bee2e8a 100644 --- a/gfx/public/nsPoint.h +++ b/gfx/public/nsPoint.h @@ -109,15 +109,15 @@ struct nsFloatPoint { * the curve.. or off of the curve for a path * @update 03/29/00 dwc */ -struct nsPathPoint: public nsPoint{ +struct nsPathPoint: public nsFloatPoint{ PRBool mIsOnCurve; // Constructors nsPathPoint() {} nsPathPoint(const nsPathPoint& aPoint) {x = aPoint.x; y = aPoint.y;mIsOnCurve=aPoint.mIsOnCurve;} - nsPathPoint(nscoord aX, nscoord aY) {x = aX; y = aY;mIsOnCurve=PR_TRUE;} - nsPathPoint(nscoord aX, nscoord aY,PRBool aIsOnCurve) {x = aX; y = aY;mIsOnCurve=aIsOnCurve;} + nsPathPoint(float aX, float aY) {x = aX; y = aY;mIsOnCurve=PR_TRUE;} + nsPathPoint(float aX, float aY,PRBool aIsOnCurve) {x = aX; y = aY;mIsOnCurve=aIsOnCurve;} }; diff --git a/gfx/public/nsRenderingContextImpl.h b/gfx/public/nsRenderingContextImpl.h index f7e6848e211e..9b7a9ec3c6ab 100644 --- a/gfx/public/nsRenderingContextImpl.h +++ b/gfx/public/nsRenderingContextImpl.h @@ -27,6 +27,13 @@ #include "nsPoint.h" +typedef struct { + double x; // x coordinate of edge's intersection with current scanline */ + double dx; // change in x with respect to y + int i; // edge number: edge i goes from mPointList[i] to mPointList[i+1] +} Edge; + + class nsRenderingContextImpl : public nsIRenderingContext { @@ -36,6 +43,8 @@ public: protected: nsTransform2D *mTranMatrix; // The rendering contexts transformation matrix + int mAct; // number of active edges + Edge *mActive; // active edge list:edges crossing scanline y public: nsRenderingContextImpl(); @@ -60,6 +69,14 @@ public: */ NS_IMETHOD FillPath(nsPathPoint aPointArray[],PRInt32 aNumPts); + /** + * Fill a poly in the current foreground color + * @param aPoints points to use for the drawing, last must equal first + * @param aNumPonts number of points in the polygon + */ + NS_IMETHOD RasterPolygon(const nsPoint aPoints[], PRInt32 aNumPoints); + + /** --------------------------------------------------- * See documentation in nsIRenderingContext.h * @update 05/01/00 dwc @@ -95,7 +112,8 @@ protected: */ void TileImage(nsDrawingSurface aDS,nsRect &aSrcRect,PRInt16 aWidth,PRInt16 aHeight); - + void cdelete(int i); + void cinsert(int i,int y,const nsPoint aPointArray[],PRInt32 aNumPts); public: @@ -118,7 +136,7 @@ public: void SetControls(nsFloatPoint &aAnc1,nsFloatPoint &aCon,nsFloatPoint &aAnc2) { mAnc1 = aAnc1; mCon = aCon; mAnc2 = aAnc2;} void SetPoints(nscoord a1x,nscoord a1y,nscoord acx,nscoord acy,nscoord a2x,nscoord a2y) {mAnc1.MoveTo(a1x,a1y),mCon.MoveTo(acx,acy),mAnc2.MoveTo(a2x,a2y);} void SetPoints(float a1x,float a1y,float acx,float acy,float a2x,float a2y) {mAnc1.MoveTo(a1x,a1y),mCon.MoveTo(acx,acy),mAnc2.MoveTo(a2x,a2y);} - + void DebugPrint(); /** --------------------------------------------------- * Divide a Quadratic curve into line segments if it is not smaller than a certain size * else it is so small that it can be approximated by 2 lineto calls diff --git a/gfx/src/nsRenderingContextImpl.cpp b/gfx/src/nsRenderingContextImpl.cpp index b21b16cd21ee..9705dc759de7 100644 --- a/gfx/src/nsRenderingContextImpl.cpp +++ b/gfx/src/nsRenderingContextImpl.cpp @@ -24,6 +24,14 @@ #include "nsIDeviceContext.h" #include "nsIImage.h" #include "nsTransform2D.h" +#include + + +const nsPoint *gPts; + +// comparison routines for qsort +int compare_ind(const void *u,const void *v){return gPts[(int)*((int*)u)].y <= gPts[(int)*((int*)v)].y ? -1 : 1;} +int compare_active(const void *u,const void *v){return ((Edge*)u)->x <= ((Edge*)v)->x ? -1 : 1;} /** --------------------------------------------------- @@ -209,7 +217,6 @@ nsPathIter::eSegType curveType; nsPoint thePath[MAXPATHSIZE]; PRInt16 curPoint=0; - // Transform the points first if (aNumPts > 20){ pp0 = new nsPathPoint[aNumPts]; @@ -246,6 +253,141 @@ PRInt16 curPoint=0; return NS_OK; } + +/** --------------------------------------------------- + * See documentation in nsRenderingContextImpl.h + * @update 3/29/00 dwc + */ +NS_IMETHODIMP +nsRenderingContextImpl::RasterPolygon(const nsPoint aPointArray[],PRInt32 aNumPts) +{ +int x,k,y0,y1,y,i,j,xl,xr; +int *ind; +nsPoint pts[20]; +nsPoint *pp,*pp0; +const nsPoint *np; +nsPoint thePath[MAXPATHSIZE]; + + + if (aNumPts<=0) + return NS_OK; + + // Transform the points first + if (aNumPts > 20){ + pp0 = new nsPoint[aNumPts]; + } else { + pp0 = &pts[0]; + } + pp = pp0; + np = &aPointArray[0]; + + for ( i= 0; i < aNumPts; i++,np++,pp++){ + pp->x = np->x; + pp->y = np->y; + mTranMatrix->TransformCoord((int*)&pp->x,(int*)&pp->y); + } + + ind = new PRInt32[aNumPts]; + mActive = new Edge[aNumPts]; + + gPts = pp0; + + // create y-sorted array of indices ind[k] into vertex list + for (k=0; k0 ? i-1 : aNumPts-1; + if (pp0[j].y <= y-.5) + cdelete(j); + else if (pp0[j].y > y+.5) + cinsert(j, y,pp0, aNumPts); + j = i y+.5) + cinsert(i, y,pp0, aNumPts); + } + + // sort active edge list by active[j].x + qsort(mActive, mAct, sizeof mActive[0], compare_active); + + // draw horizontal segments for scanline y + for (j=0; jSetPixel(x,y,aRed,aGreen,aBlue); + //} + } + mActive[j].x += mActive[j].dx; /* increment edge coords */ + mActive[j+1].x += mActive[j+1].dx; + } + } + + delete[] ind; + delete[] mActive; + + return NS_OK; +} + + + +/**------------------------------------------------------------------- + * remove edge i from active list + * @update dc 12/06/1999 + */ +void +nsRenderingContextImpl::cdelete(int i) +{ +int j; + + for (j=0; j=mAct) + return; + mAct--; + memcpy(&mActive[j], &mActive[j+1],(mAct-j)*sizeof mActive[0]); +} + +/**------------------------------------------------------------------- + * append edge i to end of active list + * @update dc 12/06/1999 + */ +void +nsRenderingContextImpl::cinsert(int i,int y,const nsPoint aPointArray[],PRInt32 aNumPts) +{ +int j; +double dx; +const nsPoint *p, *q; + + j = ix-(double)p->x)/((double)q->y-(double)p->y); + mActive[mAct].x = dx*(y+.5-(double)p->y)+(double)p->x; + mActive[mAct].i = i; + mAct++; +} + + + /** --------------------------------------------------- * See documentation in nsRenderingContextImpl.h * @update 3/29/00 dwc @@ -299,12 +441,32 @@ float fx,fy,smag; curve2.SubDivide(aRenderingContext); }else{ // draw the curve +#ifdef DEBUGCURVE + printf("LINE 1- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y), + NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y)); + printf("LINE 2- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y), + NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); +#endif aRenderingContext->DrawStdLine(NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y),NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y)); aRenderingContext->DrawStdLine(NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y),NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); } } +/** --------------------------------------------------- + * See documentation in nsRenderingContextImpl.h + * @update 3/29/00 dwc + */ +void +QBezierCurve::DebugPrint() +{ + printf("CURVE COORDINATES\n"); + printf("Anchor 1 %f %f\n",mAnc1.x,mAnc1.y); + printf("Control %f %f\n",mCon.x,mCon.y); + printf("Anchor %f %f\n",mAnc2.x,mAnc2.y); + +} + /** --------------------------------------------------- * See documentation in nsRenderingContextImpl.h * @update 3/29/00 dwc @@ -320,10 +482,8 @@ float fx,fy,smag; // for now to fix the build - //fx = (float) fabs(curve1.mAnc2.x - this->mCon.x); - //fy = (float) fabs(curve1.mAnc2.y - this->mCon.y); - fx = fy = 0; - + fx = (float) fabs(curve1.mAnc2.x - this->mCon.x); + fy = (float) fabs(curve1.mAnc2.y - this->mCon.y); //smag = fx+fy-(PR_MIN(fx,fy)>>1); smag = fx*fx + fy*fy; @@ -333,9 +493,17 @@ float fx,fy,smag; curve2.SubDivide(aThePoints,aNumPts); }else{ // draw the curve - aThePoints[(*aNumPts)++].MoveTo(NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y)); - aThePoints[(*aNumPts)++].MoveTo(NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y)); - aThePoints[(*aNumPts)++].MoveTo(NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); + aThePoints[(*aNumPts)++].MoveTo(NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y)); + aThePoints[(*aNumPts)++].MoveTo(NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y)); + aThePoints[(*aNumPts)++].MoveTo(NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); + +#ifdef DEBUGCURVE + printf("LINE 1- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y), + NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y)); + printf("LINE 2- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y), + NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); +#endif + } } @@ -431,7 +599,7 @@ float avx,avy,av1x,av1y; switch(code) { case 07: // 111 case 06: // 110 - TheSegment.SetPoints(pt1->x,pt1->y,0,0,pt2->x,pt2->y); + TheSegment.SetPoints(pt1->x,pt1->y,0.0,0.0,pt2->x,pt2->y); aCurveType = eLINE; mCurPoint++; break; @@ -443,18 +611,18 @@ float avx,avy,av1x,av1y; case 04: // 100 avx = (float)((pt2->x+pt3->x)/2.0); avy = (float)((pt2->y+pt3->y)/2.0); - TheSegment.SetPoints((float)pt1->x,(float)pt1->y,(float)pt2->x,(float)pt2->y,avx,avy); + TheSegment.SetPoints(pt1->x,pt1->y,pt2->x,pt2->y,avx,avy); aCurveType = eQCURVE; mCurPoint++; case 03: // 011 case 02: // 010 - TheSegment.SetPoints(pt1->x,pt1->y,0,0,pt2->x,pt2->y); + TheSegment.SetPoints(pt1->x,pt1->y,0.0,0.0,pt2->x,pt2->y); aCurveType = eLINE; mCurPoint++; case 01: // 001 avx = (float)((pt1->x+pt2->x)/2.0); avy = (float)((pt1->y+pt2->y)/2.0); - TheSegment.SetPoints(avx,avy,(float)pt2->x,(float)pt3->y,(float)pt2->x,(float)pt3->y); + TheSegment.SetPoints(avx,avy,pt2->x,pt3->y,pt2->x,pt3->y); aCurveType = eQCURVE; mCurPoint+=2; case 00: // 000 @@ -462,13 +630,13 @@ float avx,avy,av1x,av1y; avy = (float)((pt1->y+pt2->y)/2.0); av1x = (float)((pt2->x+pt3->x)/2.0); av1y = (float)((pt2->y+pt3->y)/2.0); - TheSegment.SetPoints(avx,avy,(float)pt2->x,(float)pt2->y,av1x,av1y); + TheSegment.SetPoints(avx,avy,pt2->x,pt2->y,av1x,av1y); default: break; } } else { // have two points.. draw a line - TheSegment.SetPoints(pt1->x,pt1->y,0,0,pt2->x,pt2->y); + TheSegment.SetPoints(pt1->x,pt1->y,0.0,0.0,pt2->x,pt2->y); aCurveType = eLINE; mCurPoint++; } diff --git a/gfx/src/shared/nsRenderingContextImpl.cpp b/gfx/src/shared/nsRenderingContextImpl.cpp index b21b16cd21ee..9705dc759de7 100644 --- a/gfx/src/shared/nsRenderingContextImpl.cpp +++ b/gfx/src/shared/nsRenderingContextImpl.cpp @@ -24,6 +24,14 @@ #include "nsIDeviceContext.h" #include "nsIImage.h" #include "nsTransform2D.h" +#include + + +const nsPoint *gPts; + +// comparison routines for qsort +int compare_ind(const void *u,const void *v){return gPts[(int)*((int*)u)].y <= gPts[(int)*((int*)v)].y ? -1 : 1;} +int compare_active(const void *u,const void *v){return ((Edge*)u)->x <= ((Edge*)v)->x ? -1 : 1;} /** --------------------------------------------------- @@ -209,7 +217,6 @@ nsPathIter::eSegType curveType; nsPoint thePath[MAXPATHSIZE]; PRInt16 curPoint=0; - // Transform the points first if (aNumPts > 20){ pp0 = new nsPathPoint[aNumPts]; @@ -246,6 +253,141 @@ PRInt16 curPoint=0; return NS_OK; } + +/** --------------------------------------------------- + * See documentation in nsRenderingContextImpl.h + * @update 3/29/00 dwc + */ +NS_IMETHODIMP +nsRenderingContextImpl::RasterPolygon(const nsPoint aPointArray[],PRInt32 aNumPts) +{ +int x,k,y0,y1,y,i,j,xl,xr; +int *ind; +nsPoint pts[20]; +nsPoint *pp,*pp0; +const nsPoint *np; +nsPoint thePath[MAXPATHSIZE]; + + + if (aNumPts<=0) + return NS_OK; + + // Transform the points first + if (aNumPts > 20){ + pp0 = new nsPoint[aNumPts]; + } else { + pp0 = &pts[0]; + } + pp = pp0; + np = &aPointArray[0]; + + for ( i= 0; i < aNumPts; i++,np++,pp++){ + pp->x = np->x; + pp->y = np->y; + mTranMatrix->TransformCoord((int*)&pp->x,(int*)&pp->y); + } + + ind = new PRInt32[aNumPts]; + mActive = new Edge[aNumPts]; + + gPts = pp0; + + // create y-sorted array of indices ind[k] into vertex list + for (k=0; k0 ? i-1 : aNumPts-1; + if (pp0[j].y <= y-.5) + cdelete(j); + else if (pp0[j].y > y+.5) + cinsert(j, y,pp0, aNumPts); + j = i y+.5) + cinsert(i, y,pp0, aNumPts); + } + + // sort active edge list by active[j].x + qsort(mActive, mAct, sizeof mActive[0], compare_active); + + // draw horizontal segments for scanline y + for (j=0; jSetPixel(x,y,aRed,aGreen,aBlue); + //} + } + mActive[j].x += mActive[j].dx; /* increment edge coords */ + mActive[j+1].x += mActive[j+1].dx; + } + } + + delete[] ind; + delete[] mActive; + + return NS_OK; +} + + + +/**------------------------------------------------------------------- + * remove edge i from active list + * @update dc 12/06/1999 + */ +void +nsRenderingContextImpl::cdelete(int i) +{ +int j; + + for (j=0; j=mAct) + return; + mAct--; + memcpy(&mActive[j], &mActive[j+1],(mAct-j)*sizeof mActive[0]); +} + +/**------------------------------------------------------------------- + * append edge i to end of active list + * @update dc 12/06/1999 + */ +void +nsRenderingContextImpl::cinsert(int i,int y,const nsPoint aPointArray[],PRInt32 aNumPts) +{ +int j; +double dx; +const nsPoint *p, *q; + + j = ix-(double)p->x)/((double)q->y-(double)p->y); + mActive[mAct].x = dx*(y+.5-(double)p->y)+(double)p->x; + mActive[mAct].i = i; + mAct++; +} + + + /** --------------------------------------------------- * See documentation in nsRenderingContextImpl.h * @update 3/29/00 dwc @@ -299,12 +441,32 @@ float fx,fy,smag; curve2.SubDivide(aRenderingContext); }else{ // draw the curve +#ifdef DEBUGCURVE + printf("LINE 1- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y), + NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y)); + printf("LINE 2- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y), + NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); +#endif aRenderingContext->DrawStdLine(NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y),NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y)); aRenderingContext->DrawStdLine(NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y),NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); } } +/** --------------------------------------------------- + * See documentation in nsRenderingContextImpl.h + * @update 3/29/00 dwc + */ +void +QBezierCurve::DebugPrint() +{ + printf("CURVE COORDINATES\n"); + printf("Anchor 1 %f %f\n",mAnc1.x,mAnc1.y); + printf("Control %f %f\n",mCon.x,mCon.y); + printf("Anchor %f %f\n",mAnc2.x,mAnc2.y); + +} + /** --------------------------------------------------- * See documentation in nsRenderingContextImpl.h * @update 3/29/00 dwc @@ -320,10 +482,8 @@ float fx,fy,smag; // for now to fix the build - //fx = (float) fabs(curve1.mAnc2.x - this->mCon.x); - //fy = (float) fabs(curve1.mAnc2.y - this->mCon.y); - fx = fy = 0; - + fx = (float) fabs(curve1.mAnc2.x - this->mCon.x); + fy = (float) fabs(curve1.mAnc2.y - this->mCon.y); //smag = fx+fy-(PR_MIN(fx,fy)>>1); smag = fx*fx + fy*fy; @@ -333,9 +493,17 @@ float fx,fy,smag; curve2.SubDivide(aThePoints,aNumPts); }else{ // draw the curve - aThePoints[(*aNumPts)++].MoveTo(NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y)); - aThePoints[(*aNumPts)++].MoveTo(NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y)); - aThePoints[(*aNumPts)++].MoveTo(NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); + aThePoints[(*aNumPts)++].MoveTo(NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y)); + aThePoints[(*aNumPts)++].MoveTo(NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y)); + aThePoints[(*aNumPts)++].MoveTo(NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); + +#ifdef DEBUGCURVE + printf("LINE 1- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y), + NSToCoordRound(curve1.mAnc1.x),NSToCoordRound(curve1.mAnc1.y)); + printf("LINE 2- %d,%d %d,%d\n",NSToCoordRound(curve1.mAnc2.x),NSToCoordRound(curve1.mAnc2.y), + NSToCoordRound(curve2.mAnc2.x),NSToCoordRound(curve2.mAnc2.y)); +#endif + } } @@ -431,7 +599,7 @@ float avx,avy,av1x,av1y; switch(code) { case 07: // 111 case 06: // 110 - TheSegment.SetPoints(pt1->x,pt1->y,0,0,pt2->x,pt2->y); + TheSegment.SetPoints(pt1->x,pt1->y,0.0,0.0,pt2->x,pt2->y); aCurveType = eLINE; mCurPoint++; break; @@ -443,18 +611,18 @@ float avx,avy,av1x,av1y; case 04: // 100 avx = (float)((pt2->x+pt3->x)/2.0); avy = (float)((pt2->y+pt3->y)/2.0); - TheSegment.SetPoints((float)pt1->x,(float)pt1->y,(float)pt2->x,(float)pt2->y,avx,avy); + TheSegment.SetPoints(pt1->x,pt1->y,pt2->x,pt2->y,avx,avy); aCurveType = eQCURVE; mCurPoint++; case 03: // 011 case 02: // 010 - TheSegment.SetPoints(pt1->x,pt1->y,0,0,pt2->x,pt2->y); + TheSegment.SetPoints(pt1->x,pt1->y,0.0,0.0,pt2->x,pt2->y); aCurveType = eLINE; mCurPoint++; case 01: // 001 avx = (float)((pt1->x+pt2->x)/2.0); avy = (float)((pt1->y+pt2->y)/2.0); - TheSegment.SetPoints(avx,avy,(float)pt2->x,(float)pt3->y,(float)pt2->x,(float)pt3->y); + TheSegment.SetPoints(avx,avy,pt2->x,pt3->y,pt2->x,pt3->y); aCurveType = eQCURVE; mCurPoint+=2; case 00: // 000 @@ -462,13 +630,13 @@ float avx,avy,av1x,av1y; avy = (float)((pt1->y+pt2->y)/2.0); av1x = (float)((pt2->x+pt3->x)/2.0); av1y = (float)((pt2->y+pt3->y)/2.0); - TheSegment.SetPoints(avx,avy,(float)pt2->x,(float)pt2->y,av1x,av1y); + TheSegment.SetPoints(avx,avy,pt2->x,pt2->y,av1x,av1y); default: break; } } else { // have two points.. draw a line - TheSegment.SetPoints(pt1->x,pt1->y,0,0,pt2->x,pt2->y); + TheSegment.SetPoints(pt1->x,pt1->y,0.0,0.0,pt2->x,pt2->y); aCurveType = eLINE; mCurPoint++; }