Tk Source Code

Changes On Branch bug-d4fb4e80d2
Login

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

Changes In Branch bug-d4fb4e80d2 Excluding Merge-Ins

This is equivalent to a diff from 07ebb554 to fd4fd7da

2017-01-14
14:32
Partially fix [fab5fed65e]: OS X - lots of textDisp failures (spurious 'borders' and indices in tk_textRedraw). This commit fixes the spurious indices part of the bug report. check-in: 114ef627 user: fvogel tags: bug-fab5fed65e, OSX_redraw_artifacts
2017-01-10
20:35
Merge core-8-6-branch so that new test imgPhoto-4.74 lands in the present bugfix branch as well Closed-Leaf check-in: fd4fd7da user: fvogel tags: bug-d4fb4e80d2
16:02
More internal use of size_t. Add test-case imgPhoto-4.74, which shows error-handling when there are two values on the command line not connected to options. check-in: 4ffa8b06 user: jan.nijtmans tags: core-8-6-branch
2017-01-09
21:56
Fix [7a838c38a1]: X11 bind event ring buffer and NoExpose event. Patch from Christian Werner. check-in: e7b81812 user: fvogel tags: trunk
21:56
Fix [7a838c38a1]: X11 bind event ring buffer and NoExpose event. Patch from Christian Werner. check-in: 07ebb554 user: fvogel tags: core-8-6-branch
13:42
Better comment explaining why some events are ignored. Closed-Leaf check-in: cef0b3e4 user: fvogel tags: bug-7a838c38a1
2017-01-07
15:34
Merge core-8-6-branch check-in: d0b778eb user: fvogel tags: bug-d4fb4e80d2
15:18
Fix [c12af74765]: OS X - text-21.1 fails check-in: 46ce2328 user: fvogel tags: core-8-6-branch

Changes to generic/tkImgPhoto.c.

809
810
811
812
813
814
815
816
817
818
819
820




821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
	channels[2] = Tcl_NewIntObj(pixelPtr[2]);
	Tcl_SetObjResult(interp, Tcl_NewListObj(3, channels));
	return TCL_OK;
    }

    case PHOTO_PUT:
	/*
	 * photo put command - first parse the options and colors specified.
	 */

	index = 2;
	memset(&options, 0, sizeof(options));




	options.name = NULL;
	if (ParseSubcommandOptions(&options, interp, OPT_TO|OPT_FORMAT,
		&index, objc, objv) != TCL_OK) {
	    return TCL_ERROR;
	}
	if ((options.name == NULL) || (index < objc)) {
	    Tcl_WrongNumArgs(interp, 2, objv, "data ?-option value ...?");
	    return TCL_ERROR;
	}

	if (MatchStringFormat(interp, options.name ? objv[2]:NULL,
		options.format, &imageFormat, &imageWidth,
		&imageHeight, &oldformat) == TCL_OK) {
	    Tcl_Obj *format, *data;

	    if (!(options.options & OPT_TO) || (options.toX2 < 0)) {







|


|

>
>
>
>
|




<
<
<
<







809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829




830
831
832
833
834
835
836
	channels[2] = Tcl_NewIntObj(pixelPtr[2]);
	Tcl_SetObjResult(interp, Tcl_NewListObj(3, channels));
	return TCL_OK;
    }

    case PHOTO_PUT:
	/*
	 * photo put command - first get the image data, then parse the options and colors specified.
	 */

	index = 3;
	memset(&options, 0, sizeof(options));
	if (objc<3) {
	    Tcl_WrongNumArgs(interp, 2, objv, "data ?-option value ...?");
	    return TCL_ERROR;
	}
        options.name = objv[2];
	if (ParseSubcommandOptions(&options, interp, OPT_TO|OPT_FORMAT,
		&index, objc, objv) != TCL_OK) {
	    return TCL_ERROR;
	}





	if (MatchStringFormat(interp, options.name ? objv[2]:NULL,
		options.format, &imageFormat, &imageWidth,
		&imageHeight, &oldformat) == TCL_OK) {
	    Tcl_Obj *format, *data;

	    if (!(options.options & OPT_TO) || (options.toX2 < 0)) {
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007




1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
	ckfree(block.pixelPtr);
	return result;

    case PHOTO_READ: {
	Tcl_Obj *format;

	/*
	 * photo read command - first parse the options specified.
	 */

	index = 2;
	memset(&options, 0, sizeof(options));




	options.name = NULL;
	options.format = NULL;
	if (ParseSubcommandOptions(&options, interp,
		OPT_FORMAT | OPT_FROM | OPT_TO | OPT_SHRINK,
		&index, objc, objv) != TCL_OK) {
	    return TCL_ERROR;
	}
	if ((options.name == NULL) || (index < objc)) {
	    Tcl_WrongNumArgs(interp, 2, objv, "fileName ?-option value ...?");
	    return TCL_ERROR;
	}

	/*
	 * Prevent file system access in safe interpreters.
	 */

	if (Tcl_IsSafe(interp)) {
	    Tcl_SetObjResult(interp, Tcl_NewStringObj(







|


|

>
>
>
>
|
<





<
<
<
<







996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012

1013
1014
1015
1016
1017




1018
1019
1020
1021
1022
1023
1024
	ckfree(block.pixelPtr);
	return result;

    case PHOTO_READ: {
	Tcl_Obj *format;

	/*
	 * photo read command - first get the filename, then parse the options specified.
	 */

	index = 3;
	memset(&options, 0, sizeof(options));
	if (objc < 3) {
	    Tcl_WrongNumArgs(interp, 2, objv, "fileName ?-option value ...?");
	    return TCL_ERROR;
	}
	options.name = objv[2];

	if (ParseSubcommandOptions(&options, interp,
		OPT_FORMAT | OPT_FROM | OPT_TO | OPT_SHRINK,
		&index, objc, objv) != TCL_OK) {
	    return TCL_ERROR;
	}





	/*
	 * Prevent file system access in safe interpreters.
	 */

	if (Tcl_IsSafe(interp)) {
	    Tcl_SetObjResult(interp, Tcl_NewStringObj(
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299




1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
	    Tcl_SetObjResult(interp, Tcl_NewStringObj(
		    "can't write image to a file in a safe interpreter", -1));
	    Tcl_SetErrorCode(interp, "TK", "SAFE", "PHOTO_FILE", NULL);
	    return TCL_ERROR;
	}

	/*
	 * photo write command - first parse and check any options given.
	 */

	index = 2;
	memset(&options, 0, sizeof(options));




	options.name = NULL;
	options.format = NULL;
	if (ParseSubcommandOptions(&options, interp,
		OPT_FORMAT | OPT_FROM | OPT_GRAYSCALE | OPT_BACKGROUND,
		&index, objc, objv) != TCL_OK) {
	    return TCL_ERROR;
	}
	if ((options.name == NULL) || (index < objc)) {
	    Tcl_WrongNumArgs(interp, 2, objv, "fileName ?-option value ...?");
	    return TCL_ERROR;
	}
	if ((options.fromX > masterPtr->width)
		|| (options.fromY > masterPtr->height)
		|| (options.fromX2 > masterPtr->width)
		|| (options.fromY2 > masterPtr->height)) {
	    Tcl_SetObjResult(interp, Tcl_NewStringObj(
		    "coordinates for -from option extend outside image", -1));
	    Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL);







|


|

>
>
>
>
|
<





<
<
<
<







1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303

1304
1305
1306
1307
1308




1309
1310
1311
1312
1313
1314
1315
	    Tcl_SetObjResult(interp, Tcl_NewStringObj(
		    "can't write image to a file in a safe interpreter", -1));
	    Tcl_SetErrorCode(interp, "TK", "SAFE", "PHOTO_FILE", NULL);
	    return TCL_ERROR;
	}

	/*
	 * photo write command - first get the filename, then parse and check any options given.
	 */

	index = 3;
	memset(&options, 0, sizeof(options));
	if (objc<3) {
	    Tcl_WrongNumArgs(interp, 2, objv, "fileName ?-option value ...?");
	    return TCL_ERROR;
	}
        options.name = objv[2];

	if (ParseSubcommandOptions(&options, interp,
		OPT_FORMAT | OPT_FROM | OPT_GRAYSCALE | OPT_BACKGROUND,
		&index, objc, objv) != TCL_OK) {
	    return TCL_ERROR;
	}




	if ((options.fromX > masterPtr->width)
		|| (options.fromY > masterPtr->height)
		|| (options.fromX2 > masterPtr->width)
		|| (options.fromY2 > masterPtr->height)) {
	    Tcl_SetObjResult(interp, Tcl_NewStringObj(
		    "coordinates for -from option extend outside image", -1));
	    Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL);

Changes to tests/imgPhoto.test.

418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
    photo1 put {{blahgle}}
} -cleanup {
    image delete photo1
} -returnCodes error -result {can't parse color "blahgle"}
test imgPhoto-4.29 {ImgPhotoCmd procedure: put option} -setup {
    image create photo photo1
} -body {
    photo1 put -to 10 10 20 20 {{white}}
    photo1 get 19 19
} -cleanup {
    image delete photo1
} -result {255 255 255}
test imgPhoto-4.30 {ImgPhotoCmd procedure: read option} -setup {
    image create photo photo1
} -body {







|







418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
    photo1 put {{blahgle}}
} -cleanup {
    image delete photo1
} -returnCodes error -result {can't parse color "blahgle"}
test imgPhoto-4.29 {ImgPhotoCmd procedure: put option} -setup {
    image create photo photo1
} -body {
    photo1 put {{white}} -to 10 10 20 20
    photo1 get 19 19
} -cleanup {
    image delete photo1
} -result {255 255 255}
test imgPhoto-4.30 {ImgPhotoCmd procedure: read option} -setup {
    image create photo photo1
} -body {