summaryrefslogtreecommitdiffstats
path: root/generic/tkTrig.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-07-29 17:55:29 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-07-29 17:55:29 (GMT)
commit27b42b57118a651074b7f1fcc859fc4ae00090d0 (patch)
tree08f1a3f320a79a97a0575dbb2738fa3fde376755 /generic/tkTrig.c
parent77acd42d86b6416b8ee9420f6e9ff759f06c28ab (diff)
downloadtk-27b42b57118a651074b7f1fcc859fc4ae00090d0.zip
tk-27b42b57118a651074b7f1fcc859fc4ae00090d0.tar.gz
tk-27b42b57118a651074b7f1fcc859fc4ae00090d0.tar.bz2
Purged Tcl_AppendElement from all non-test code.
Diffstat (limited to 'generic/tkTrig.c')
-rw-r--r--generic/tkTrig.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/generic/tkTrig.c b/generic/tkTrig.c
index d999062..5f4d267 100644
--- a/generic/tkTrig.c
+++ b/generic/tkTrig.c
@@ -1376,6 +1376,7 @@ TkMakeBezierPostscript(
int numCoords = numPoints*2;
double control[8];
char buffer[200];
+ Tcl_Obj *psObj;
/*
* If the curve is a closed one then generate a special spline that spans
@@ -1394,7 +1395,9 @@ TkMakeBezierPostscript(
control[5] = 0.833*pointPtr[1] + 0.167*pointPtr[3];
control[6] = 0.5*pointPtr[0] + 0.5*pointPtr[2];
control[7] = 0.5*pointPtr[1] + 0.5*pointPtr[3];
- sprintf(buffer, "%.15g %.15g moveto\n%.15g %.15g %.15g %.15g %.15g %.15g curveto\n",
+ psObj = Tcl_ObjPrintf(
+ "%.15g %.15g moveto\n"
+ "%.15g %.15g %.15g %.15g %.15g %.15g curveto\n",
control[0], Tk_CanvasPsY(canvas, control[1]),
control[2], Tk_CanvasPsY(canvas, control[3]),
control[4], Tk_CanvasPsY(canvas, control[5]),
@@ -1403,10 +1406,9 @@ TkMakeBezierPostscript(
closed = 0;
control[6] = pointPtr[0];
control[7] = pointPtr[1];
- sprintf(buffer, "%.15g %.15g moveto\n",
+ psObj = Tcl_ObjPrintf("%.15g %.15g moveto\n",
control[6], Tk_CanvasPsY(canvas, control[7]));
}
- Tcl_AppendResult(interp, buffer, NULL);
/*
* Cycle through all the remaining points in the curve, generating a curve
@@ -1432,12 +1434,15 @@ TkMakeBezierPostscript(
control[4] = 0.333*control[6] + 0.667*pointPtr[0];
control[5] = 0.333*control[7] + 0.667*pointPtr[1];
- sprintf(buffer, "%.15g %.15g %.15g %.15g %.15g %.15g curveto\n",
+ Tcl_AppendPrintfToObj(psObj,
+ "%.15g %.15g %.15g %.15g %.15g %.15g curveto\n",
control[2], Tk_CanvasPsY(canvas, control[3]),
control[4], Tk_CanvasPsY(canvas, control[5]),
control[6], Tk_CanvasPsY(canvas, control[7]));
- Tcl_AppendResult(interp, buffer, NULL);
}
+
+ Tcl_AppendResult(interp, Tcl_GetString(psObj), NULL);
+ Tcl_DecrRefCount(psObj);
}
/*
@@ -1473,14 +1478,14 @@ TkMakeRawCurvePostscript(
int i;
double *segPtr;
char buffer[200];
+ Tcl_Obj *psObj;
/*
* Put the first point into the path.
*/
- sprintf(buffer, "%.15g %.15g moveto\n",
+ psObj = Tcl_ObjPrintf("%.15g %.15g moveto\n",
pointPtr[0], Tk_CanvasPsY(canvas, pointPtr[1]));
- Tcl_AppendResult(interp, buffer, NULL);
/*
* Loop through all the remaining points in the curve, generating a
@@ -1495,19 +1500,19 @@ TkMakeRawCurvePostscript(
* neighbouring knots, so this segment is just a straight line.
*/
- sprintf(buffer, "%.15g %.15g lineto\n",
+ Tcl_AppendPrintfToObj(psObj, "%.15g %.15g lineto\n",
segPtr[6], Tk_CanvasPsY(canvas, segPtr[7]));
} else {
/*
* This is a generic Bezier curve segment.
*/
- sprintf(buffer, "%.15g %.15g %.15g %.15g %.15g %.15g curveto\n",
+ Tcl_AppendPrintfToObj(psObj,
+ "%.15g %.15g %.15g %.15g %.15g %.15g curveto\n",
segPtr[2], Tk_CanvasPsY(canvas, segPtr[3]),
segPtr[4], Tk_CanvasPsY(canvas, segPtr[5]),
segPtr[6], Tk_CanvasPsY(canvas, segPtr[7]));
}
- Tcl_AppendResult(interp, buffer, NULL);
}
/*
@@ -1532,20 +1537,23 @@ TkMakeRawCurvePostscript(
* Straight line.
*/
- sprintf(buffer, "%.15g %.15g lineto\n",
+ Tcl_AppendPrintfToObj(psObj, "%.15g %.15g lineto\n",
control[6], Tk_CanvasPsY(canvas, control[7]));
} else {
/*
* Bezier curve segment.
*/
- sprintf(buffer, "%.15g %.15g %.15g %.15g %.15g %.15g curveto\n",
+ Tcl_AppendPrintfToObj(psObj,
+ "%.15g %.15g %.15g %.15g %.15g %.15g curveto\n",
control[2], Tk_CanvasPsY(canvas, control[3]),
control[4], Tk_CanvasPsY(canvas, control[5]),
control[6], Tk_CanvasPsY(canvas, control[7]));
}
- Tcl_AppendResult(interp, buffer, NULL);
}
+
+ Tcl_AppendResult(interp, Tcl_GetString(psObj), NULL);
+ Tcl_DecrRefCount(psObj);
}
/*