From 1e85c42bb7a0541253c1af8b165158c9e693712a Mon Sep 17 00:00:00 2001 From: Shyotl Date: Thu, 24 Feb 2011 17:27:57 -0600 Subject: [PATCH] Static'd and or const'd some instances of LLCachedControl. Converted a few frequently fetched settings to LLCachedControl --- indra/newview/llconsole.cpp | 2 +- indra/newview/llfloaterfriends.cpp | 8 ++++---- indra/newview/llhoverview.cpp | 4 ++-- indra/newview/llhudtext.cpp | 4 ++-- indra/newview/llimpanel.cpp | 2 +- indra/newview/llmanip.cpp | 8 ++++---- indra/newview/llmanipscale.cpp | 5 +++-- indra/newview/llmaniptranslate.cpp | 5 +++-- indra/newview/llnetmap.cpp | 2 +- indra/newview/llviewermessage.cpp | 2 +- indra/newview/llvoavatar.cpp | 12 ++++++------ indra/newview/llvotree.cpp | 6 +++--- 12 files changed, 31 insertions(+), 29 deletions(-) diff --git a/indra/newview/llconsole.cpp b/indra/newview/llconsole.cpp index afd1da72e..aeea9d517 100644 --- a/indra/newview/llconsole.cpp +++ b/indra/newview/llconsole.cpp @@ -220,7 +220,7 @@ void LLConsole::draw() S32 const clamped_chat_spacing = llclamp((S32)chat_spacing, -16, 128); if (chat_spacing != clamped_chat_spacing) { - gSavedSettings.setS32("ChatSpacing", clamped_chat_spacing); + chat_spacing = clamped_chat_spacing; } // Adjust spacing. message_spacing += chat_spacing; diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp index 6c9b8cee3..255547933 100644 --- a/indra/newview/llfloaterfriends.cpp +++ b/indra/newview/llfloaterfriends.cpp @@ -430,7 +430,7 @@ BOOL LLPanelFriends::addFriend(const LLUUID& agent_id) BOOL have_name; if (LLAvatarNameCache::get(agent_id, &avatar_name)) { - static LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); + static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); switch (phoenix_name_system) { case 0 : fullname = avatar_name.getLegacyName(); break; @@ -530,7 +530,7 @@ BOOL LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationsh BOOL have_name; if (LLAvatarNameCache::get(agent_id, &avatar_name)) { - static LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); + static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); switch (phoenix_name_system) { case 0 : fullname = avatar_name.getLegacyName(); break; @@ -1045,7 +1045,7 @@ void LLPanelFriends::onClickRemove(void* user_data) if (LLAvatarNameCache::get(agent_id, &avatar_name)) { std::string fullname; - static LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); + static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); switch (phoenix_name_system) { case 0 : fullname = avatar_name.getLegacyName(); break; @@ -1303,7 +1303,7 @@ void LLPanelFriends::confirmModifyRights(rights_map_t& ids, EGrantRevoke command if (LLAvatarNameCache::get(agent_id, &avatar_name)) { std::string fullname; - static LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); + static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); switch (phoenix_name_system) { case 0 : fullname = avatar_name.getLegacyName(); break; diff --git a/indra/newview/llhoverview.cpp b/indra/newview/llhoverview.cpp index 54bd021e4..84a66247c 100644 --- a/indra/newview/llhoverview.cpp +++ b/indra/newview/llhoverview.cpp @@ -272,7 +272,7 @@ void LLHoverView::updateText() LLAvatarName avatar_name; if (LLAvatarNameCache::get(hit_object->getID(), &avatar_name)) { - static LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); + static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); if (phoenix_name_system == 2 || (phoenix_name_system == 1 && avatar_name.mIsDisplayNameDefault)) { complete_name = avatar_name.mDisplayName; @@ -358,7 +358,7 @@ void LLHoverView::updateText() //else if(gCacheName->getFullName(owner, name)) else if (LLAvatarNameCache::get(owner, &avatar_name)) { - static LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); + static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); switch (phoenix_name_system) { case 0 : name = avatar_name.getCompleteName(); break; diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 14a725d80..cdec1ec3e 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -297,8 +297,8 @@ void LLHUDText::renderText(BOOL for_select) LLUIImagePtr imagep = LLUI::getUIImage("rounded_square.tga"); // *TODO: make this a per-text setting - static LLCachedControl background_chat_color("BackgroundChatColor", LLColor4(0,0,0,1.f)); - static LLCachedControl chat_bubble_opacity("ChatBubbleOpacity", .5); + static const LLCachedControl background_chat_color("BackgroundChatColor", LLColor4(0,0,0,1.f)); + static const LLCachedControl chat_bubble_opacity("ChatBubbleOpacity", .5); LLColor4 bg_color = background_chat_color; bg_color.setAlpha(chat_bubble_opacity * alpha_factor); diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 4047dba84..16e85c81b 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -1623,7 +1623,7 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4 if (source.notNull() && LLAvatarNameCache::get(source, &avatar_name)) { - static LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); + static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); switch (phoenix_name_system) { case 0 : show_name = avatar_name.getCompleteName(); break; diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index 501c4a9bf..2ba196273 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -664,12 +664,12 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string LLColor4 LLManip::setupSnapGuideRenderPass(S32 pass) { - static LLColor4 grid_color_fg = gColors.getColor("GridlineColor"); - static LLColor4 grid_color_bg = gColors.getColor("GridlineBGColor"); - static LLColor4 grid_color_shadow = gColors.getColor("GridlineShadowColor"); + static const LLCachedControl grid_color_fg("GridlineColor",LLColor4(1.f,1.f,1.f,.8f)); + static const LLCachedControl grid_color_bg("GridlineBGColor",LLColor4(.9f,.9f,1.f,.8f)); + static const LLCachedControl grid_color_shadow("GridlineShadowColor",LLColor4(0.f,0.f,0.f,.3f)); LLColor4 line_color; - F32 line_alpha = gSavedSettings.getF32("GridOpacity"); + static const LLCachedControl line_alpha("GridOpacity",1.f); switch(pass) { diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index b1cdfe388..47976323e 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -1511,13 +1511,14 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox) void LLManipScale::renderSnapGuides(const LLBBox& bbox) { - if (!gSavedSettings.getBOOL("SnapEnabled")) + static const LLCachedControl snap_enabled("SnapEnabled",false); + if (!snap_enabled) { return; } F32 max_subdivisions = sGridMaxSubdivisionLevel; - F32 grid_alpha = gSavedSettings.getF32("GridOpacity"); + static const LLCachedControl grid_alpha("GridOpacity",1.f); F32 max_point_on_scale_line = partToMaxScale(mManipPart, bbox); LLVector3 drag_point = gAgent.getPosAgentFromGlobal(mDragPointGlobal); diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index ec15d8cb7..74e9637f8 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -1083,13 +1083,14 @@ void LLManipTranslate::render() void LLManipTranslate::renderSnapGuides() { - if (!gSavedSettings.getBOOL("SnapEnabled")) + static const LLCachedControl snap_enabled("SnapEnabled",false); + if (!snap_enabled) { return; } F32 max_subdivisions = sGridMaxSubdivisionLevel;//(F32)gSavedSettings.getS32("GridSubdivision"); - F32 line_alpha = gSavedSettings.getF32("GridOpacity"); + static const LLCachedControl line_alpha("GridOpacity",1.0); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest gls_depth(GL_TRUE); diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 4a40a285e..b8218b581 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -649,7 +649,7 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rec LLAvatarName avatar_name; if (LLAvatarNameCache::get(mClosestAgentToCursor, &avatar_name)) { - static LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); + static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); if (phoenix_name_system == 2 || (phoenix_name_system == 1 && avatar_name.mIsDisplayNameDefault)) { fullname = avatar_name.mDisplayName; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 9a04d3719..350f7200b 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3040,7 +3040,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) LLAvatarName avatar_name; if (LLAvatarNameCache::get(from_id, &avatar_name)) { - static LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); + static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); if (phoenix_name_system == 2 || (phoenix_name_system == 1 && avatar_name.mIsDisplayNameDefault)) { from_name = avatar_name.mDisplayName; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a842f4f12..696a225aa 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3542,10 +3542,10 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) } const F32 time_visible = mTimeVisible.getElapsedTimeF32(); - static LLCachedControl NAME_SHOW_TIME("RenderNameShowTime",10); // seconds - static LLCachedControl FADE_DURATION("RenderNameFadeDuration",1); // seconds - static LLCachedControl use_chat_bubbles("UseChatBubbles",false); - static LLCachedControl render_name_hide_self("RenderNameHideSelf",false); + static const LLCachedControl NAME_SHOW_TIME("RenderNameShowTime",10); // seconds + static const LLCachedControl FADE_DURATION("RenderNameFadeDuration",1); // seconds + static const LLCachedControl use_chat_bubbles("UseChatBubbles",false); + static const LLCachedControl render_name_hide_self("RenderNameHideSelf",false); // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0b bool fRlvShowNames = gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES); // [/RLVa:KB] @@ -3573,7 +3573,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) new_name = TRUE; } - static LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); + static const LLCachedControl phoenix_name_system("PhoenixNameSystem", 0); // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0b if (fRlvShowNames) @@ -3680,7 +3680,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) } } - static LLCachedControl ascent_use_status_colors("AscentUseStatusColors",true); + static const LLCachedControl ascent_use_status_colors("AscentUseStatusColors",true); if (!mIsSelf && ascent_use_status_colors) { LLViewerRegion* parent_estate = LLWorld::getInstance()->getRegionFromPosGlobal(this->getPositionGlobal()); diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 3d52a4a6c..b5481d100 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -350,7 +350,7 @@ BOOL LLVOTree::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) } //it's cheaper to check if wind is enabled first - LLCachedControl render_animate_trees("RenderAnimateTrees",false); + static const LLCachedControl render_animate_trees("RenderAnimateTrees",false); if (gLLWindEnabled && render_animate_trees) { F32 mass_inv; @@ -553,7 +553,7 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable) max_vertices += sLODVertexCount[lod]; } - LLCachedControl render_animate_trees("RenderAnimateTrees",false); + static const LLCachedControl render_animate_trees("RenderAnimateTrees",false); mReferenceBuffer = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, render_animate_trees ? GL_STATIC_DRAW_ARB : 0); mReferenceBuffer->allocateBuffer(max_vertices, max_indices, TRUE); @@ -858,7 +858,7 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable) llassert(index_count == max_indices); } - LLCachedControl render_animate_trees("RenderAnimateTrees",false); + static const LLCachedControl render_animate_trees("RenderAnimateTrees",false); //Ignoring gLLWindEnabled fixes vanishing trees when wind is disabled but anim trees are enabled. //Using an && here is incorrect, and will cause instability. if (/*gLLWindEnabled || */render_animate_trees)