Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Corrected index method for polygon |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | pspjuth-canvas |
Files: | files | file ages | folders |
SHA1: |
51fe9467a370051ced90acda33d24094 |
User & Date: | pspjuth 2011-04-24 23:27:43 |
Context
2011-04-25
| ||
00:28 | Corrected dchars method for polygon check-in: a038b01f user: pspjuth tags: pspjuth-canvas | |
2011-04-24
| ||
23:27 | Corrected index method for polygon check-in: 51fe9467 user: pspjuth tags: pspjuth-canvas | |
23:04 | Fixes line behaviour, and a crash in polygon check-in: eacf61ca user: pspjuth tags: pspjuth-canvas | |
Changes
Changes to generic/tkCanvPoly.c.
︙ | ︙ | |||
1723 1724 1725 1726 1727 1728 1729 | } else { int count = 2*(polyPtr->numPoints - polyPtr->autoClosed); if (Tcl_GetIntFromObj(interp, obj, indexPtr) != TCL_OK) { goto badIndex; } *indexPtr &= -2; /* if odd, make it even */ | | | | | 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 | } else { int count = 2*(polyPtr->numPoints - polyPtr->autoClosed); if (Tcl_GetIntFromObj(interp, obj, indexPtr) != TCL_OK) { goto badIndex; } *indexPtr &= -2; /* if odd, make it even */ if (count == 0) { *indexPtr = 0; } else if (*indexPtr > 0) { *indexPtr = ((*indexPtr - 2) % count) + 2; } else if (*indexPtr < 0) { *indexPtr = count - (((-(*indexPtr) - 2) % count) + 2); } } return TCL_OK; /* * Some of the paths here leave messages in interp->result, so we have to * clear it out before storing our own message. |
︙ | ︙ |
Changes to tests/canvas.test.
︙ | ︙ | |||
922 923 924 925 926 927 928 | destroy .c } -result {0.0 0.0 10.0 11.0 12.0 13.0 14.0 15.0 3.0 3.0} test canvas-19.6b {rchars method - polygon} -setup { canvas .c } -body { set id [.c create polygon 0 1 2 3 4 5 6 7] .c rchars $id 2 end {10 11 12 13 14 15} | < | 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | destroy .c } -result {0.0 0.0 10.0 11.0 12.0 13.0 14.0 15.0 3.0 3.0} test canvas-19.6b {rchars method - polygon} -setup { canvas .c } -body { set id [.c create polygon 0 1 2 3 4 5 6 7] .c rchars $id 2 end {10 11 12 13 14 15} .c coords $id } -cleanup { destroy .c # PS: Since "dchars 2 end" deletes all, 0.0 1.0 is missing } -result {10.0 11.0 12.0 13.0 14.0 15.0} test canvas-19.7 {rchars method - text} -setup { canvas .c |
︙ | ︙ | |||
999 1000 1001 1002 1003 1004 1005 | } -result {0 0 0 0 2 2 4 4 6 6 6 6} test canvas-20.2 {index method - polygon} -setup { canvas .c } -body { set id [.c create polygon 0 1 2 3 4 5] set result {} | | < < | | 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 | } -result {0 0 0 0 2 2 4 4 6 6 6 6} test canvas-20.2 {index method - polygon} -setup { canvas .c } -body { set id [.c create polygon 0 1 2 3 4 5] set result {} foreach i {-10 -6 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 end 2000000004} { lappend result [.c index $id $i] } set result } -cleanup { destroy .c } -result {2 0 4 4 0 0 2 2 4 4 6 6 2 2 4 4 6 6 6 6} test canvas-20.3 {index method - text} -setup { canvas .c } -body { set id [.c create text 0 0 -text "012"] set result {} foreach i {-2 -1 0 1 2 3 4 end 2000000000} { |
︙ | ︙ |