Cut per-frame text tail and label allocations
- Font: walk UTF-8 codepoints in place instead of building a vector; reuse the texture-cache key buffer on the hit path. - Text tails: show/ShowAll test isShowing (kept equal to list membership) instead of a linear find per tail, which made the per-frame ShowAllTextTail O(N^2); memoize label widths measured by both Arrange and Render. - Tail painter reuses one CGraphicTextInstance and font name. - CGraphicTextInstance::Render no longer copies the text unless secret. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
33552b9eeb
commit
4662e06b35
@@ -132,7 +132,7 @@ void TextTailManager::ShowCharacterTextTail(uint32_t vid) {
|
||||
if (it == m_characterMap.end()) return;
|
||||
|
||||
auto tail = it->second;
|
||||
if (std::find(m_characterList.begin(), m_characterList.end(), tail) == m_characterList.end()) {
|
||||
if (!tail->isShowing) { // isShowing <=> in m_characterList
|
||||
tail->isShowing = true;
|
||||
m_characterList.push_back(tail);
|
||||
}
|
||||
@@ -200,7 +200,7 @@ void TextTailManager::ShowItemTextTail(uint32_t vid) {
|
||||
if (it == m_itemMap.end()) return;
|
||||
|
||||
auto tail = it->second;
|
||||
if (std::find(m_itemList.begin(), m_itemList.end(), tail) == m_itemList.end()) {
|
||||
if (!tail->isShowing) { // isShowing <=> in m_itemList
|
||||
tail->isShowing = true;
|
||||
m_itemList.push_back(tail);
|
||||
}
|
||||
@@ -237,13 +237,13 @@ bool TextTailManager::IsChatTextTail(uint32_t vid) const {
|
||||
|
||||
void TextTailManager::ShowAllTextTail() {
|
||||
for (auto& [vid, tail] : m_characterMap) {
|
||||
if (std::find(m_characterList.begin(), m_characterList.end(), tail) == m_characterList.end()) {
|
||||
if (!tail->isShowing) { // isShowing <=> in m_characterList
|
||||
tail->isShowing = true;
|
||||
m_characterList.push_back(tail);
|
||||
}
|
||||
}
|
||||
for (auto& [vid, tail] : m_itemMap) {
|
||||
if (std::find(m_itemList.begin(), m_itemList.end(), tail) == m_itemList.end()) {
|
||||
if (!tail->isShowing) { // isShowing <=> in m_itemList
|
||||
tail->isShowing = true;
|
||||
m_itemList.push_back(tail);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user