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