Tk Source Code

Check-in [11814b12]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Better debug output formatting (from Scott).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | canvas_image | tip-489
Files: files | file ages | folders
SHA3-256: 11814b12542f2b2e3e62595a73df8994a43edfae485314f73ac4ecec4616d100
User & Date: fvogel 2018-02-10 09:00:09
Context
2018-02-10
09:14
Remove -DDEBUG_DRAWCANVAS debug flag from makefile.vc check-in: e684cbc8 user: fvogel tags: canvas_image, tip-489
09:00
Better debug output formatting (from Scott). check-in: 11814b12 user: fvogel tags: canvas_image, tip-489
2018-02-09
12:52
Add typecasts in DrawCanvas() to assist MS VC compiler. check-in: d5b83928 user: scotty tags: canvas_image, tip-489
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tkCanvas.c.

2705
2706
2707
2708
2709
2710
2711






2712
2713
2714
2715
2716
2717
2718
2719
....
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
....
2823
2824
2825
2826
2827
2828
2829


2830


2831

2832
2833
2834
2835
2836
2837
2838
                                                        Tcl_AppendResult(interp, " ximagePtr->data", NULL);
    if (ximagePtr->data != NULL) {
		int ix, iy;
		Tcl_AppendResult(interp, " {", NULL);
		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);
				Tcl_AppendResult(interp, buffer, NULL);
			}
			Tcl_AppendResult(interp, " }", NULL);
		}
		Tcl_AppendResult(interp, " }", NULL);
	} else
		sprintf(buffer," NULL");
................................................................................
    bytesPerPixel = ximagePtr->bits_per_pixel/8;
    for (y = 0; y < blockPtr.height; ++y) {
#ifdef DEBUG_DRAWCANVAS
        Tcl_AppendResult(interp, " {", NULL);
#endif
        for(x = 0; x < blockPtr.width; ++x) {
            unsigned long pixel;
#ifdef DEBUG_DRAWCANVAS
            Tcl_AppendResult(interp, " {", NULL);
#endif
			switch (ximagePtr->bits_per_pixel) {

                /*
                 * Get an 8 bit pixel from the XImage.
                 */
                case 8 :
                   pixel = *((unsigned char *)(ximagePtr->data + bytesPerPixel * x + ximagePtr->bytes_per_line * y));
................................................................................
            blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x + R_OFFSET] = (unsigned char)((pixel & visualPtr->red_mask) >> rshift);
            blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x +1] = (unsigned char)((pixel & visualPtr->green_mask) >> gshift);
            blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x + B_OFFSET] = (unsigned char)((pixel & visualPtr->blue_mask) >> bshift);
            blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x +3] = 0xFF;
#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);

            }
#endif
        }
#ifdef DEBUG_DRAWCANVAS
        Tcl_AppendResult(interp, " }", NULL);
#endif
    }






>
>
>
>
>
>
|







 







<
<
<







 







>
>
|
>
>
|
>







2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
....
2777
2778
2779
2780
2781
2782
2783



2784
2785
2786
2787
2788
2789
2790
....
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
                                                        Tcl_AppendResult(interp, " ximagePtr->data", NULL);
    if (ximagePtr->data != NULL) {
		int ix, iy;
		Tcl_AppendResult(interp, " {", NULL);
		for (iy = 0; iy < ximagePtr->height; ++ iy) {
			Tcl_AppendResult(interp, " {", NULL);
			for (ix = 0; ix < ximagePtr->bytes_per_line; ++ ix) {
				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);
		}
		Tcl_AppendResult(interp, " }", NULL);
	} else
		sprintf(buffer," NULL");
................................................................................
    bytesPerPixel = ximagePtr->bits_per_pixel/8;
    for (y = 0; y < blockPtr.height; ++y) {
#ifdef DEBUG_DRAWCANVAS
        Tcl_AppendResult(interp, " {", NULL);
#endif
        for(x = 0; x < blockPtr.width; ++x) {
            unsigned long pixel;



			switch (ximagePtr->bits_per_pixel) {

                /*
                 * Get an 8 bit pixel from the XImage.
                 */
                case 8 :
                   pixel = *((unsigned char *)(ximagePtr->data + bytesPerPixel * x + ximagePtr->bytes_per_line * y));
................................................................................
            blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x + R_OFFSET] = (unsigned char)((pixel & visualPtr->red_mask) >> rshift);
            blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x +1] = (unsigned char)((pixel & visualPtr->green_mask) >> gshift);
            blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x + B_OFFSET] = (unsigned char)((pixel & visualPtr->blue_mask) >> bshift);
            blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x +3] = 0xFF;
#ifdef DEBUG_DRAWCANVAS
            {
				int ix;
                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
        }
#ifdef DEBUG_DRAWCANVAS
        Tcl_AppendResult(interp, " }", NULL);
#endif
    }

Changes to win/makefile.vc.

301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# Additional include and C macro definitions for the implicit rules
# defined in rules.vc
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 \
!if $(HAVE_UXTHEME_H)
		 -DHAVE_UXTHEME_H=1 \
!endif
!if $(TTK_SQUARE_WIDGET)
		 -DTTK_SQUARE_WIDGET=1 \
!endif







|







301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# Additional include and C macro definitions for the implicit rules
# defined in rules.vc
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 -DDEBUG_DRAWCANVAS \
!if $(HAVE_UXTHEME_H)
		 -DHAVE_UXTHEME_H=1 \
!endif
!if $(TTK_SQUARE_WIDGET)
		 -DTTK_SQUARE_WIDGET=1 \
!endif