aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llstatgraph.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/newview/llstatgraph.cpp
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/newview/llstatgraph.cpp')
-rw-r--r--linden/indra/newview/llstatgraph.cpp100
1 files changed, 43 insertions, 57 deletions
diff --git a/linden/indra/newview/llstatgraph.cpp b/linden/indra/newview/llstatgraph.cpp
index 3725228..c9969a2 100644
--- a/linden/indra/newview/llstatgraph.cpp
+++ b/linden/indra/newview/llstatgraph.cpp
@@ -63,75 +63,61 @@ LLStatGraph::LLStatGraph(const std::string& name, const LLRect& rect)
63 mPrecision = 0; 63 mPrecision = 0;
64} 64}
65 65
66EWidgetType LLStatGraph::getWidgetType() const
67{
68 return WIDGET_TYPE_STAT_GRAPH;
69}
70
71LLString LLStatGraph::getWidgetTag() const
72{
73 return LL_STAT_GRAPH_TAG;
74}
75
76void LLStatGraph::draw() 66void LLStatGraph::draw()
77{ 67{
78 if (getVisible()) 68 F32 range, frac;
69 range = mMax - mMin;
70 if (mStatp)
79 { 71 {
80 F32 range, frac; 72 if (mPerSec)
81 range = mMax - mMin;
82 if (mStatp)
83 { 73 {
84 if (mPerSec) 74 mValue = mStatp->getMeanPerSec();
85 {
86 mValue = mStatp->getMeanPerSec();
87 }
88 else
89 {
90 mValue = mStatp->getMean();
91 }
92 } 75 }
93 frac = (mValue - mMin) / range; 76 else
94 frac = llmax(0.f, frac);
95 frac = llmin(1.f, frac);
96
97 if (mUpdateTimer.getElapsedTimeF32() > 0.5f)
98 { 77 {
99 std::string format_str; 78 mValue = mStatp->getMean();
100 std::string tmp_str;
101 format_str = llformat("%%s%%.%df%%s", mPrecision);
102 tmp_str = llformat(format_str.c_str(), mLabel.c_str(), mValue, mUnits.c_str());
103 setToolTip(tmp_str);
104
105 mUpdateTimer.reset();
106 } 79 }
80 }
81 frac = (mValue - mMin) / range;
82 frac = llmax(0.f, frac);
83 frac = llmin(1.f, frac);
107 84
108 LLColor4 color; 85 if (mUpdateTimer.getElapsedTimeF32() > 0.5f)
86 {
87 std::string format_str;
88 std::string tmp_str;
89 format_str = llformat("%%s%%.%df%%s", mPrecision);
90 tmp_str = llformat(format_str.c_str(), mLabel.c_str(), mValue, mUnits.c_str());
91 setToolTip(tmp_str);
92
93 mUpdateTimer.reset();
94 }
109 95
110 S32 i; 96 LLColor4 color;
111 for (i = 0; i < mNumThresholds - 1; i++) 97
98 S32 i;
99 for (i = 0; i < mNumThresholds - 1; i++)
100 {
101 if (mThresholds[i] > mValue)
112 { 102 {
113 if (mThresholds[i] > mValue) 103 break;
114 {
115 break;
116 }
117 } 104 }
118
119 //gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0,
120 // gColors.getColor("ColorDropShadow"),
121 // (S32) gSavedSettings.getF32("DropShadowFloater") );
122
123
124 color = gColors.getColor( "MenuDefaultBgColor" );
125 gGL.color4fv(color.mV);
126 gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, TRUE);
127
128 gGL.color4fv(LLColor4::black.mV);
129 gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, FALSE);
130
131 color = mThresholdColors[i];
132 gGL.color4fv(color.mV);
133 gl_rect_2d(1, llround(frac*getRect().getHeight()), getRect().getWidth() - 1, 0, TRUE);
134 } 105 }
106
107 //gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0,
108 // gColors.getColor("ColorDropShadow"),
109 // (S32) gSavedSettings.getF32("DropShadowFloater") );
110
111 color = gColors.getColor( "MenuDefaultBgColor" );
112 gGL.color4fv(color.mV);
113 gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, TRUE);
114
115 gGL.color4fv(LLColor4::black.mV);
116 gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, FALSE);
117
118 color = mThresholdColors[i];
119 gGL.color4fv(color.mV);
120 gl_rect_2d(1, llround(frac*getRect().getHeight()), getRect().getWidth() - 1, 0, TRUE);
135} 121}
136 122
137void LLStatGraph::setValue(const LLSD& value) 123void LLStatGraph::setValue(const LLSD& value)