diff options
author | fvogel <fvogelnew1@free.fr> | 2020-04-23 21:06:20 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2020-04-23 21:06:20 (GMT) |
commit | a5643c1cd9127a06bc125bb587a95862f4cac377 (patch) | |
tree | c13237df5461c59425c34cb2754a84cd11db60e2 /generic/tkCanvText.c | |
parent | 0c67c10d860650e92d4ff45a2a6d8c9cde76bb07 (diff) | |
download | tk-a5643c1cd9127a06bc125bb587a95862f4cac377.zip tk-a5643c1cd9127a06bc125bb587a95862f4cac377.tar.gz tk-a5643c1cd9127a06bc125bb587a95862f4cac377.tar.bz2 |
Optimize text item drawing in canvas by skipping the drawing of empty unselected portions of text. Patch from Christopher Chavez.
Diffstat (limited to 'generic/tkCanvText.c')
-rw-r--r-- | generic/tkCanvText.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index cfd0054..1e58ce9 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -957,19 +957,23 @@ DisplayCanvText( */ if ((selFirstChar >= 0) && (textPtr->selTextGC != textPtr->gc)) { - TkDrawAngledTextLayout(display, drawable, textPtr->gc, - textPtr->textLayout, drawableX, drawableY, textPtr->angle, - 0, selFirstChar); + if (0 < selFirstChar) { + TkDrawAngledTextLayout(display, drawable, textPtr->gc, + textPtr->textLayout, drawableX, drawableY, textPtr->angle, + 0, selFirstChar); + } TkDrawAngledTextLayout(display, drawable, textPtr->selTextGC, textPtr->textLayout, drawableX, drawableY, textPtr->angle, selFirstChar, selLastChar + 1); - TkDrawAngledTextLayout(display, drawable, textPtr->gc, - textPtr->textLayout, drawableX, drawableY, textPtr->angle, - selLastChar + 1, -1); + if (selLastChar + 1 < textPtr->numChars) { + TkDrawAngledTextLayout(display, drawable, textPtr->gc, + textPtr->textLayout, drawableX, drawableY, textPtr->angle, + selLastChar + 1, textPtr->numChars); + } } else { TkDrawAngledTextLayout(display, drawable, textPtr->gc, textPtr->textLayout, drawableX, drawableY, textPtr->angle, - 0, -1); + 0, textPtr->numChars); } TkUnderlineAngledTextLayout(display, drawable, textPtr->gc, textPtr->textLayout, drawableX, drawableY, textPtr->angle, |