diff options
Diffstat (limited to 'indra/newview/llstatusbar.cpp')
| -rw-r--r-- | indra/newview/llstatusbar.cpp | 34 | 
1 files changed, 34 insertions, 0 deletions
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 2727127633..c456c74f77 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -110,6 +110,7 @@ static void onClickVolume(void*);  LLStatusBar::LLStatusBar(const LLRect& rect)  :   LLPanel(),      mTextTime(NULL), +    mTextFps(NULL),      mSGBandwidth(NULL),      mSGPacketLoss(NULL),      mBtnVolume(NULL), @@ -128,6 +129,8 @@ LLStatusBar::LLStatusBar(const LLRect& rect)      // status bar can possible overlay menus?      setMouseOpaque(false); +    mFpsUpdateTimer = new LLFrameTimer(); +      buildFromFile("panel_status_bar.xml");  } @@ -159,6 +162,9 @@ bool LLStatusBar::postBuild()      mTextTime = getChild<LLTextBox>("TimeText" ); +    mTextFps = getChild<LLButton>("FpsText"); +    mTextFps->setClickedCallback( &LLStatusBar::onClickFps, this ); +      getChild<LLUICtrl>("buyL")->setCommitCallback(          boost::bind(&LLStatusBar::onClickBuyCurrency, this)); @@ -295,6 +301,28 @@ void LLStatusBar::refresh()          //mSGBandwidth->setThreshold(2, bwtotal);      } +    if(mFpsUpdateTimer->getElapsedTimeF32() >= 1.0f) +    { +        mFpsUpdateTimer->reset(); + +        S32 fps = (S32) llround(LLTrace::get_frame_recording().getPeriodMedianPerSec(LLStatViewer::FPS, 50)); +        if(fps < 1) fps = 1; + +        S32 minFps = (S32) llround(LLTrace::get_frame_recording().getPeriodMinPerSec(LLStatViewer::FPS, 50)); +        S32 maxFps = (S32) llround(LLTrace::get_frame_recording().getPeriodMaxPerSec(LLStatViewer::FPS, 50)); + +        F32 fpsQuality = (F32)minFps / (F32)fps; + +        std::string fpsStr = std::to_string(fps); + +        mTextFps->setLabel(fpsStr); + +        if(fpsQuality < 0.5) mTextFps->setColor(LLColor4(0.6,0.0,0.0)); +        else if(fpsQuality < 0.7) mTextFps->setColor(LLColor4(0.7,0.5,0.0)); +        else if(fpsQuality < 0.9) mTextFps->setColor(LLColor4(0.5,0.7,0.0)); +        else mTextFps->setColor(LLColor4(0.0, 0.7, 0.15)); +    } +      // update clock every 10 seconds      if(mClockUpdateTimer.getElapsedTimeF32() > 10.f)      { @@ -667,6 +695,12 @@ void LLStatusBar::onClickMediaToggle(void* data)      LLViewerMedia::getInstance()->setAllMediaPaused(pause);  } +//static +void LLStatusBar::onClickFps(void* data) +{ +    LLFloaterReg::toggleInstance("mpv_performance"); +} +  bool can_afford_transaction(S32 cost)  {      return((cost <= 0)||((gStatusBar) && (gStatusBar->getBalance() >=cost)));  | 
