summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvImg.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-07-27 10:14:55 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-07-27 10:14:55 (GMT)
commit42f0b713dd28f3d56226621b9016969cd5804a57 (patch)
tree655fa3c3fc4e843ec5d197c996d7bad878324d30 /generic/tkCanvImg.c
parentf60c7ff513bcaaa89a54871e150893a286ba6701 (diff)
downloadtk-42f0b713dd28f3d56226621b9016969cd5804a57.zip
tk-42f0b713dd28f3d56226621b9016969cd5804a57.tar.gz
tk-42f0b713dd28f3d56226621b9016969cd5804a57.tar.bz2
Postscript generation now uses Tcl_Objs more extensively; still nasty in places.
Diffstat (limited to 'generic/tkCanvImg.c')
-rw-r--r--generic/tkCanvImg.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c
index 172f26d..899741a 100644
--- a/generic/tkCanvImg.c
+++ b/generic/tkCanvImg.c
@@ -695,14 +695,12 @@ ImageToPostscript(
{
ImageItem *imgPtr = (ImageItem *) itemPtr;
Tk_Window canvasWin = Tk_CanvasTkwin(canvas);
-
- char buffer[256];
double x, y;
int width, height;
Tk_Image image;
Tk_State state = itemPtr->state;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = Canvas(canvas)->canvas_state;
}
@@ -746,8 +744,14 @@ ImageToPostscript(
}
if (!prepass) {
- sprintf(buffer, "%.15g %.15g", x, y);
- Tcl_AppendResult(interp, buffer, " translate\n", NULL);
+ Tcl_Obj *psObj = Tcl_GetObjResult(interp);
+
+ if (Tcl_IsShared(psObj)) {
+ psObj = Tcl_DuplicateObj(psObj);
+ Tcl_SetObjResult(interp, psObj);
+ }
+
+ Tcl_AppendPrintfToObj(psObj, "%.15g %.15g translate\n", x, y);
}
return Tk_PostscriptImage(image, interp, canvasWin,