diff options
author | Rye Mutt <rye@alchemyviewer.org> | 2024-08-01 00:38:58 -0400 |
---|---|---|
committer | Rye Mutt <rye@alchemyviewer.org> | 2024-08-01 11:51:31 -0400 |
commit | 4217a778d68722735975f360c9be25655cf0e696 (patch) | |
tree | c66a36e8d5347fa88030ffa5e3bf1369dd3814fd /indra | |
parent | 0723308c9c041533953b45fe62686e9f483ce360 (diff) |
Fix excessive wstring conversions during emojipicker draw
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloateremojipicker.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp index 0830860633..50f71c9c0b 100644 --- a/indra/newview/llfloateremojipicker.cpp +++ b/indra/newview/llfloateremojipicker.cpp @@ -186,7 +186,7 @@ public: { mWStr = LLWString(1, emoji); mEmoji = emoji; - mTitle = title; + mTitle = utf8str_to_wstring(title); mBegin = begin; mEnd = end; } @@ -204,9 +204,9 @@ public: drawIcon(centerX, centerY - 1, iconWidth); static LLColor4 defaultColor(0.75f, 0.75f, 0.75f, 1.0f); - LLColor4 textColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", defaultColor); + static LLUIColor textColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", defaultColor); S32 max_pixels = clientWidth - iconWidth; - drawName((F32)iconWidth, centerY, max_pixels, textColor); + drawName((F32)iconWidth, centerY, max_pixels, textColor.get()); } protected: @@ -226,16 +226,16 @@ protected: max_pixels); // max_pixels } - void drawName(F32 x, F32 y, S32 max_pixels, LLColor4& color) + void drawName(F32 x, F32 y, S32 max_pixels, const LLColor4& color) { F32 x0 = x; F32 x1 = (F32)max_pixels; LLFontGL* font = LLFontGL::getFontEmojiLarge(); if (mBegin) { - std::string text = mTitle.substr(0, mBegin); - font->renderUTF8( - text, // text + LLWString text = mTitle.substr(0, mBegin); + font->render( + text.c_str(), // text 0, // begin_offset x0, // x y, // y @@ -246,14 +246,14 @@ protected: LLFontGL::DROP_SHADOW_SOFT, // shadow static_cast<S32>(text.size()), // max_chars (S32)x1); // max_pixels - F32 dx = font->getWidthF32(text); + F32 dx = font->getWidthF32(text.c_str()); x0 += dx; x1 -= dx; } if (x1 > 0 && mEnd > mBegin) { - std::string text = mTitle.substr(mBegin, mEnd - mBegin); - font->renderUTF8( + LLWString text = mTitle.substr(mBegin, mEnd - mBegin); + font->render( text, // text 0, // begin_offset x0, // x @@ -265,14 +265,14 @@ protected: LLFontGL::DROP_SHADOW_SOFT, // shadow static_cast<S32>(text.size()), // max_chars (S32)x1); // max_pixels - F32 dx = font->getWidthF32(text); + F32 dx = font->getWidthF32(text.c_str()); x0 += dx; x1 -= dx; } if (x1 > 0 && mEnd < mTitle.size()) { - std::string text = mEnd ? mTitle.substr(mEnd) : mTitle; - font->renderUTF8( + LLWString text = mEnd ? mTitle.substr(mEnd) : mTitle; + font->render( text, // text 0, // begin_offset x0, // x @@ -290,7 +290,7 @@ protected: private: llwchar mEmoji; LLWString mWStr; - std::string mTitle; + LLWString mTitle; size_t mBegin; size_t mEnd; }; |