Perfomance tweak in LLToolGun: Don't load the crosshair texture in each frame

meow-7.2.2
Ansariel 2013-04-24 13:10:36 +02:00
parent 23c683ea45
commit cbb8752131
2 changed files with 14 additions and 4 deletions

View File

@ -50,6 +50,8 @@ LLToolGun::LLToolGun( LLToolComposite* composite )
: LLTool( std::string("gun"), composite ),
mIsSelected(FALSE)
{
// <FS:Ansariel> Performance tweak
mCrosshairp = LLUI::getUIImage("crosshairs.tga");
}
void LLToolGun::handleSelect()
@ -146,9 +148,14 @@ void LLToolGun::draw()
static LLCachedControl<bool> showCrosshairs(gSavedSettings, "ShowCrosshairs");
if (showCrosshairs)
{
LLUIImagePtr crosshair = LLUI::getUIImage("crosshairs.tga");
crosshair->draw(
( gViewerWindow->getWorldViewRectScaled().getWidth() - crosshair->getWidth() ) / 2,
( gViewerWindow->getWorldViewRectScaled().getHeight() - crosshair->getHeight() ) / 2);
// <FS:Ansariel> Performance tweak
//LLUIImagePtr crosshair = LLUI::getUIImage("crosshairs.tga");
//crosshair->draw(
// ( gViewerWindow->getWorldViewRectScaled().getWidth() - crosshair->getWidth() ) / 2,
// ( gViewerWindow->getWorldViewRectScaled().getHeight() - crosshair->getHeight() ) / 2);
mCrosshairp->draw(
( gViewerWindow->getWorldViewRectScaled().getWidth() - mCrosshairp->getWidth() ) / 2,
( gViewerWindow->getWorldViewRectScaled().getHeight() - mCrosshairp->getHeight() ) / 2);
// </FS:Ansariel> Performance tweak
}
}

View File

@ -48,6 +48,9 @@ public:
virtual BOOL clipMouseWhenDown() { return FALSE; }
private:
BOOL mIsSelected;
// <FS:Ansariel> Performance tweak
LLUIImagePtr mCrosshairp;
};
#endif