diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-07-27 10:14:55 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-07-27 10:14:55 (GMT) |
commit | 8ac7075520cba7a288f1b8de2f56e927f92669dc (patch) | |
tree | 655fa3c3fc4e843ec5d197c996d7bad878324d30 /generic/tkCanvImg.c | |
parent | e596cf2b31afcaced77c803a1f404d81a2660918 (diff) | |
download | tk-8ac7075520cba7a288f1b8de2f56e927f92669dc.zip tk-8ac7075520cba7a288f1b8de2f56e927f92669dc.tar.gz tk-8ac7075520cba7a288f1b8de2f56e927f92669dc.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.c | 14 |
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, |