Commit 15795223 authored by Rye Mutt's avatar Rye Mutt 🍞
Browse files

Cache various ui color lookups in static LLUIColor

parent 9ea51cde
......@@ -4260,12 +4260,12 @@ void LLModelPreview::setPreviewLOD(S32 lod)
LLComboBox* combo_box3 = mFMP->getChild<LLComboBox>("preview_lod_combo3");
combo_box3->setCurrentByIndex((NUM_LOD-1)-mPreviewLOD); // combo box list of lods is in reverse order
LLColor4 highlight_color = LLUIColorTable::instance().getColor("MeshImportTableHighlightColor");
LLColor4 normal_color = LLUIColorTable::instance().getColor("MeshImportTableNormalColor");
static const LLUIColor highlight_color = LLUIColorTable::instance().getColor("MeshImportTableHighlightColor");
static const LLUIColor normal_color = LLUIColorTable::instance().getColor("MeshImportTableNormalColor");
for (S32 i = 0; i <= LLModel::LOD_HIGH; ++i)
{
const LLColor4& color = (i == lod) ? highlight_color : normal_color;
const LLColor4& color = (i == lod) ? highlight_color.get() : normal_color.get();
mFMP->childSetColor(lod_status_name[i], color);
mFMP->childSetColor(lod_label_name[i], color);
......
......@@ -586,12 +586,12 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string
LLColor4 LLManip::setupSnapGuideRenderPass(S32 pass)
{
static LLColor4 grid_color_fg = LLUIColorTable::instance().getColor("GridlineColor");
static LLColor4 grid_color_bg = LLUIColorTable::instance().getColor("GridlineBGColor");
static LLColor4 grid_color_shadow = LLUIColorTable::instance().getColor("GridlineShadowColor");
static const LLUIColor grid_color_fg = LLUIColorTable::instance().getColor("GridlineColor");
static const LLUIColor grid_color_bg = LLUIColorTable::instance().getColor("GridlineBGColor");
static const LLUIColor grid_color_shadow = LLUIColorTable::instance().getColor("GridlineShadowColor");
LLColor4 line_color;
F32 line_alpha = gSavedSettings.getF32("GridOpacity");
static const LLCachedControl<F32> line_alpha(gSavedSettings, "GridOpacity");
switch(pass)
{
......
......@@ -696,10 +696,11 @@ void LLOutfitGalleryItem::draw()
LLPanel::draw();
// Draw border
LLUIColor border_color = LLUIColorTable::instance().getColor(mSelected ? "OutfitGalleryItemSelected" : "OutfitGalleryItemUnselected", LLColor4::white);
static LLUIColor item_selected_color = LLUIColorTable::instance().getColor("OutfitGalleryItemSelected");
static LLUIColor item_unselected_color = LLUIColorTable::instance().getColor("OutfitGalleryItemUnselected");
LLRect border = mIconPreviewOutfit->getRect();
border.mRight = border.mRight + 1;
gl_rect_2d(border, border_color.get(), FALSE);
gl_rect_2d(border, mSelected ? item_selected_color : item_unselected_color, FALSE);
// If the floater is focused, don't apply its alpha to the texture (STORM-677).
const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
......
......@@ -1568,7 +1568,7 @@ void LLPanelObjectInventory::createFolderViews(LLInventoryObject* inventory_root
bridge = LLTaskInvFVBridge::createObjectBridge(this, inventory_root);
if(bridge)
{
LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
static LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
LLFolderViewFolder::Params p;
p.name = inventory_root->getName();
......
......@@ -116,6 +116,10 @@ void LLPanelVoiceDeviceSettings::draw()
F32 voice_power = LLVoiceClient::getInstance()->tuningGetEnergy() / LLVoiceClient::OVERDRIVEN_POWER_LEVEL;
S32 discrete_power = llmin(num_bars, llfloor(voice_power * (F32)num_bars + 0.1f));
static LLUIColor overdriven_color = LLUIColorTable::instance().getColor("OverdrivenColor");
static LLUIColor speaking_color = LLUIColorTable::instance().getColor("SpeakingColor");
static LLUIColor panel_focus_background_color = LLUIColorTable::instance().getColor("PanelFocusBackgroundColor");
for(S32 power_bar_idx = 0; power_bar_idx < num_bars; power_bar_idx++)
{
std::string view_name = llformat("%s%d", "bar", power_bar_idx);
......@@ -127,11 +131,11 @@ void LLPanelVoiceDeviceSettings::draw()
LLColor4 color;
if (power_bar_idx < discrete_power)
{
color = (power_bar_idx >= 3) ? LLUIColorTable::instance().getColor("OverdrivenColor") : LLUIColorTable::instance().getColor("SpeakingColor");
color = (power_bar_idx >= 3) ? overdriven_color : speaking_color;
}
else
{
color = LLUIColorTable::instance().getColor("PanelFocusBackgroundColor");
color = panel_focus_background_color;
}
LLRect color_rect = bar_view->getRect();
......
......@@ -81,13 +81,15 @@ BOOL LLSysWellItem::handleMouseDown(S32 x, S32 y, MASK mask)
//---------------------------------------------------------------------------------
void LLSysWellItem::onMouseEnter(S32 x, S32 y, MASK mask)
{
setTransparentColor(LLUIColorTable::instance().getColor( "SysWellItemSelected" ));
static LLUIColor sys_well_item_selected = LLUIColorTable::instance().getColor("SysWellItemSelected");
setTransparentColor(sys_well_item_selected);
}
//---------------------------------------------------------------------------------
void LLSysWellItem::onMouseLeave(S32 x, S32 y, MASK mask)
{
setTransparentColor(LLUIColorTable::instance().getColor( "SysWellItemUnselected" ));
static LLUIColor sys_well_item_unselected = LLUIColorTable::instance().getColor("SysWellItemUnselected");
setTransparentColor(sys_well_item_unselected);
}
//---------------------------------------------------------------------------------
......
......@@ -262,13 +262,15 @@ void LLIMWellWindow::ObjectRowPanel::initChiclet(const LLUUID& notification_id,
//---------------------------------------------------------------------------------
void LLIMWellWindow::ObjectRowPanel::onMouseEnter(S32 x, S32 y, MASK mask)
{
setTransparentColor(LLUIColorTable::instance().getColor("SysWellItemSelected"));
static LLUIColor sys_well_item_selected = LLUIColorTable::instance().getColor("SysWellItemSelected");
setTransparentColor(sys_well_item_selected);
}
//---------------------------------------------------------------------------------
void LLIMWellWindow::ObjectRowPanel::onMouseLeave(S32 x, S32 y, MASK mask)
{
setTransparentColor(LLUIColorTable::instance().getColor("SysWellItemUnselected"));
static LLUIColor sys_well_item_unselected = LLUIColorTable::instance().getColor("SysWellItemUnselected");
setTransparentColor(sys_well_item_unselected);
}
//---------------------------------------------------------------------------------
......
......@@ -590,7 +590,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++)
{
......
......@@ -43,50 +43,58 @@ LLViewerChat::font_change_signal_t LLViewerChat::sChatFontChangedSignal;
//static
void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color)
{
static const LLUIColor lt_gray = LLUIColorTable::instance().getColor("LtGray");
static const LLUIColor system_chat_color = LLUIColorTable::instance().getColor("SystemChatColor");
static const LLUIColor user_chat_color = LLUIColorTable::instance().getColor("UserChatColor");
static const LLUIColor agent_chat_color = LLUIColorTable::instance().getColor("AgentChatColor");
static const LLUIColor script_err_color = LLUIColorTable::instance().getColor("ScriptErrorColor");
static const LLUIColor owner_say_chat_color = LLUIColorTable::instance().getColor("llOwnerSayChatColor");
static const LLUIColor direct_chat_color = LLUIColorTable::instance().getColor("DirectChatColor");
static const LLUIColor object_chat_color = LLUIColorTable::instance().getColor("ObjectChatColor");
if(chat.mMuted)
{
r_color= LLUIColorTable::instance().getColor("LtGray");
r_color = lt_gray;
}
else
{
switch(chat.mSourceType)
{
case CHAT_SOURCE_SYSTEM:
r_color = LLUIColorTable::instance().getColor("SystemChatColor");
r_color = system_chat_color;
break;
case CHAT_SOURCE_AGENT:
if (chat.mFromID.isNull() || SYSTEM_FROM == chat.mFromName)
{
r_color = LLUIColorTable::instance().getColor("SystemChatColor");
r_color = system_chat_color;
}
else
{
if(gAgentID == chat.mFromID)
{
r_color = LLUIColorTable::instance().getColor("UserChatColor");
r_color = user_chat_color;
}
else
{
r_color = LLUIColorTable::instance().getColor("AgentChatColor");
r_color = agent_chat_color;
}
}
break;
case CHAT_SOURCE_OBJECT:
if (chat.mChatType == CHAT_TYPE_DEBUG_MSG)
{
r_color = LLUIColorTable::instance().getColor("ScriptErrorColor");
r_color = script_err_color;
}
else if ( chat.mChatType == CHAT_TYPE_OWNER )
{
r_color = LLUIColorTable::instance().getColor("llOwnerSayChatColor");
r_color = owner_say_chat_color;
}
else if ( chat.mChatType == CHAT_TYPE_DIRECT )
{
r_color = LLUIColorTable::instance().getColor("DirectChatColor");
r_color = direct_chat_color;
}
else
{
r_color = LLUIColorTable::instance().getColor("ObjectChatColor");
r_color = object_chat_color;
}
break;
default:
......@@ -95,7 +103,7 @@ void LLViewerChat::getChatColor(const LLChat& chat, LLColor4& r_color)
if (!chat.mPosAgent.isExactlyZero())
{
LLVector3 pos_agent = gAgent.getPositionAgent();
const LLVector3& pos_agent = gAgent.getPositionAgent();
F32 distance_squared = dist_vec_squared(pos_agent, chat.mPosAgent);
F32 dist_near_chat = gAgent.getNearChatRadius();
if (distance_squared > dist_near_chat * dist_near_chat)
......
......@@ -220,15 +220,10 @@ public:
image_rect.mTop = image_rect.mBottom + mImage->getHeight();
mImage->draw(LLRect(image_rect.mLeft, image_rect.mTop, image_rect.mRight, image_rect.mBottom));
LLColor4 color;
if (mEditor.getReadOnly())
{
color = LLUIColorTable::instance().getColor("TextEmbeddedItemReadOnlyColor");
}
else
{
color = LLUIColorTable::instance().getColor("TextEmbeddedItemColor");
}
static const LLUIColor text_embed_item_readonly_color = LLUIColorTable::instance().getColor("TextEmbeddedItemReadOnlyColor");
static const LLUIColor text_embed_item_color = LLUIColorTable::instance().getColor("TextEmbeddedItemColor");
const LLColor4 color = mEditor.getReadOnly() ? text_embed_item_readonly_color : text_embed_item_color;
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, mLabel.length(), S32_MAX, &right_x);
......
......@@ -3359,9 +3359,11 @@ 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" );
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);
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;
const LLColor4 normal_chat = lerp(new_chat, LLColor4(0.8f, 0.8f, 0.8f, 1.f), 0.7f);
const 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)
{
++chat_iter;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment