summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRye Mutt <rye@alchemyviewer.org>2024-07-26 06:19:34 -0400
committerGitHub <noreply@github.com>2024-07-26 13:19:34 +0300
commit604cb4cb4dd71c0f90633e50d5b0108e3901c4ad (patch)
tree71f6fbbd3278cebceb755c6543268b3cb7ef5d28 /indra/newview
parentbc50d2c7d57618846a6cb318cd12e006270b64ae (diff)
Reduce utf8 to wstring conversion and llwstring temporaries during text draw (#2115)
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llexpandabletextbox.cpp6
-rw-r--r--indra/newview/llprogressview.cpp2
-rwxr-xr-xindra/newview/llworldmapview.cpp22
3 files changed, 16 insertions, 14 deletions
diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp
index 42fe8fc6e6..748e10160c 100644
--- a/indra/newview/llexpandabletextbox.cpp
+++ b/indra/newview/llexpandabletextbox.cpp
@@ -41,7 +41,7 @@ public:
: LLTextSegment(start, end),
mEditor(editor),
mStyle(style),
- mExpanderLabel(more_text)
+ mExpanderLabel(utf8str_to_wstring(more_text))
{}
/*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const
@@ -80,7 +80,7 @@ public:
/*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect)
{
F32 right_x;
- mStyle->getFont()->renderUTF8(mExpanderLabel, start,
+ mStyle->getFont()->render(mExpanderLabel, start,
draw_rect.mRight, draw_rect.mTop,
mStyle->getColor(),
LLFontGL::RIGHT, LLFontGL::TOP,
@@ -103,7 +103,7 @@ public:
private:
LLTextBase& mEditor;
LLStyleSP mStyle;
- std::string mExpanderLabel;
+ LLWString mExpanderLabel;
};
LLExpandableTextBox::LLTextBoxEx::Params::Params()
diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp
index 135e42437a..80e403dfde 100644
--- a/indra/newview/llprogressview.cpp
+++ b/indra/newview/llprogressview.cpp
@@ -391,7 +391,7 @@ void LLProgressView::initLogos()
S32 icon_width, icon_height;
// We don't know final screen rect yet, so we can't precalculate position fully
- S32 texture_start_x = (S32)mLogosLabel->getFont()->getWidthF32(mLogosLabel->getText()) + default_pad;
+ S32 texture_start_x = (S32)mLogosLabel->getFont()->getWidthF32(mLogosLabel->getWText().c_str()) + default_pad;
S32 texture_start_y = -7;
// Normally we would just preload these textures from textures.xml,
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index a0eec1e941..4757bd42e0 100755
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -1023,18 +1023,20 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4&
drawImage(pos_global, sTrackCircleImage, color);
}
- // clamp text position to on-screen
- const S32 TEXT_PADDING = DEFAULT_TRACKING_ARROW_SIZE + 2;
- S32 half_text_width = llfloor(font->getWidthF32(label) * 0.5f);
- text_x = llclamp(text_x, half_text_width + TEXT_PADDING, getRect().getWidth() - half_text_width - TEXT_PADDING);
- text_y = llclamp(text_y + vert_offset, TEXT_PADDING + vert_offset, getRect().getHeight() - font->getLineHeight() - TEXT_PADDING - vert_offset);
-
if (label != "")
{
- font->renderUTF8(
- label, 0,
- text_x,
- text_y,
+ // clamp text position to on-screen
+ const S32 TEXT_PADDING = DEFAULT_TRACKING_ARROW_SIZE + 2;
+
+ LLWString wlabel = utf8string_to_wstring(label);
+ S32 half_text_width = llfloor(font->getWidthF32(wlabel.c_str()) * 0.5f);
+ text_x = llclamp(text_x, half_text_width + TEXT_PADDING, getRect().getWidth() - half_text_width - TEXT_PADDING);
+ text_y = llclamp(text_y + vert_offset, TEXT_PADDING + vert_offset, getRect().getHeight() - font->getLineHeight() - TEXT_PADDING - vert_offset);
+
+ font->render(
+ wlabel, 0,
+ (F32)text_x,
+ (F32)text_y,
LLColor4::white, LLFontGL::HCENTER,
LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW);