summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tkImgPhoto.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 0c783f1..fcb6d2f 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -3862,19 +3862,19 @@ ImgStringWrite(
greenOffset = blockPtr->offset[1] - blockPtr->offset[0];
blueOffset = blockPtr->offset[2] - blockPtr->offset[0];
- data = Tcl_NewListObj(blockPtr->height, NULL);
+ data = Tcl_NewObj();
if ((blockPtr->width > 0) && (blockPtr->height > 0)) {
int row, col;
for (row=0; row<blockPtr->height; row++) {
- Tcl_Obj *line = Tcl_NewListObj(blockPtr->width, NULL);
+ Tcl_Obj *line = Tcl_NewObj();
unsigned char *pixelPtr = blockPtr->pixelPtr + blockPtr->offset[0]
+ row * blockPtr->pitch;
for (col=0; col<blockPtr->width; col++) {
- Tcl_ListObjAppendElement(NULL, line, Tcl_ObjPrintf(
- "%s#%02x%02x%02x", col ? " " : "", *pixelPtr,
- pixelPtr[greenOffset], pixelPtr[blueOffset]));
+ Tcl_AppendPrintfToObj(line, "%s#%02x%02x%02x",
+ col ? " " : "", *pixelPtr,
+ pixelPtr[greenOffset], pixelPtr[blueOffset]);
pixelPtr += blockPtr->pixelSize;
}
Tcl_ListObjAppendElement(NULL, data, line);