Hotspot elimination.

This commit is contained in:
Shyotl
2019-08-07 21:21:36 -05:00
parent 4091bf9da5
commit 21b1d5b52e
7 changed files with 32 additions and 24 deletions

View File

@@ -674,17 +674,17 @@ void LLHUDText::reshape()
F32 LLHUDText::LLHUDTextSegment::getWidth(const LLFontGL* font)
{
std::map<const LLFontGL*, F32>::iterator iter = mFontWidthMap.find(font);
if (iter != mFontWidthMap.end())
if (mFontWidthMap[0].first == font)
{
return iter->second;
return mFontWidthMap[0].second;
}
else
else if (mFontWidthMap[1].first == font)
{
F32 width = font->getWidthF32(mText.c_str());
mFontWidthMap[font] = width;
return width;
return mFontWidthMap[1].second;
}
F32 width = font->getWidthF32(mText.c_str());
mFontWidthMap[mFontWidthMap[0].first != nullptr] = std::make_pair(font, width);
return width;
}
// [RLVa:KB] - Checked: 2010-03-27 (RLVa-1.4.0a) | Added: RLVa-1.0.0f