Static'd and or const'd some instances of LLCachedControl.

Converted a few frequently fetched settings to LLCachedControl
This commit is contained in:
Shyotl
2011-02-24 17:27:57 -06:00
parent 6fb8f9bc96
commit 1e85c42bb7
12 changed files with 31 additions and 29 deletions

View File

@@ -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;

View File

@@ -430,7 +430,7 @@ BOOL LLPanelFriends::addFriend(const LLUUID& agent_id)
BOOL have_name;
if (LLAvatarNameCache::get(agent_id, &avatar_name))
{
static LLCachedControl<S32> phoenix_name_system("PhoenixNameSystem", 0);
static const LLCachedControl<S32> 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<S32> phoenix_name_system("PhoenixNameSystem", 0);
static const LLCachedControl<S32> 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<S32> phoenix_name_system("PhoenixNameSystem", 0);
static const LLCachedControl<S32> 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<S32> phoenix_name_system("PhoenixNameSystem", 0);
static const LLCachedControl<S32> phoenix_name_system("PhoenixNameSystem", 0);
switch (phoenix_name_system)
{
case 0 : fullname = avatar_name.getLegacyName(); break;

View File

@@ -272,7 +272,7 @@ void LLHoverView::updateText()
LLAvatarName avatar_name;
if (LLAvatarNameCache::get(hit_object->getID(), &avatar_name))
{
static LLCachedControl<S32> phoenix_name_system("PhoenixNameSystem", 0);
static const LLCachedControl<S32> 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<S32> phoenix_name_system("PhoenixNameSystem", 0);
static const LLCachedControl<S32> phoenix_name_system("PhoenixNameSystem", 0);
switch (phoenix_name_system)
{
case 0 : name = avatar_name.getCompleteName(); break;

View File

@@ -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<LLColor4> background_chat_color("BackgroundChatColor", LLColor4(0,0,0,1.f));
static LLCachedControl<F32> chat_bubble_opacity("ChatBubbleOpacity", .5);
static const LLCachedControl<LLColor4> background_chat_color("BackgroundChatColor", LLColor4(0,0,0,1.f));
static const LLCachedControl<F32> chat_bubble_opacity("ChatBubbleOpacity", .5);
LLColor4 bg_color = background_chat_color;
bg_color.setAlpha(chat_bubble_opacity * alpha_factor);

View File

@@ -1623,7 +1623,7 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4
if (source.notNull() &&
LLAvatarNameCache::get(source, &avatar_name))
{
static LLCachedControl<S32> phoenix_name_system("PhoenixNameSystem", 0);
static const LLCachedControl<S32> phoenix_name_system("PhoenixNameSystem", 0);
switch (phoenix_name_system)
{
case 0 : show_name = avatar_name.getCompleteName(); break;

View File

@@ -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<LLColor4> grid_color_fg("GridlineColor",LLColor4(1.f,1.f,1.f,.8f));
static const LLCachedControl<LLColor4> grid_color_bg("GridlineBGColor",LLColor4(.9f,.9f,1.f,.8f));
static const LLCachedControl<LLColor4> grid_color_shadow("GridlineShadowColor",LLColor4(0.f,0.f,0.f,.3f));
LLColor4 line_color;
F32 line_alpha = gSavedSettings.getF32("GridOpacity");
static const LLCachedControl<F32> line_alpha("GridOpacity",1.f);
switch(pass)
{

View File

@@ -1511,13 +1511,14 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox)
void LLManipScale::renderSnapGuides(const LLBBox& bbox)
{
if (!gSavedSettings.getBOOL("SnapEnabled"))
static const LLCachedControl<bool> snap_enabled("SnapEnabled",false);
if (!snap_enabled)
{
return;
}
F32 max_subdivisions = sGridMaxSubdivisionLevel;
F32 grid_alpha = gSavedSettings.getF32("GridOpacity");
static const LLCachedControl<F32> grid_alpha("GridOpacity",1.f);
F32 max_point_on_scale_line = partToMaxScale(mManipPart, bbox);
LLVector3 drag_point = gAgent.getPosAgentFromGlobal(mDragPointGlobal);

View File

@@ -1083,13 +1083,14 @@ void LLManipTranslate::render()
void LLManipTranslate::renderSnapGuides()
{
if (!gSavedSettings.getBOOL("SnapEnabled"))
static const LLCachedControl<bool> 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<F32> line_alpha("GridOpacity",1.0);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLGLDepthTest gls_depth(GL_TRUE);

View File

@@ -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<S32> phoenix_name_system("PhoenixNameSystem", 0);
static const LLCachedControl<S32> phoenix_name_system("PhoenixNameSystem", 0);
if (phoenix_name_system == 2 || (phoenix_name_system == 1 && avatar_name.mIsDisplayNameDefault))
{
fullname = avatar_name.mDisplayName;

View File

@@ -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<S32> phoenix_name_system("PhoenixNameSystem", 0);
static const LLCachedControl<S32> phoenix_name_system("PhoenixNameSystem", 0);
if (phoenix_name_system == 2 || (phoenix_name_system == 1 && avatar_name.mIsDisplayNameDefault))
{
from_name = avatar_name.mDisplayName;

View File

@@ -3542,10 +3542,10 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
}
const F32 time_visible = mTimeVisible.getElapsedTimeF32();
static LLCachedControl<F32> NAME_SHOW_TIME("RenderNameShowTime",10); // seconds
static LLCachedControl<F32> FADE_DURATION("RenderNameFadeDuration",1); // seconds
static LLCachedControl<bool> use_chat_bubbles("UseChatBubbles",false);
static LLCachedControl<bool> render_name_hide_self("RenderNameHideSelf",false);
static const LLCachedControl<F32> NAME_SHOW_TIME("RenderNameShowTime",10); // seconds
static const LLCachedControl<F32> FADE_DURATION("RenderNameFadeDuration",1); // seconds
static const LLCachedControl<bool> use_chat_bubbles("UseChatBubbles",false);
static const LLCachedControl<bool> 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<S32> phoenix_name_system("PhoenixNameSystem", 0);
static const LLCachedControl<S32> 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<bool> ascent_use_status_colors("AscentUseStatusColors",true);
static const LLCachedControl<bool> ascent_use_status_colors("AscentUseStatusColors",true);
if (!mIsSelf && ascent_use_status_colors)
{
LLViewerRegion* parent_estate = LLWorld::getInstance()->getRegionFromPosGlobal(this->getPositionGlobal());

View File

@@ -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<bool> render_animate_trees("RenderAnimateTrees",false);
static const LLCachedControl<bool> 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<bool> render_animate_trees("RenderAnimateTrees",false);
static const LLCachedControl<bool> 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<bool> render_animate_trees("RenderAnimateTrees",false);
static const LLCachedControl<bool> 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)