summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-08-21 14:06:57 -0700
committerRichard Linden <none@none>2013-08-21 14:06:57 -0700
commit2c6bc5afa59a88136fd6de4ebf0cb99ea7cdef3f (patch)
treec91e15225fc14b0ea753d8188199f8e7f806e7a5 /indra/llui
parent6d9af374066421a1d8465a57795250a1614adcbb (diff)
SH-4433 WIP Interesting: Statistics > Ping Sim is always 0 ms
made getPrimaryAccumulator return a reference since it was an always non-null pointer changed unit conversion to perform lazy division in order to avoid truncation of timer values
Diffstat (limited to 'indra/llui')
-rwxr-xr-xindra/llui/llstatbar.cpp24
-rwxr-xr-xindra/llui/llstatbar.h2
2 files changed, 14 insertions, 12 deletions
diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp
index 03a2895289..8658a2f968 100755
--- a/indra/llui/llstatbar.cpp
+++ b/indra/llui/llstatbar.cpp
@@ -386,17 +386,24 @@ void LLStatBar::draw()
mCurMaxBar = LLSmoothInterpolation::lerp(mCurMaxBar, mMaxBar, 0.05f);
mCurMinBar = LLSmoothInterpolation::lerp(mCurMinBar, mMinBar, 0.05f);
+ S32 decimal_digits = mDecimalDigits;
+ if (is_approx_equal((F32)(S32)display_value, display_value))
+ {
+ decimal_digits = 0;
+ }
+
// rate limited updates
- if (mLastDisplayValueTimer.getElapsedTimeF32() > MEAN_VALUE_UPDATE_TIME)
+ if (mLastDisplayValueTimer.getElapsedTimeF32() < MEAN_VALUE_UPDATE_TIME)
{
- mLastDisplayValueTimer.reset();
- drawLabelAndValue(display_value, unit_label, bar_rect);
- mLastDisplayValue = display_value;
+ display_value = mLastDisplayValue;
}
else
{
- drawLabelAndValue(mLastDisplayValue, unit_label, bar_rect);
+ mLastDisplayValueTimer.reset();
}
+ drawLabelAndValue(display_value, unit_label, bar_rect, mDecimalDigits);
+ mLastDisplayValue = display_value;
+
if (mDisplayBar
&& (mCountFloatp || mEventFloatp || mSampleFloatp))
@@ -568,16 +575,11 @@ LLRect LLStatBar::getRequiredRect()
return rect;
}
-void LLStatBar::drawLabelAndValue( F32 value, std::string &label, LLRect &bar_rect )
+void LLStatBar::drawLabelAndValue( F32 value, std::string &label, LLRect &bar_rect, S32 decimal_digits )
{
LLFontGL::getFontMonospace()->renderUTF8(mLabel, 0, 0, getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, 1.f),
LLFontGL::LEFT, LLFontGL::TOP);
- S32 decimal_digits = mDecimalDigits;
- if (is_approx_equal((F32)(S32)value, value))
- {
- decimal_digits = 0;
- }
std::string value_str = !llisnan(value)
? llformat("%10.*f %s", decimal_digits, value, label.c_str())
: "n/a";
diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h
index bf2bd3e259..f311e4a13c 100755
--- a/indra/llui/llstatbar.h
+++ b/indra/llui/llstatbar.h
@@ -72,7 +72,7 @@ public:
/*virtual*/ LLRect getRequiredRect(); // Return the height of this object, given the set options.
private:
- void drawLabelAndValue( F32 mean, std::string &unit_label, LLRect &bar_rect );
+ void drawLabelAndValue( F32 mean, std::string &unit_label, LLRect &bar_rect, S32 decimal_digits );
void drawTicks( F32 min, F32 max, F32 value_scale, LLRect &bar_rect );
F32 mMinBar,