From e93687e98f7a46c65307e4820355ada663131577 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 10 Feb 2018 09:00:09 +0000 Subject: Better debug output formatting (from Scott). --- generic/tkCanvas.c | 20 ++++++++++++++------ win/makefile.vc | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 331b7e3..609ed6e 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -2709,7 +2709,13 @@ DrawCanvas( for (iy = 0; iy < ximagePtr->height; ++ iy) { Tcl_AppendResult(interp, " {", NULL); for (ix = 0; ix < ximagePtr->bytes_per_line; ++ ix) { - sprintf(buffer," 0x%2.2x",ximagePtr->data[ximagePtr->bytes_per_line * iy + ix]&0xFF); + if (ix > 0) { + if (ix % 4 == 0) + Tcl_AppendResult(interp, "-", NULL); + else + Tcl_AppendResult(interp, " ", NULL); + } + sprintf(buffer,"%2.2x",ximagePtr->data[ximagePtr->bytes_per_line * iy + ix]&0xFF); Tcl_AppendResult(interp, buffer, NULL); } Tcl_AppendResult(interp, " }", NULL); @@ -2775,9 +2781,6 @@ DrawCanvas( #endif for(x = 0; x < blockPtr.width; ++x) { unsigned long pixel; -#ifdef DEBUG_DRAWCANVAS - Tcl_AppendResult(interp, " {", NULL); -#endif switch (ximagePtr->bits_per_pixel) { /* @@ -2827,8 +2830,13 @@ DrawCanvas( #ifdef DEBUG_DRAWCANVAS { int ix; - for (ix = 0; ix < 3; ++ix) - sprintf(buffer,"0x%2.2x",blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x + ix]&0xFF); Tcl_AppendResult(interp, " ", buffer, NULL); + if (x > 0) + Tcl_AppendResult(interp, "-", NULL); + for (ix = 0; ix < 4; ++ix) { + if (ix > 0) + Tcl_AppendResult(interp, " ", NULL); + sprintf(buffer,"%2.2x",blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x + ix]&0xFF); Tcl_AppendResult(interp, buffer, NULL); + } } #endif } diff --git a/win/makefile.vc b/win/makefile.vc index 4050663..744974e 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -305,7 +305,7 @@ PRJ_INCLUDES = -I"$(BITMAPDIR)" -I"$(XLIBDIR)" CONFIG_DEFS =-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 \ -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 \ -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 \ - -DSUPPORT_CONFIG_EMBEDDED \ + -DSUPPORT_CONFIG_EMBEDDED -DDEBUG_DRAWCANVAS \ !if $(HAVE_UXTHEME_H) -DHAVE_UXTHEME_H=1 \ !endif -- cgit v0.12