From e224a077737739a895fe533c9cce93783621d8e9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 19 May 2015 14:49:19 +0300 Subject: Add fast way for draw not changed text strings. TextChunk with colors and image stored inside draw object. If string or color changed old string image moved to cache. New string image generated or moved from cache. Use new way in drawing string in label. --- src/gui/fonts/textchunklist.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/gui/fonts/textchunklist.cpp') diff --git a/src/gui/fonts/textchunklist.cpp b/src/gui/fonts/textchunklist.cpp index bb5cc646f..023727282 100644 --- a/src/gui/fonts/textchunklist.cpp +++ b/src/gui/fonts/textchunklist.cpp @@ -70,6 +70,28 @@ void TextChunkList::moveToFirst(TextChunk *const item) start = item; } +void TextChunkList::remove(TextChunk *const item) +{ + if (!item) + return; + + TextChunk *const oldPrev = item->prev; + TextChunk *const oldNext = item->next; + if (oldPrev) + oldPrev->next = item->next; + else + start = oldNext; + if (oldNext) + oldNext->prev = item->prev; + else + end = oldPrev; + + search.erase(TextChunkSmall(item->text, + item->color, item->color2)); + searchWidth.erase(item->text); + size --; +} + void TextChunkList::removeBack() { TextChunk *oldEnd = end; -- cgit v1.2.3-70-g09d2