diff options
author | fvogel <fvogelnew1@free.fr> | 2021-09-19 19:32:26 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2021-09-19 19:32:26 (GMT) |
commit | 56a4439869ecffa86bd1750586a232851f0468d1 (patch) | |
tree | 988909a3e9411e7580043729455b30dc991f047e /generic | |
parent | 32befc53df03408b95b8e1ace173a67f7278d259 (diff) | |
download | tk-56a4439869ecffa86bd1750586a232851f0468d1.zip tk-56a4439869ecffa86bd1750586a232851f0468d1.tar.gz tk-56a4439869ecffa86bd1750586a232851f0468d1.tar.bz2 |
Fix [5fb8145997]: Canvas redraw region too small when inserting points to a smoothed line
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkCanvLine.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index ba4cda1..0ed7348 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -1011,7 +1011,7 @@ LineInsert( if ((length > 3) && (state != TK_STATE_HIDDEN)) { /* * This is some optimizing code that will result that only the part of - * the polygon that changed (and the objects that are overlapping with + * the line that changed (and the objects that are overlapping with * that part) need to be redrawn. A special flag is set that instructs * the general canvas code not to redraw the whole object. If this * flag is not set, the canvas will do the redrawing, otherwise I have @@ -1035,6 +1035,18 @@ LineInsert( if (beforeThis+objc+2 < length) { objc += 2; } + /* + * Smoothed lines use splines defined differently at the two line + * ends and elsewhere in the line (see TkMakeBezierCurve()). Include + * the first and/or last splines if needed. + */ + if (beforeThis == 2) { + beforeThis -= 2; + objc += 2; + } + if (beforeThis + objc == length - 2) { + objc += 2; + } } itemPtr->x1 = itemPtr->x2 = (int) linePtr->coordPtr[beforeThis]; itemPtr->y1 = itemPtr->y2 = (int) linePtr->coordPtr[beforeThis+1]; |