From 240a78f7c05898e5d6fe53696fbc9489c5368053 Mon Sep 17 00:00:00 2001 From: Nicky Date: Tue, 26 Mar 2013 20:45:50 +0100 Subject: [PATCH] Reduce calls to LLTrans::getString per frame. --- indra/newview/lllocationinputctrl.cpp | 27 ++++++++++++++++++++++++--- indra/newview/lllocationinputctrl.h | 5 +++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index ed09af498d..583b0afe3c 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -435,6 +435,12 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p) mEditLandmarkTooltip = LLTrans::getString("LocationCtrlEditLandmarkTooltip"); mButton->setToolTip(LLTrans::getString("LocationCtrlComboBtnTooltip")); mInfoBtn->setToolTip(LLTrans::getString("LocationCtrlInfoBtnTooltip")); + + // Prevent querying LLTrans each frame + mTooltips.push_back( LLTrans::getString("LocationCtrlGeneralIconTooltip") ); + mTooltips.push_back( LLTrans::getString("LocationCtrlAdultIconTooltip") ); + mTooltips.push_back( LLTrans::getString("LocationCtrlModerateIconTooltip") ); + // } LLLocationInputCtrl::~LLLocationInputCtrl() @@ -990,17 +996,32 @@ void LLLocationInputCtrl::refreshMaturityButton() { case SIM_ACCESS_PG: rating_image = mIconMaturityGeneral; - rating_tooltip = LLTrans::getString("LocationCtrlGeneralIconTooltip"); + + // Prevent querying LLTrans each frame + // rating_tooltip = LLTrans::getString("LocationCtrlGeneralIconTooltip"); + rating_tooltip = mTooltips[eGeneral]; + // + break; case SIM_ACCESS_ADULT: rating_image = mIconMaturityAdult; - rating_tooltip = LLTrans::getString("LocationCtrlAdultIconTooltip"); + + // Prevent querying LLTrans each frame + // rating_tooltip = LLTrans::getString("LocationCtrlAdultIconTooltip"); + rating_tooltip = mTooltips[eAdult]; + // + break; case SIM_ACCESS_MATURE: rating_image = mIconMaturityModerate; - rating_tooltip = LLTrans::getString("LocationCtrlModerateIconTooltip"); + + // Prevent querying LLTrans each frame + // rating_tooltip = LLTrans::getString("LocationCtrlModerateIconTooltip"); + rating_tooltip = mTooltips[eModerate]; + // + break; default: diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h index b9fd7b7a28..ceebc1ba69 100644 --- a/indra/newview/lllocationinputctrl.h +++ b/indra/newview/lllocationinputctrl.h @@ -209,6 +209,11 @@ private: // Pathfinding rebake functions BOOL rebakeRegionCallback(const LLSD& notification,const LLSD& response); // + + // Prevent querying LLTrans each frame + enum ETooltip{ eGeneral, eAdult, eModerate }; + std::vector< std::string > mTooltips; + // }; #endif