diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-19 14:49:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-20 00:02:36 +0300 |
commit | e224a077737739a895fe533c9cce93783621d8e9 (patch) | |
tree | 28194260919ffcc8aa77f52caf45cbf3a1747334 /src/gui/fonts/textchunklist.cpp | |
parent | fd85f62f2e3003a79e90611e95b09e23710be479 (diff) | |
download | manaverse-e224a077737739a895fe533c9cce93783621d8e9.tar.gz manaverse-e224a077737739a895fe533c9cce93783621d8e9.tar.bz2 manaverse-e224a077737739a895fe533c9cce93783621d8e9.tar.xz manaverse-e224a077737739a895fe533c9cce93783621d8e9.zip |
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.
Diffstat (limited to 'src/gui/fonts/textchunklist.cpp')
-rw-r--r-- | src/gui/fonts/textchunklist.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
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; |