summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRye Mutt <rye@alchemyviewer.org>2024-08-03 10:10:17 -0400
committerRye Mutt <rye@alchemyviewer.org>2024-08-04 23:11:57 -0400
commitc4e921828a41c0e759ee103c6cfdb2cc40c1a581 (patch)
tree4e26ceeb63a58d1490a976794911c1342cbdd473 /indra/newview
parent874794ea584588457dfde7ef17c447e2a0eb46bb (diff)
Optimization and cleanup of various color finds during draw
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llchathistory.cpp14
-rw-r--r--indra/newview/llconversationview.cpp11
-rw-r--r--indra/newview/llfloateremojipicker.cpp6
-rw-r--r--indra/newview/llhudnametag.cpp9
-rw-r--r--indra/newview/llhudtext.cpp6
-rw-r--r--indra/newview/llinventorygallery.cpp6
-rw-r--r--indra/newview/llscripteditor.cpp2
-rw-r--r--indra/newview/llspeakers.cpp4
-rw-r--r--indra/newview/lltoolbarview.cpp2
-rw-r--r--indra/newview/llviewermenu.cpp6
-rw-r--r--indra/newview/llviewerobjectlist.cpp24
-rwxr-xr-xindra/newview/llviewerparceloverlay.cpp43
-rw-r--r--indra/newview/llviewerparceloverlay.h9
-rw-r--r--indra/newview/llviewertexteditor.cpp12
-rw-r--r--indra/newview/llvoavatar.cpp4
15 files changed, 92 insertions, 66 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 2b02aabc31..8eba9aee37 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -693,7 +693,7 @@ public:
mNeedsTimeBox = false;
user_name->setValue(mFrom);
updateMinUserNameWidth();
- LLColor4 sep_color = LLUIColorTable::instance().getColor("ChatTeleportSeparatorColor");
+ LLUIColor sep_color = LLUIColorTable::instance().getColor("ChatTeleportSeparatorColor");
setTransparentColor(sep_color);
mTimeBoxTextBox->setVisible(false);
}
@@ -739,7 +739,7 @@ public:
std::string username = chat.mFromName.substr(username_start + 2);
username = username.substr(0, username.length() - 1);
LLStyle::Params style_params_name;
- LLColor4 userNameColor = LLUIColorTable::instance().getColor("EmphasisColor");
+ LLUIColor userNameColor = LLUIColorTable::instance().getColor("EmphasisColor");
style_params_name.color(userNameColor);
style_params_name.font.name("SansSerifSmall");
style_params_name.font.style("NORMAL");
@@ -1037,7 +1037,7 @@ private:
!av_name.isDisplayNameDefault())
{
LLStyle::Params style_params_name;
- LLColor4 userNameColor = LLUIColorTable::instance().getColor("EmphasisColor");
+ LLUIColor userNameColor = LLUIColorTable::instance().getColor("EmphasisColor");
style_params_name.color(userNameColor);
style_params_name.font.name("SansSerifSmall");
style_params_name.font.style("NORMAL");
@@ -1239,8 +1239,8 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
mMoreChatPanel->reshape(mMoreChatPanel->getRect().getWidth(), height);
}
- LLColor4 txt_color = LLUIColorTable::instance().getColor("White");
- LLColor4 name_color(txt_color);
+ LLUIColor txt_color = LLUIColorTable::instance().getColor("White");
+ LLUIColor name_color(txt_color);
LLViewerChat::getChatColor(chat,txt_color);
LLFontGL* fontp = LLViewerChat::getChatFont();
@@ -1317,7 +1317,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
{
if (!message_from_log)
{
- LLColor4 timestamp_color = LLUIColorTable::instance().getColor("ChatTimestampColor");
+ LLUIColor timestamp_color = LLUIColorTable::instance().getColor("ChatTimestampColor");
timestamp_style.color(timestamp_color);
timestamp_style.readonly_color(timestamp_color);
}
@@ -1344,7 +1344,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
// set the link for the object name to be the objectim SLapp
// (don't let object names with hyperlinks override our objectim Url)
LLStyle::Params link_params(body_message_params);
- LLColor4 link_color = LLUIColorTable::instance().getColor("HTMLLinkColor");
+ LLUIColor link_color = LLUIColorTable::instance().getColor("HTMLLinkColor");
link_params.color = link_color;
link_params.readonly_color = link_color;
link_params.is_link = true;
diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp
index eac1ee2a3c..72d08428d3 100644
--- a/indra/newview/llconversationview.cpp
+++ b/indra/newview/llconversationview.cpp
@@ -652,6 +652,7 @@ void LLConversationViewParticipant::draw()
static LLUIColor sFlashBgColor = LLUIColorTable::instance().getColor("MenuItemFlashBgColor", DEFAULT_WHITE);
static LLUIColor sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE);
static LLUIColor sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE);
+ static LLUIColor sFriendColor = LLUIColorTable::instance().getColor("ConversationFriendColor");;
const bool show_context = (getRoot() ? getRoot()->getShowSelectionContext() : false);
@@ -661,23 +662,23 @@ void LLConversationViewParticipant::draw()
F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad;
F32 text_left = (F32)getLabelXPos();
- LLColor4 color;
+ LLUIColor* color;
LLLocalSpeakerMgr *speakerMgr = LLLocalSpeakerMgr::getInstance();
if (speakerMgr && speakerMgr->isSpeakerToBeRemoved(mUUID))
{
- color = sFgDisabledColor;
+ color = &sFgDisabledColor;
}
else
{
if (LLAvatarActions::isFriend(mUUID))
{
- color = LLUIColorTable::instance().getColor("ConversationFriendColor");
+ color = &sFriendColor;
}
else
{
- color = mIsSelected ? sHighlightFgColor : sFgColor;
+ color = mIsSelected ? &sHighlightFgColor : &sFgColor;
}
}
@@ -688,7 +689,7 @@ void LLConversationViewParticipant::draw()
}
drawHighlight(show_context, mIsSelected, sHighlightBgColor, sFlashBgColor, sFocusOutlineColor, sMouseOverColor);
- drawLabel(font, text_left, y, color, right_x);
+ drawLabel(font, text_left, y, color->get(), right_x);
LLView::draw();
}
diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp
index 50f71c9c0b..cc13e5d059 100644
--- a/indra/newview/llfloateremojipicker.cpp
+++ b/indra/newview/llfloateremojipicker.cpp
@@ -203,8 +203,7 @@ public:
F32 centerY = 0.5f * clientHeight;
drawIcon(centerX, centerY - 1, iconWidth);
- static LLColor4 defaultColor(0.75f, 0.75f, 0.75f, 1.0f);
- static LLUIColor textColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", defaultColor);
+ static LLUIColor textColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", LLColor4(0.75f, 0.75f, 0.75f, 1.0f));
S32 max_pixels = clientWidth - iconWidth;
drawName((F32)iconWidth, centerY, max_pixels, textColor.get());
}
@@ -704,8 +703,7 @@ void LLFloaterEmojiPicker::fillEmojis(bool fromResize)
LLPanel::Params icon_params;
LLRect icon_rect(0, icon_size, icon_size, 0);
- static LLColor4 default_color(0.75f, 0.75f, 0.75f, 1.0f);
- LLColor4 bg_color = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", default_color);
+ static LLUIColor bg_color = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", LLColor4(0.75f, 0.75f, 0.75f, 1.0f));
if (!mSelectedGroupIndex)
{
diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp
index 4011a857e5..205089c662 100644
--- a/indra/newview/llhudnametag.cpp
+++ b/indra/newview/llhudnametag.cpp
@@ -279,8 +279,10 @@ void LLHUDNameTag::renderText(bool for_select)
mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f));
// *TODO: make this a per-text setting
- LLColor4 bg_color = LLUIColorTable::instance().getColor("NameTagBackground");
- bg_color.setAlpha(gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor);
+ static LLCachedControl<F32> bubble_opacity(gSavedSettings, "ChatBubbleOpacity");
+ static LLUIColor nametag_bg_color = LLUIColorTable::instance().getColor("NameTagBackground");
+ LLColor4 bg_color = nametag_bg_color;
+ bg_color.setAlpha(bubble_opacity * alpha_factor);
// scale screen size of borders down
//RN: for now, text on hud objects is never occluded
@@ -340,8 +342,7 @@ void LLHUDNameTag::renderText(bool for_select)
x_offset = -0.5f * mWidth + (HORIZONTAL_PADDING / 2.f);
}
- LLColor4 label_color(0.f, 0.f, 0.f, 1.f);
- label_color.mV[VALPHA] = alpha_factor;
+ LLColor4 label_color(0.f, 0.f, 0.f, alpha_factor);
hud_render_text(segment_iter->getText(), render_position, *fontp, segment_iter->mStyle, LLFontGL::NO_SHADOW, x_offset, y_offset, label_color, false);
}
}
diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp
index 35bcf65db6..fd0d8b696f 100644
--- a/indra/newview/llhudtext.cpp
+++ b/indra/newview/llhudtext.cpp
@@ -138,8 +138,10 @@ void LLHUDText::renderText()
mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f));
// *TODO: make this a per-text setting
- LLColor4 bg_color = LLUIColorTable::instance().getColor("ObjectBubbleColor");
- bg_color.setAlpha(gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor);
+ static LLCachedControl<F32> bubble_opacity(gSavedSettings, "ChatBubbleOpacity");
+ static LLUIColor nametag_bg_color = LLUIColorTable::instance().getColor("ObjectBubbleColor");
+ LLColor4 bg_color = nametag_bg_color;
+ bg_color.setAlpha(bubble_opacity * alpha_factor);
const S32 border_height = 16;
const S32 border_width = 16;
diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp
index 2ca122c955..9e6cf7ac73 100644
--- a/indra/newview/llinventorygallery.cpp
+++ b/indra/newview/llinventorygallery.cpp
@@ -2881,11 +2881,13 @@ void LLInventoryGalleryItem::draw()
LLPanel::draw();
// Draw border
- LLUIColor border_color = LLUIColorTable::instance().getColor(mSelected ? "MenuItemHighlightBgColor" : "TextFgTentativeColor", LLColor4::white);
+ static LLUIColor menu_highlighted_color = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", LLColor4::white);;
+ static LLUIColor text_fg_tentative_color = LLUIColorTable::instance().getColor("TextFgTentativeColor", LLColor4::white);;
+ const LLColor4& border_color = mSelected ? menu_highlighted_color : text_fg_tentative_color;
LLRect border = mThumbnailCtrl->getRect();
border.mRight = border.mRight + 1;
border.mTop = border.mTop + 1;
- gl_rect_2d(border, border_color.get(), false);
+ gl_rect_2d(border, border_color, false);
}
}
diff --git a/indra/newview/llscripteditor.cpp b/indra/newview/llscripteditor.cpp
index 6f23477415..59cf3ac02b 100644
--- a/indra/newview/llscripteditor.cpp
+++ b/indra/newview/llscripteditor.cpp
@@ -122,7 +122,7 @@ void LLScriptEditor::drawLineNumbers()
const LLWString ltext = utf8str_to_wstring(llformat("%d", line.mLineNum ));
bool is_cur_line = cursor_line == line.mLineNum;
const U8 style = is_cur_line ? LLFontGL::BOLD : LLFontGL::NORMAL;
- const LLColor4 fg_color = is_cur_line ? mCursorColor : mReadOnlyFgColor;
+ const LLColor4& fg_color = is_cur_line ? mCursorColor : mReadOnlyFgColor;
getScriptFont()->render(
ltext, // string to draw
0, // begin offset
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index 81002139be..7480a18d9f 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -368,8 +368,8 @@ void LLSpeakerMgr::update(bool resort_ok)
return;
}
- LLColor4 speaking_color = LLUIColorTable::instance().getColor("SpeakingColor");
- LLColor4 overdriven_color = LLUIColorTable::instance().getColor("OverdrivenColor");
+ static const LLUIColor speaking_color = LLUIColorTable::instance().getColor("SpeakingColor");
+ static const LLUIColor overdriven_color = LLUIColorTable::instance().getColor("OverdrivenColor");
if(resort_ok) // only allow list changes when user is not interacting with it
{
diff --git a/indra/newview/lltoolbarview.cpp b/indra/newview/lltoolbarview.cpp
index 5180b1808c..0063e0b7fd 100644
--- a/indra/newview/lltoolbarview.cpp
+++ b/indra/newview/lltoolbarview.cpp
@@ -566,7 +566,7 @@ void LLToolBarView::draw()
// Draw drop zones if drop of a tool is active
if (isToolDragged())
{
- LLColor4 drop_color = LLUIColorTable::instance().getColor( "ToolbarDropZoneColor" );
+ static const LLUIColor drop_color = LLUIColorTable::instance().getColor( "ToolbarDropZoneColor" );
for (S32 i = LLToolBarEnums::TOOLBAR_FIRST; i <= LLToolBarEnums::TOOLBAR_LAST; i++)
{
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 0c8dd6dff9..e3b92598f7 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -536,9 +536,7 @@ void init_menus()
///
/// set up the colors
///
- LLColor4 color;
-
- LLColor4 context_menu_color = LLUIColorTable::instance().getColor("MenuPopupBgColor");
+ LLUIColor context_menu_color = LLUIColorTable::instance().getColor("MenuPopupBgColor");
gMenuAvatarSelf->setBackgroundColor( context_menu_color );
gMenuAvatarOther->setBackgroundColor( context_menu_color );
@@ -548,7 +546,7 @@ void init_menus()
gMenuLand->setBackgroundColor( context_menu_color );
- color = LLUIColorTable::instance().getColor( "MenuPopupBgColor" );
+ LLUIColor color = LLUIColorTable::instance().getColor( "MenuPopupBgColor" );
gPopupMenuView->setBackgroundColor( color );
// If we are not in production, use a different color to make it apparent.
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index cda8c99594..ae64ee7b92 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -1715,15 +1715,15 @@ void LLViewerObjectList::clearAllMapObjectsInRegion(LLViewerRegion* regionp)
void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap)
{
- LLColor4 above_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnAboveWater" );
- LLColor4 below_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnBelowWater" );
- LLColor4 you_own_above_water_color =
+ static const LLUIColor above_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnAboveWater" );
+ static const LLUIColor below_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnBelowWater" );
+ static const LLUIColor you_own_above_water_color =
LLUIColorTable::instance().getColor( "NetMapYouOwnAboveWater" );
- LLColor4 you_own_below_water_color =
+ static const LLUIColor you_own_below_water_color =
LLUIColorTable::instance().getColor( "NetMapYouOwnBelowWater" );
- LLColor4 group_own_above_water_color =
+ static const LLUIColor group_own_above_water_color =
LLUIColorTable::instance().getColor( "NetMapGroupOwnAboveWater" );
- LLColor4 group_own_below_water_color =
+ static const LLUIColor group_own_below_water_color =
LLUIColorTable::instance().getColor( "NetMapGroupOwnBelowWater" );
F32 max_radius = gSavedSettings.getF32("MiniMapPrimMaxRadius");
@@ -1753,7 +1753,7 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap)
// See DEV-17370 and DEV-29869/SNOW-79 for details.
approx_radius = llmin(approx_radius, max_radius);
- LLColor4U color = above_water_color;
+ LLColor4U color = above_water_color.get();
if( objectp->permYouOwner() )
{
const F32 MIN_RADIUS_FOR_OWNED_OBJECTS = 2.f;
@@ -1766,29 +1766,29 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap)
{
if ( objectp->permGroupOwner() )
{
- color = group_own_above_water_color;
+ color = group_own_above_water_color.get();
}
else
{
- color = you_own_above_water_color;
+ color = you_own_above_water_color.get();
}
}
else
{
if ( objectp->permGroupOwner() )
{
- color = group_own_below_water_color;
+ color = group_own_below_water_color.get();
}
else
{
- color = you_own_below_water_color;
+ color = you_own_below_water_color.get();
}
}
}
else
if( pos.mdV[VZ] < water_height )
{
- color = below_water_color;
+ color = below_water_color.get();
}
netmap.renderScaledPointGlobal(
diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp
index 58b8a5b677..2e9b5de72b 100755
--- a/indra/newview/llviewerparceloverlay.cpp
+++ b/indra/newview/llviewerparceloverlay.cpp
@@ -53,6 +53,14 @@
static const U8 OVERLAY_IMG_COMPONENTS = 4;
static const F32 LINE_WIDTH = 0.0625f;
+bool LLViewerParcelOverlay::sColorSetInitialized = false;
+LLUIColor LLViewerParcelOverlay::sAvailColor;
+LLUIColor LLViewerParcelOverlay::sOwnedColor;
+LLUIColor LLViewerParcelOverlay::sGroupColor;
+LLUIColor LLViewerParcelOverlay::sSelfColor;
+LLUIColor LLViewerParcelOverlay::sForSaleColor;
+LLUIColor LLViewerParcelOverlay::sAuctionColor;
+
LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_width_meters)
: mRegion( region ),
mParcelGridsPerEdge( S32( region_width_meters / PARCEL_GRID_STEP_METERS ) ),
@@ -60,6 +68,17 @@ LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_
mTimeSinceLastUpdate(),
mOverlayTextureIdx(-1)
{
+ if (!sColorSetInitialized)
+ {
+ sColorSetInitialized = true;
+ sAvailColor = LLUIColorTable::instance().getColor("PropertyColorAvail").get();
+ sOwnedColor = LLUIColorTable::instance().getColor("PropertyColorOther").get();
+ sGroupColor = LLUIColorTable::instance().getColor("PropertyColorGroup").get();
+ sSelfColor = LLUIColorTable::instance().getColor("PropertyColorSelf").get();
+ sForSaleColor = LLUIColorTable::instance().getColor("PropertyColorForSale").get();
+ sAuctionColor = LLUIColorTable::instance().getColor("PropertyColorAuction").get();
+ }
+
// Create a texture to hold color information.
// 4 components
// Use mipmaps = false, clamped, NEAREST filter, for sharp edges
@@ -321,12 +340,12 @@ void LLViewerParcelOverlay::updateOverlayTexture()
mOverlayTextureIdx = 0;
}
- const LLColor4U avail = LLUIColorTable::instance().getColor("PropertyColorAvail").get();
- const LLColor4U owned = LLUIColorTable::instance().getColor("PropertyColorOther").get();
- const LLColor4U group = LLUIColorTable::instance().getColor("PropertyColorGroup").get();
- const LLColor4U self = LLUIColorTable::instance().getColor("PropertyColorSelf").get();
- const LLColor4U for_sale = LLUIColorTable::instance().getColor("PropertyColorForSale").get();
- const LLColor4U auction = LLUIColorTable::instance().getColor("PropertyColorAuction").get();
+ const LLColor4U avail = sAvailColor.get();
+ const LLColor4U owned = sOwnedColor.get();
+ const LLColor4U group = sGroupColor.get();
+ const LLColor4U self = sSelfColor.get();
+ const LLColor4U for_sale = sForSaleColor.get();
+ const LLColor4U auction = sAuctionColor.get();
// Create the base texture.
U8 *raw = mImageRaw->getData();
@@ -339,7 +358,7 @@ void LLViewerParcelOverlay::updateOverlayTexture()
{
U8 ownership = mOwnership[i];
- F32 r,g,b,a;
+ U8 r,g,b,a;
// Color stored in low three bits
switch( ownership & 0x7 )
@@ -433,11 +452,11 @@ void LLViewerParcelOverlay::updatePropertyLines()
return;
LLColor4U colors[PARCEL_COLOR_MASK + 1];
- colors[PARCEL_SELF] = LLUIColorTable::instance().getColor("PropertyColorSelf").get();
- colors[PARCEL_OWNED] = LLUIColorTable::instance().getColor("PropertyColorOther").get();
- colors[PARCEL_GROUP] = LLUIColorTable::instance().getColor("PropertyColorGroup").get();
- colors[PARCEL_FOR_SALE] = LLUIColorTable::instance().getColor("PropertyColorForSale").get();
- colors[PARCEL_AUCTION] = LLUIColorTable::instance().getColor("PropertyColorAuction").get();
+ colors[PARCEL_SELF] = sSelfColor.get();
+ colors[PARCEL_OWNED] = sOwnedColor.get();
+ colors[PARCEL_GROUP] = sGroupColor.get();
+ colors[PARCEL_FOR_SALE] = sForSaleColor.get();
+ colors[PARCEL_AUCTION] = sAuctionColor.get();
mEdges.clear();
diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h
index d78005e376..03ae464cb8 100644
--- a/indra/newview/llviewerparceloverlay.h
+++ b/indra/newview/llviewerparceloverlay.h
@@ -35,6 +35,7 @@
#include "lluuid.h"
#include "llviewertexture.h"
#include "llgl.h"
+#include "lluicolor.h"
class LLViewerRegion;
class LLVector3;
@@ -123,6 +124,14 @@ private:
};
std::vector<Edge> mEdges;
+
+ static bool sColorSetInitialized;
+ static LLUIColor sAvailColor;
+ static LLUIColor sOwnedColor;
+ static LLUIColor sGroupColor;
+ static LLUIColor sSelfColor;
+ static LLUIColor sForSaleColor;
+ static LLUIColor sAuctionColor;
};
#endif
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp
index 15902e8a87..14228b469f 100644
--- a/indra/newview/llviewertexteditor.cpp
+++ b/indra/newview/llviewertexteditor.cpp
@@ -222,15 +222,9 @@ public:
image_rect.mTop = image_rect.mBottom + mImage->getHeight();
mImage->draw(LLRect((S32)image_rect.mLeft, (S32)image_rect.mTop, (S32)image_rect.mRight, (S32)image_rect.mBottom));
- LLColor4 color;
- if (mEditor.getReadOnly())
- {
- color = LLUIColorTable::instance().getColor("TextEmbeddedItemReadOnlyColor");
- }
- else
- {
- color = LLUIColorTable::instance().getColor("TextEmbeddedItemColor");
- }
+ static const LLUIColor embedded_item_readonly_col = LLUIColorTable::instance().getColor("TextEmbeddedItemReadOnlyColor");
+ static const LLUIColor embedded_item_col = LLUIColorTable::instance().getColor("TextEmbeddedItemColor");
+ const LLColor4& color = mEditor.getReadOnly() ? embedded_item_readonly_col : embedded_item_col;
F32 right_x;
mStyle->getFont()->render(mLabel, 0, image_rect.mRight + EMBEDDED_ITEM_LABEL_PADDING, draw_rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::UNDERLINE, LLFontGL::NO_SHADOW, static_cast<S32>(mLabel.length()), S32_MAX, &right_x);
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 83df39d606..d5a8ee6cf8 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -3531,7 +3531,9 @@ void LLVOAvatar::idleUpdateNameTagText(bool new_name)
std::deque<LLChat>::iterator chat_iter = mChats.begin();
mNameText->clearString();
- LLColor4 new_chat = LLUIColorTable::instance().getColor( isSelf() ? "UserChatColor" : "AgentChatColor" );
+ static const LLUIColor user_chat_color = LLUIColorTable::instance().getColor("UserChatColor");
+ static const LLUIColor agent_chat_color = LLUIColorTable::instance().getColor("AgentChatColor");
+ const LLColor4& new_chat = isSelf() ? user_chat_color : agent_chat_color;
LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f);
LLColor4 old_chat = lerp(normal_chat, LLColor4(0.6f, 0.6f, 0.6f, 1.f), 0.7f);
if (mTyping && mChats.size() >= MAX_BUBBLE_CHAT_UTTERANCES)