Tk Source Code

Changes On Branch bug-3406785
Login

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

Changes In Branch bug-3406785 Excluding Merge-Ins

This is equivalent to a diff from 0ebba016 to 2eea4fe0

2017-09-16
08:26
Fix [3406785]: Incorrect coords rounding, pixel jump in drawing canvas items. check-in: b66226e6 user: fvogel tags: core-8-6-branch
08:22
Fix [d0c55bd78a]: inaccurate documentation for continue/break/ok in binding scripts. Thanks to Brad Lanam. check-in: c0dbd605 user: fvogel tags: core-8-6-branch
08:19
merge core-8-6-branch check-in: 26f1b810 user: fvogel tags: bug-73ba07efcd
08:18
merge core-8-6-branch Closed-Leaf check-in: 090b6549 user: fvogel tags: bug-d9fdfa435d
2017-09-14
20:15
Fix [5239fd749b]: Segfault when copying a photo image to itself. Patch from Simon Bachmann. Closed-Leaf check-in: a9083994 user: fvogel tags: bug-5239fd749b
2017-09-09
13:46
Fix [3406785]: Incorrect coords rounding, pixel jump in drawing canvas items Closed-Leaf check-in: 2eea4fe0 user: fvogel tags: bug-3406785
2017-09-04
13:39
merge core-8-6-branch. Some upstream androwish changes check-in: 8e408aba user: jan.nijtmans tags: androwish
2017-09-03
10:29
Add missing .RE in canvas.n check-in: 9d351686 user: fvogel tags: trunk
10:29
Add missing .RE in canvas.n check-in: 0ebba016 user: fvogel tags: core-8-6-branch
10:28
Add missing .RE in canvas.n Closed-Leaf check-in: 2f75ee98 user: fvogel tags: bug-7c7e8f957e
2017-08-24
19:41
Fix [cc42cc18a5]: Prevent the test suite from crashing when running tests imgPhoto-18.* in case the host machine runs out of memory and the memory allocation error is not returned (e.g. on FreeBSD 11.1) check-in: c74add2d user: fvogel tags: core-8-6-branch

Changes to generic/tkRectOval.c.

755
756
757
758
759
760
761
762
763






764








































765
766














































767
768
769
770
771
772
773
     * will die if it isn't.
     */

    Tk_CanvasDrawableCoords(canvas, rectOvalPtr->bbox[0],rectOvalPtr->bbox[1],
	    &x1, &y1);
    Tk_CanvasDrawableCoords(canvas, rectOvalPtr->bbox[2],rectOvalPtr->bbox[3],
	    &x2, &y2);
    if (x2 <= x1) {
	x2 = x1+1;






    }








































    if (y2 <= y1) {
	y2 = y1+1;














































    }

    /*
     * Display filled part first (if wanted), then outline. If we're
     * stippling, then modify the stipple offset in the GC. Be sure to reset
     * the offset when done, since the GC is supposed to be read-only.
     */







|
|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
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
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
     * will die if it isn't.
     */

    Tk_CanvasDrawableCoords(canvas, rectOvalPtr->bbox[0],rectOvalPtr->bbox[1],
	    &x1, &y1);
    Tk_CanvasDrawableCoords(canvas, rectOvalPtr->bbox[2],rectOvalPtr->bbox[3],
	    &x2, &y2);
    if (x2 == x1) {

        /*
         * The width of the bounding box corresponds to less than one pixel
         * on screen. Adjustment is needed to avoid drawing attempts with zero
         * width items (which would draw nothing). The bounding box spans
         * either 1 or 2 pixels. Select which pixel will be drawn.
         */

        short ix1 = (short) (rectOvalPtr->bbox[0]);
        short ix2 = (short) (rectOvalPtr->bbox[2]);

        if (ix1 == ix2) {

            /*
             * x1 and x2 are "within the same pixel". Use this pixel.
             * Note: the degenerated case (bbox[0]==bbox[2]) of a completely
             * flat box results in arbitrary selection of the pixel at the
             * right (with positive coordinate) or left (with negative
             * coordinate) of the box. There is no "best choice" here.
             */

            if (ix1 > 0) {
                x2 += 1;
            } else {
                x1 -= 1;
            }
        } else {

            /*
             * (x1,x2) span two pixels. Select the one with the larger
             * covered "area".
             */

            if (ix1 > 0) {
                if ((rectOvalPtr->bbox[2] - ix2) > (ix2 - rectOvalPtr->bbox[0])) {
                    x2 += 1;
                } else {
                    x1 -= 1;
                }
            } else {
                if ((rectOvalPtr->bbox[2] - ix1) > (ix1 - rectOvalPtr->bbox[0])) {
                    x2 += 1;
                } else {
                    x1 -= 1;
                }
            }
        }
    }
    if (y2 == y1) {

        /*
         * The height of the bounding box corresponds to less than one pixel
         * on screen. Adjustment is needed to avoid drawing attempts with zero
         * height items (which would draw nothing). The bounding box spans
         * either 1 or 2 pixels. Select which pixel will be drawn.
         */

        short iy1 = (short) (rectOvalPtr->bbox[1]);
        short iy2 = (short) (rectOvalPtr->bbox[3]);

        if (iy1 == iy2) {

            /*
             * y1 and y2 are "within the same pixel". Use this pixel.
             * Note: the degenerated case (bbox[1]==bbox[3]) of a completely
             * flat box results in arbitrary selection of the pixel below
             * (with positive coordinate) or above (with negative coordinate)
             * the box. There is no "best choice" here.
             */

            if (iy1 > 0) {
                y2 += 1;
            } else {
                y1 -= 1;
            }
        } else {

            /*
             * (y1,y2) span two pixels. Select the one with the larger
             * covered "area".
             */

            if (iy1 > 0) {
                if ((rectOvalPtr->bbox[3] - iy2) > (iy2 - rectOvalPtr->bbox[1])) {
                    y2 += 1;
                } else {
                    y1 -= 1;
                }
            } else {
                if ((rectOvalPtr->bbox[3] - iy1) > (iy1 - rectOvalPtr->bbox[1])) {
                    y2 += 1;
                } else {
                    y1 -= 1;
                }
            }
        }
    }

    /*
     * Display filled part first (if wanted), then outline. If we're
     * stippling, then modify the stipple offset in the GC. Be sure to reset
     * the offset when done, since the GC is supposed to be read-only.
     */