summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-03-22 00:44:59 -0700
committerRichard Linden <none@none>2013-03-22 00:44:59 -0700
commit68f9f656cd22332e46959a90347e38f79c19a66c (patch)
tree531d87287b69f500c5901f785e60483555b415f9 /indra/llui
parente87000ba0750e55d9d6b55feccc4124f5d2b4b74 (diff)
parent368dd542bec7c31e14673b83d3342c35717d2920 (diff)
merge with viewer-release
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbutton.cpp4
-rw-r--r--indra/llui/llcontainerview.cpp8
-rw-r--r--indra/llui/llcontainerview.h4
-rw-r--r--indra/llui/llfloater.cpp17
-rw-r--r--indra/llui/llfloaterreg.h1
-rw-r--r--indra/llui/lllayoutstack.cpp14
-rw-r--r--indra/llui/lllayoutstack.h19
-rw-r--r--indra/llui/llmenugl.cpp2
-rw-r--r--indra/llui/llmultifloater.h3
-rw-r--r--indra/llui/llnotifications.cpp2
-rw-r--r--indra/llui/llpanel.cpp4
-rw-r--r--indra/llui/llscrollbar.cpp4
-rw-r--r--indra/llui/llscrollbar.h6
-rw-r--r--indra/llui/llscrollcontainer.cpp4
-rw-r--r--indra/llui/llscrollcontainer.h3
-rw-r--r--indra/llui/llslider.h4
-rw-r--r--indra/llui/llstatbar.cpp376
-rw-r--r--indra/llui/llstatbar.h97
-rw-r--r--indra/llui/llstatgraph.cpp102
-rw-r--r--indra/llui/llstatgraph.h101
-rw-r--r--indra/llui/lltabcontainer.cpp2
-rw-r--r--indra/llui/lltextbase.cpp19
-rw-r--r--indra/llui/lltextbase.h15
-rw-r--r--indra/llui/lltoolbar.cpp10
-rw-r--r--indra/llui/lltoolbar.h2
-rw-r--r--indra/llui/llui.cpp54
-rw-r--r--indra/llui/llui.h6
-rw-r--r--indra/llui/lluictrl.cpp21
-rw-r--r--indra/llui/lluictrlfactory.h10
-rw-r--r--indra/llui/lluistring.cpp2
-rw-r--r--indra/llui/llview.cpp12
-rw-r--r--indra/llui/llview.h17
-rw-r--r--indra/llui/llviewmodel.cpp7
-rw-r--r--indra/llui/llviewmodel.h7
-rw-r--r--indra/llui/llxuiparser.cpp16
-rw-r--r--indra/llui/llxuiparser.h18
36 files changed, 682 insertions, 311 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 705fe16559..93ffa7b70d 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -758,11 +758,11 @@ void LLButton::draw()
mCurGlowStrength = lerp(mCurGlowStrength,
mFlashing ? (flash? 1.0 : 0.0)
: mHoverGlowStrength,
- LLCriticalDamp::getInterpolant(0.05f));
+ LLSmoothInterpolation::getInterpolant(0.05f));
}
else
{
- mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f));
+ mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLSmoothInterpolation::getInterpolant(0.05f));
}
// Draw button image, if available.
diff --git a/indra/llui/llcontainerview.cpp b/indra/llui/llcontainerview.cpp
index e08ccb0b78..06f8e72c9c 100644
--- a/indra/llui/llcontainerview.cpp
+++ b/indra/llui/llcontainerview.cpp
@@ -49,7 +49,6 @@ LLContainerView::LLContainerView(const LLContainerView::Params& p)
mLabel(p.label),
mDisplayChildren(p.display_children)
{
- mCollapsible = TRUE;
mScrollContainer = NULL;
}
@@ -75,6 +74,11 @@ bool LLContainerView::addChild(LLView* child, S32 tab_group)
return res;
}
+BOOL LLContainerView::handleDoubleClick(S32 x, S32 y, MASK mask)
+{
+ return handleMouseDown(x, y, mask);
+}
+
BOOL LLContainerView::handleMouseDown(S32 x, S32 y, MASK mask)
{
BOOL handled = FALSE;
@@ -84,7 +88,7 @@ BOOL LLContainerView::handleMouseDown(S32 x, S32 y, MASK mask)
}
if (!handled)
{
- if( mCollapsible && mShowLabel && (y >= getRect().getHeight() - 10) )
+ if( mShowLabel && (y >= getRect().getHeight() - 10) )
{
setDisplayChildren(!mDisplayChildren);
reshape(getRect().getWidth(), getRect().getHeight(), FALSE);
diff --git a/indra/llui/llcontainerview.h b/indra/llui/llcontainerview.h
index e81600fd6c..ac92b19977 100644
--- a/indra/llui/llcontainerview.h
+++ b/indra/llui/llcontainerview.h
@@ -66,6 +66,7 @@ public:
/*virtual*/ BOOL postBuild();
/*virtual*/ bool addChild(LLView* view, S32 tab_group = 0);
+ /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
/*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
/*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
@@ -87,8 +88,5 @@ public:
protected:
BOOL mDisplayChildren;
std::string mLabel;
-public:
- BOOL mCollapsible;
-
};
#endif // LL_CONTAINERVIEW_
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 1594be2512..a29ad12d23 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1119,11 +1119,11 @@ void LLFloater::handleReshape(const LLRect& new_rect, bool by_user)
{
setDocked( false, false);
}
- storeRectControl();
- mPositioning = LLFloaterEnums::POSITIONING_RELATIVE;
- LLRect screen_rect = calcScreenRect();
- mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert();
- }
+ storeRectControl();
+ mPositioning = LLFloaterEnums::POSITIONING_RELATIVE;
+ LLRect screen_rect = calcScreenRect();
+ mPosition = LLCoordGL(screen_rect.getCenterX(), screen_rect.getCenterY()).convert();
+ }
// gather all snapped dependents
for(handle_set_iter_t dependent_it = mDependents.begin();
@@ -1720,7 +1720,7 @@ void LLFloater::onClickHelp( LLFloater* self )
}
}
-// static
+// static
void LLFloater::closeFrontmostFloater()
{
LLFloater* floater_to_close = gFloaterView->getFrontmostClosableFloater();
@@ -3085,7 +3085,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str
parser.readXUI(node, output_params, LLUICtrlFactory::getInstance()->getCurFileName());
setupParamsForExport(output_params, parent);
output_node->setName(node->getName()->mString);
- parser.writeXUI(output_node, output_params, &default_params);
+ parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params);
return TRUE;
}
@@ -3115,9 +3115,8 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str
{
Params output_params(params);
setupParamsForExport(output_params, parent);
- Params default_params(LLUICtrlFactory::getDefaultParams<LLFloater>());
output_node->setName(node->getName()->mString);
- parser.writeXUI(output_node, output_params, &default_params);
+ parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params);
}
// Default floater position to top-left corner of screen
diff --git a/indra/llui/llfloaterreg.h b/indra/llui/llfloaterreg.h
index a1e1f8a988..e3b17dcb4f 100644
--- a/indra/llui/llfloaterreg.h
+++ b/indra/llui/llfloaterreg.h
@@ -30,6 +30,7 @@
#include "llrect.h"
#include "llsd.h"
+#include <list>
#include <boost/function.hpp>
//*******************************************************
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 4c730286da..d4a310b8cf 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -42,12 +42,6 @@ static const F32 MAX_FRACTIONAL_SIZE = 1.f;
static LLDefaultChildRegistry::Register<LLLayoutStack> register_layout_stack("layout_stack");
static LLLayoutStack::LayoutStackRegistry::Register<LLLayoutPanel> register_layout_panel("layout_panel");
-void LLLayoutStack::OrientationNames::declareValues()
-{
- declare("horizontal", HORIZONTAL);
- declare("vertical", VERTICAL);
-}
-
//
// LLLayoutPanel
//
@@ -141,7 +135,7 @@ S32 LLLayoutPanel::getVisibleDim() const
+ (((F32)mTargetDim - min_dim) * (1.f - mCollapseAmt))));
}
-void LLLayoutPanel::setOrientation( LLLayoutStack::ELayoutOrientation orientation )
+void LLLayoutPanel::setOrientation( LLView::EOrientation orientation )
{
mOrientation = orientation;
S32 layout_dim = llround((F32)((mOrientation == LLLayoutStack::HORIZONTAL)
@@ -592,7 +586,7 @@ bool LLLayoutStack::animatePanels()
{
if (!mAnimatedThisFrame)
{
- panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(mOpenTimeConstant));
+ panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 1.f, LLSmoothInterpolation::getInterpolant(mOpenTimeConstant));
if (panelp->mVisibleAmt > 0.99f)
{
panelp->mVisibleAmt = 1.f;
@@ -617,7 +611,7 @@ bool LLLayoutStack::animatePanels()
{
if (!mAnimatedThisFrame)
{
- panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
+ panelp->mVisibleAmt = lerp(panelp->mVisibleAmt, 0.f, LLSmoothInterpolation::getInterpolant(mCloseTimeConstant));
if (panelp->mVisibleAmt < 0.001f)
{
panelp->mVisibleAmt = 0.f;
@@ -644,7 +638,7 @@ bool LLLayoutStack::animatePanels()
{
if (!mAnimatedThisFrame)
{
- panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLCriticalDamp::getInterpolant(mCloseTimeConstant));
+ panelp->mCollapseAmt = lerp(panelp->mCollapseAmt, collapse_state, LLSmoothInterpolation::getInterpolant(mCloseTimeConstant));
}
if (llabs(panelp->mCollapseAmt - collapse_state) < 0.001f)
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index 648cd5fdce..f1668d7473 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -37,24 +37,13 @@ class LLLayoutPanel;
class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
{
public:
- typedef enum e_layout_orientation
- {
- HORIZONTAL,
- VERTICAL
- } ELayoutOrientation;
-
- struct OrientationNames
- : public LLInitParam::TypeValuesHelper<ELayoutOrientation, OrientationNames>
- {
- static void declareValues();
- };
struct LayoutStackRegistry : public LLChildRegistry<LayoutStackRegistry>
{};
struct Params : public LLInitParam::Block<Params, LLView::Params>
{
- Mandatory<ELayoutOrientation, OrientationNames> orientation;
+ Mandatory<EOrientation> orientation;
Optional<S32> border_size;
Optional<bool> animate,
clip;
@@ -104,7 +93,7 @@ private:
bool animatePanels();
void createResizeBar(LLLayoutPanel* panel);
- const ELayoutOrientation mOrientation;
+ const EOrientation mOrientation;
typedef std::vector<LLLayoutPanel*> e_panel_list_t;
e_panel_list_t mPanels;
@@ -179,7 +168,7 @@ public:
F32 getVisibleAmount() const;
S32 getVisibleDim() const;
- void setOrientation(LLLayoutStack::ELayoutOrientation orientation);
+ void setOrientation(LLView::EOrientation orientation);
void storeOriginalDim();
void setIgnoreReshape(bool ignore) { mIgnoreReshape = ignore; }
@@ -198,7 +187,7 @@ protected:
F32 mFractionalSize;
S32 mTargetDim;
bool mIgnoreReshape;
- LLLayoutStack::ELayoutOrientation mOrientation;
+ LLView::EOrientation mOrientation;
class LLResizeBar* mResizeBar;
};
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index cd6cc6a75e..13888920f9 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -3673,7 +3673,7 @@ void LLTearOffMenu::draw()
if (getRect().getHeight() != mTargetHeight)
{
// animate towards target height
- reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLCriticalDamp::getInterpolant(0.05f))));
+ reshape(getRect().getWidth(), llceil(lerp((F32)getRect().getHeight(), mTargetHeight, LLSmoothInterpolation::getInterpolant(0.05f))));
}
LLFloater::draw();
}
diff --git a/indra/llui/llmultifloater.h b/indra/llui/llmultifloater.h
index 9fa917eca1..6c97f80e31 100644
--- a/indra/llui/llmultifloater.h
+++ b/indra/llui/llmultifloater.h
@@ -96,6 +96,3 @@ protected:
};
#endif // LL_MULTI_FLOATER_H
-
-
-
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 2bf88532c6..269cb4676a 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -464,7 +464,7 @@ LLNotification::LLNotification(const LLNotification::Params& p) :
mTimestamp(p.time_stamp),
mSubstitutions(p.substitutions),
mPayload(p.payload),
- mExpiresAt(0),
+ mExpiresAt(0.0),
mTemporaryResponder(false),
mRespondedTo(false),
mPriority(p.priority),
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 67472ad166..188a0fea74 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -520,7 +520,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
Params output_params(params);
setupParamsForExport(output_params, parent);
output_node->setName(node->getName()->mString);
- parser.writeXUI(output_node, output_params, &default_params);
+ parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params);
return TRUE;
}
@@ -551,7 +551,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
Params output_params(params);
setupParamsForExport(output_params, parent);
output_node->setName(node->getName()->mString);
- parser.writeXUI(output_node, output_params, &default_params);
+ parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params);
}
params.from_xui = true;
diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp
index 5d3bf7a670..92a80c73fe 100644
--- a/indra/llui/llscrollbar.cpp
+++ b/indra/llui/llscrollbar.cpp
@@ -493,11 +493,11 @@ void LLScrollbar::draw()
BOOL hovered = getEnabled() && !other_captor && (hasMouseCapture() || mThumbRect.pointInRect(local_mouse_x, local_mouse_y));
if (hovered)
{
- mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(0.05f));
+ mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLSmoothInterpolation::getInterpolant(0.05f));
}
else
{
- mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLCriticalDamp::getInterpolant(0.05f));
+ mCurGlowStrength = lerp(mCurGlowStrength, 0.f, LLSmoothInterpolation::getInterpolant(0.05f));
}
// Draw background and thumb.
diff --git a/indra/llui/llscrollbar.h b/indra/llui/llscrollbar.h
index ff74f753b9..3f3ca1378b 100644
--- a/indra/llui/llscrollbar.h
+++ b/indra/llui/llscrollbar.h
@@ -40,13 +40,11 @@ class LLScrollbar
{
public:
- enum ORIENTATION { HORIZONTAL, VERTICAL };
-
typedef boost::function<void (S32, LLScrollbar*)> callback_t;
struct Params
: public LLInitParam::Block<Params, LLUICtrl::Params>
{
- Mandatory<ORIENTATION> orientation;
+ Mandatory<EOrientation> orientation;
Mandatory<S32> doc_size;
Mandatory<S32> doc_pos;
Mandatory<S32> page_size;
@@ -131,7 +129,7 @@ private:
callback_t mChangeCallback;
- const ORIENTATION mOrientation;
+ const EOrientation mOrientation;
S32 mDocSize; // Size of the document that the scrollbar is modeling. Units depend on the user. 0 <= mDocSize.
S32 mDocPos; // Position within the doc that the scrollbar is modeling, in "lines" (user size)
S32 mPageSize; // Maximum number of lines that can be seen at one time.
diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp
index 2fd187a526..2abfb15494 100644
--- a/indra/llui/llscrollcontainer.cpp
+++ b/indra/llui/llscrollcontainer.cpp
@@ -140,7 +140,7 @@ LLScrollContainer::~LLScrollContainer( void )
{
// mScrolledView and mScrollbar are child views, so the LLView
// destructor takes care of memory deallocation.
- for( S32 i = 0; i < SCROLLBAR_COUNT; i++ )
+ for( S32 i = 0; i < ORIENTATION_COUNT; i++ )
{
mScrollbar[i] = NULL;
}
@@ -211,7 +211,7 @@ BOOL LLScrollContainer::handleKeyHere(KEY key, MASK mask)
{
return TRUE;
}
- for( S32 i = 0; i < SCROLLBAR_COUNT; i++ )
+ for( S32 i = 0; i < ORIENTATION_COUNT; i++ )
{
if( mScrollbar[i]->handleKeyHere(key, mask) )
{
diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h
index d87c95b3d7..f9ce4a74ef 100644
--- a/indra/llui/llscrollcontainer.h
+++ b/indra/llui/llscrollcontainer.h
@@ -56,7 +56,6 @@ class LLScrollContainer : public LLUICtrl
public:
// Note: vertical comes before horizontal because vertical
// scrollbars have priority for mouse and keyboard events.
- enum SCROLL_ORIENTATION { VERTICAL, HORIZONTAL, SCROLLBAR_COUNT };
struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
{
@@ -126,7 +125,7 @@ private:
void updateScroll();
void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const;
- LLScrollbar* mScrollbar[SCROLLBAR_COUNT];
+ LLScrollbar* mScrollbar[ORIENTATION_COUNT];
S32 mSize;
BOOL mIsOpaque;
LLUIColor mBackgroundColor;
diff --git a/indra/llui/llslider.h b/indra/llui/llslider.h
index 700c17ea3e..3b492d8182 100644
--- a/indra/llui/llslider.h
+++ b/indra/llui/llslider.h
@@ -34,8 +34,6 @@
class LLSlider : public LLF32UICtrl
{
public:
- enum ORIENTATION { HORIZONTAL, VERTICAL };
-
struct Params : public LLInitParam::Block<Params, LLF32UICtrl::Params>
{
Optional<std::string> orientation;
@@ -98,7 +96,7 @@ private:
LLPointer<LLUIImage> mTrackHighlightHorizontalImage;
LLPointer<LLUIImage> mTrackHighlightVerticalImage;
- const ORIENTATION mOrientation;
+ const EOrientation mOrientation;
LLRect mThumbRect;
LLUIColor mTrackColor;
diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp
index 04cce7878e..cda40aac72 100644
--- a/indra/llui/llstatbar.cpp
+++ b/indra/llui/llstatbar.cpp
@@ -34,8 +34,9 @@
#include "llgl.h"
#include "llfontgl.h"
-#include "llstat.h"
#include "lluictrlfactory.h"
+#include "lltracerecording.h"
+#include "llcriticaldamp.h"
///////////////////////////////////////////////////////////////////////////////////
@@ -45,17 +46,25 @@ LLStatBar::LLStatBar(const Params& p)
mUnitLabel(p.unit_label),
mMinBar(p.bar_min),
mMaxBar(p.bar_max),
- mStatp(LLStat::getStat(p.stat)),
+ mCurMaxBar(p.bar_max),
+ mCountFloatp(LLTrace::CountStatHandle<>::getInstance(p.stat)),
+ mCountIntp(LLTrace::CountStatHandle<S64>::getInstance(p.stat)),
+ mMeasurementFloatp(LLTrace::MeasurementStatHandle<>::getInstance(p.stat)),
+ mMeasurementIntp(LLTrace::MeasurementStatHandle<S64>::getInstance(p.stat)),
mTickSpacing(p.tick_spacing),
mLabelSpacing(p.label_spacing),
mPrecision(p.precision),
mUpdatesPerSec(p.update_rate),
+ mUnitScale(p.unit_scale),
+ mNumFrames(p.num_frames),
+ mMaxHeight(p.max_height),
mPerSec(p.show_per_sec),
mDisplayBar(p.show_bar),
mDisplayHistory(p.show_history),
- mDisplayMean(p.show_mean)
-{
-}
+ mDisplayMean(p.show_mean),
+ mOrientation(p.orientation),
+ mScaleRange(p.scale_range)
+{}
BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask)
{
@@ -79,34 +88,84 @@ BOOL LLStatBar::handleMouseDown(S32 x, S32 y, MASK mask)
LLView* parent = getParent();
parent->reshape(parent->getRect().getWidth(), parent->getRect().getHeight(), FALSE);
- return FALSE;
+ return TRUE;
}
void LLStatBar::draw()
{
- if (!mStatp)
+ F32 current = 0.f,
+ min = 0.f,
+ max = 0.f,
+ mean = 0.f;
+
+ S32 num_samples = 0;
+ LLTrace::PeriodicRecording& frame_recording = LLTrace::get_frame_recording();
+
+ if (mCountFloatp)
{
-// llinfos << "No stats for statistics bar!" << llendl;
- return;
+ LLTrace::Recording& last_frame_recording = frame_recording.getLastRecordingPeriod();
+
+ if (mPerSec)
+ {
+ current = last_frame_recording.getPerSec(*mCountFloatp);
+ min = frame_recording.getPeriodMinPerSec(*mCountFloatp);
+ max = frame_recording.getPeriodMaxPerSec(*mCountFloatp);
+ mean = frame_recording.getPeriodMeanPerSec(*mCountFloatp);
+ num_samples = frame_recording.getTotalRecording().getSampleCount(*mCountFloatp);
+ }
+ else
+ {
+ current = last_frame_recording.getSum(*mCountFloatp);
+ min = frame_recording.getPeriodMin(*mCountFloatp);
+ max = frame_recording.getPeriodMax(*mCountFloatp);
+ mean = frame_recording.getPeriodMean(*mCountFloatp);
+ num_samples = frame_recording.getTotalRecording().getSampleCount(*mCountFloatp);
+ }
}
+ else if (mCountIntp)
+ {
+ LLTrace::Recording& last_frame_recording = frame_recording.getLastRecordingPeriod();
- // Get the values.
- F32 current, min, max, mean;
- if (mPerSec)
+ if (mPerSec)
+ {
+ current = last_frame_recording.getPerSec(*mCountIntp);
+ min = frame_recording.getPeriodMinPerSec(*mCountIntp);
+ max = frame_recording.getPeriodMaxPerSec(*mCountIntp);
+ mean = frame_recording.getPeriodMeanPerSec(*mCountIntp);
+ num_samples = frame_recording.getTotalRecording().getSampleCount(*mCountIntp);
+ }
+ else
+ {
+ current = last_frame_recording.getSum(*mCountIntp);
+ min = frame_recording.getPeriodMin(*mCountIntp);
+ max = frame_recording.getPeriodMax(*mCountIntp);
+ mean = frame_recording.getPeriodMean(*mCountIntp);
+ num_samples = frame_recording.getTotalRecording().getSampleCount(*mCountIntp);
+ }
+ }
+ else if (mMeasurementFloatp)
{
- current = mStatp->getCurrentPerSec();
- min = mStatp->getMinPerSec();
- max = mStatp->getMaxPerSec();
- mean = mStatp->getMeanPerSec();
+ LLTrace::Recording& recording = frame_recording.getTotalRecording();
+ current = recording.getLastValue(*mMeasurementFloatp);
+ min = recording.getMin(*mMeasurementFloatp);
+ max = recording.getMax(*mMeasurementFloatp);
+ mean = recording.getMean(*mMeasurementFloatp);
+ num_samples = frame_recording.getTotalRecording().getSampleCount(*mMeasurementFloatp);
}
- else
+ else if (mMeasurementIntp)
{
- current = mStatp->getCurrent();
- min = mStatp->getMin();
- max = mStatp->getMax();
- mean = mStatp->getMean();
+ LLTrace::Recording& recording = frame_recording.getTotalRecording();
+ current = recording.getLastValue(*mMeasurementIntp);
+ min = recording.getMin(*mMeasurementIntp);
+ max = recording.getMax(*mMeasurementIntp);
+ mean = recording.getMean(*mMeasurementIntp);
+ num_samples = frame_recording.getTotalRecording().getSampleCount(*mMeasurementIntp);
}
+ current *= mUnitScale;
+ min *= mUnitScale;
+ max *= mUnitScale;
+ mean *= mUnitScale;
if ((mUpdatesPerSec == 0.f) || (mUpdateTimer.getElapsedTimeF32() > 1.f/mUpdatesPerSec) || (mValue == 0.f))
{
@@ -121,15 +180,41 @@ void LLStatBar::draw()
mUpdateTimer.reset();
}
- S32 width = getRect().getWidth() - 40;
- S32 max_width = width;
- S32 bar_top = getRect().getHeight() - 15; // 16 pixels from top.
- S32 bar_height = bar_top - 20;
- S32 tick_height = 4;
- S32 tick_width = 1;
- S32 left, top, right, bottom;
+ S32 bar_top, bar_left, bar_right, bar_bottom;
+ if (mOrientation == HORIZONTAL)
+ {
+ bar_top = llmax(5, getRect().getHeight() - 15);
+ bar_left = 0;
+ bar_right = getRect().getWidth() - 40;
+ bar_bottom = llmin(bar_top - 5, 0);
+ }
+ else // VERTICAL
+ {
+ bar_top = llmax(5, getRect().getHeight() - 15);
+ bar_left = 0;
+ bar_right = getRect().getWidth();
+ bar_bottom = llmin(bar_top - 5, 20);
+ }
+ const S32 tick_length = 4;
+ const S32 tick_width = 1;
+
+ if (mScaleRange && num_samples)
+ {
+ F32 cur_max = mLabelSpacing;
+ while(max > cur_max)
+ {
+ cur_max += mLabelSpacing;
+ }
+ mCurMaxBar = LLSmoothInterpolation::lerp(mCurMaxBar, cur_max, 0.05f);
+ }
+ else
+ {
+ mCurMaxBar = mMaxBar;
+ }
- F32 value_scale = max_width/(mMaxBar - mMinBar);
+ F32 value_scale = (mOrientation == HORIZONTAL)
+ ? (bar_top - bar_bottom)/(mCurMaxBar - mMinBar)
+ : (bar_right - bar_left)/(mCurMaxBar - mMinBar);
LLFontGL::getFontMonospace()->renderUTF8(mLabel, 0, 0, getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, 1.f),
LLFontGL::LEFT, LLFontGL::TOP);
@@ -148,114 +233,230 @@ void LLStatBar::draw()
}
// Draw the value.
- LLFontGL::getFontMonospace()->renderUTF8(value_str, 0, width, getRect().getHeight(),
- LLColor4(1.f, 1.f, 1.f, 0.5f),
- LLFontGL::RIGHT, LLFontGL::TOP);
+ if (mOrientation == HORIZONTAL)
+ {
+ LLFontGL::getFontMonospace()->renderUTF8(value_str, 0, bar_right, getRect().getHeight(),
+ LLColor4(1.f, 1.f, 1.f, 0.5f),
+ LLFontGL::RIGHT, LLFontGL::TOP);
+ }
+ else
+ {
+ LLFontGL::getFontMonospace()->renderUTF8(value_str, 0, bar_right, getRect().getHeight(),
+ LLColor4(1.f, 1.f, 1.f, 0.5f),
+ LLFontGL::RIGHT, LLFontGL::TOP);
+ }
value_format = llformat( "%%.%df", mPrecision);
- if (mDisplayBar)
+ if (mDisplayBar && (mCountFloatp || mCountIntp || mMeasurementFloatp || mMeasurementIntp))
{
std::string tick_label;
// Draw the tick marks.
- F32 tick_value;
- top = bar_top;
- bottom = bar_top - bar_height - tick_height/2;
-
LLGLSUIDefault gls_ui;
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- for (tick_value = mMinBar; tick_value <= mMaxBar; tick_value += mTickSpacing)
+ for (F32 tick_value = mMinBar + mLabelSpacing; tick_value <= mCurMaxBar; tick_value += mTickSpacing)
{
- left = llfloor((tick_value - mMinBar)*value_scale);
- right = left + tick_width;
- gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 1.f, 1.f, 0.1f));
+ const S32 begin = llfloor((tick_value - mMinBar)*value_scale);
+ const S32 end = begin + tick_width;
+ if (mOrientation == HORIZONTAL)
+ {
+ gl_rect_2d(bar_left, end, bar_right - tick_length/2, begin, LLColor4(1.f, 1.f, 1.f, 0.1f));
+ }
+ else
+ {
+ gl_rect_2d(begin, bar_top, end, bar_bottom - tick_length/2, LLColor4(1.f, 1.f, 1.f, 0.1f));
+ }
}
// Draw the tick labels (and big ticks).
- bottom = bar_top - bar_height - tick_height;
- for (tick_value = mMinBar; tick_value <= mMaxBar; tick_value += mLabelSpacing)
+ for (F32 tick_value = mMinBar + mLabelSpacing; tick_value <= mCurMaxBar; tick_value += mLabelSpacing)
{
- left = llfloor((tick_value - mMinBar)*value_scale);
- right = left + tick_width;
- gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 1.f, 1.f, 0.25f));
-
+ const S32 begin = llfloor((tick_value - mMinBar)*value_scale);
+ const S32 end = begin + tick_width;
tick_label = llformat( value_format.c_str(), tick_value);
+
// draw labels for the tick marks
- LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, left - 1, bar_top - bar_height - tick_height,
- LLColor4(1.f, 1.f, 1.f, 0.5f),
- LLFontGL::LEFT, LLFontGL::TOP);
+ if (mOrientation == HORIZONTAL)
+ {
+ gl_rect_2d(bar_left, end, bar_right - tick_length, begin, LLColor4(1.f, 1.f, 1.f, 0.25f));
+ LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, bar_right, begin,
+ LLColor4(1.f, 1.f, 1.f, 0.5f),
+ LLFontGL::LEFT, LLFontGL::VCENTER);
+ }
+ else
+ {
+ gl_rect_2d(begin, bar_top, end, bar_bottom - tick_length, LLColor4(1.f, 1.f, 1.f, 0.25f));
+ LLFontGL::getFontMonospace()->renderUTF8(tick_label, 0, begin - 1, bar_bottom - tick_length,
+ LLColor4(1.f, 1.f, 1.f, 0.5f),
+ LLFontGL::RIGHT, LLFontGL::TOP);
+ }
}
- // Now, draw the bars
- top = bar_top;
- bottom = bar_top - bar_height;
-
// draw background bar.
- left = 0;
- right = width;
- gl_rect_2d(left, top, right, bottom, LLColor4(0.f, 0.f, 0.f, 0.25f));
+ gl_rect_2d(bar_left, bar_top, bar_right, bar_bottom, LLColor4(0.f, 0.f, 0.f, 0.25f));
- if (mStatp->getNumValues() == 0)
+ if (frame_recording.getNumPeriods() == 0)
{
// No data, don't draw anything...
return;
}
+
// draw min and max
- left = (S32) ((min - mMinBar) * value_scale);
+ S32 begin = (S32) ((min - mMinBar) * value_scale);
- if (left < 0)
+ if (begin < 0)
{
- left = 0;
+ begin = 0;
llwarns << "Min:" << min << llendl;
}
- right = (S32) ((max - mMinBar) * value_scale);
- gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 0.f, 0.f, 0.25f));
+ S32 end = (S32) ((max - mMinBar) * value_scale);
+ if (mOrientation == HORIZONTAL)
+ {
+ gl_rect_2d(bar_left, end, bar_right, begin, LLColor4(1.f, 0.f, 0.f, 0.25f));
+ }
+ else // VERTICAL
+ {
+ gl_rect_2d(begin, bar_top, end, bar_bottom, LLColor4(1.f, 0.f, 0.f, 0.25f));
+ }
+
+ F32 span = (mOrientation == HORIZONTAL)
+ ? (bar_right - bar_left)
+ : (bar_top - bar_bottom);
- S32 num_values = mStatp->getNumValues() - 1;
- if (mDisplayHistory)
+ if (mDisplayHistory && (mCountFloatp || mCountIntp || mMeasurementFloatp || mMeasurementIntp))
{
+ const S32 num_values = frame_recording.getNumPeriods() - 1;
+ F32 begin = 0;
+ F32 end = 0;
S32 i;
- for (i = 0; i < num_values; i++)
+ gGL.color4f( 1.f, 0.f, 0.f, 1.f );
+ gGL.begin( LLRender::QUADS );
+ const S32 max_frame = llmin(mNumFrames, num_values);
+ U32 num_samples = 0;
+ for (i = 1; i <= max_frame; i++)
{
- if (i == mStatp->getNextBin())
+ F32 offset = ((F32)i / (F32)mNumFrames) * span;
+ LLTrace::Recording& recording = frame_recording.getPrevRecordingPeriod(i);
+ if (mPerSec)
{
- continue;
+ if (mCountFloatp)
+ {
+ begin = ((recording.getPerSec(*mCountFloatp) - mMinBar) * value_scale);
+ end = ((recording.getPerSec(*mCountFloatp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mCountFloatp);
+ }
+ else if (mCountIntp)
+ {
+ begin = ((recording.getPerSec(*mCountIntp) - mMinBar) * value_scale);
+ end = ((recording.getPerSec(*mCountIntp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mCountIntp);
+ }
+ else if (mMeasurementFloatp)
+ {
+ //rate isn't defined for measurement stats, so use mean
+ begin = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale);
+ end = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mMeasurementFloatp);
+ }
+ else if (mMeasurementIntp)
+ {
+ //rate isn't defined for measurement stats, so use mean
+ begin = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale);
+ end = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mMeasurementIntp);
+ }
}
- if (mPerSec)
+ else
{
- left = (S32)((mStatp->getPrevPerSec(i) - mMinBar) * value_scale);
- right = (S32)((mStatp->getPrevPerSec(i) - mMinBar) * value_scale) + 1;
- gl_rect_2d(left, bottom+i+1, right, bottom+i, LLColor4(1.f, 0.f, 0.f, 1.f));
+ if (mCountFloatp)
+ {
+ begin = ((recording.getSum(*mCountFloatp) - mMinBar) * value_scale);
+ end = ((recording.getSum(*mCountFloatp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mCountFloatp);
+ }
+ else if (mCountIntp)
+ {
+ begin = ((recording.getSum(*mCountIntp) - mMinBar) * value_scale);
+ end = ((recording.getSum(*mCountIntp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mCountIntp);
+ }
+ else if (mMeasurementFloatp)
+ {
+ begin = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale);
+ end = ((recording.getMean(*mMeasurementFloatp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mMeasurementFloatp);
+ }
+ else if (mMeasurementIntp)
+ {
+ begin = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale);
+ end = ((recording.getMean(*mMeasurementIntp) - mMinBar) * value_scale) + 1;
+ num_samples = recording.getSampleCount(*mMeasurementIntp);
+ }
+ }
+
+ if (!num_samples) continue;
+
+ if (mOrientation == HORIZONTAL)
+ {
+ gGL.vertex2f((F32)bar_right - offset, end);
+ gGL.vertex2f((F32)bar_right - offset, begin);
+ gGL.vertex2f((F32)bar_right - offset - 1.f, begin);
+ gGL.vertex2f((F32)bar_right - offset - 1.f, end);
}
else
{
- left = (S32)((mStatp->getPrev(i) - mMinBar) * value_scale);
- right = (S32)((mStatp->getPrev(i) - mMinBar) * value_scale) + 1;
- gl_rect_2d(left, bottom+i+1, right, bottom+i, LLColor4(1.f, 0.f, 0.f, 1.f));
+ gGL.vertex2i(begin, (F32)bar_bottom+offset+1.f);
+ gGL.vertex2i(begin, (F32)bar_bottom+offset);
+ gGL.vertex2i(end, (F32)bar_bottom+offset);
+ gGL.vertex2i(end, (F32)bar_bottom+offset+1.f);
}
}
+ gGL.end();
}
else
{
+ S32 begin = (S32) ((current - mMinBar) * value_scale) - 1;
+ S32 end = (S32) ((current - mMinBar) * value_scale) + 1;
// draw current
- left = (S32) ((current - mMinBar) * value_scale) - 1;
- right = (S32) ((current - mMinBar) * value_scale) + 1;
- gl_rect_2d(left, top, right, bottom, LLColor4(1.f, 0.f, 0.f, 1.f));
+ if (mOrientation == HORIZONTAL)
+ {
+ gl_rect_2d(bar_left, end, bar_right, begin, LLColor4(1.f, 0.f, 0.f, 1.f));
+ }
+ else
+ {
+ gl_rect_2d(begin, bar_top, end, bar_bottom, LLColor4(1.f, 0.f, 0.f, 1.f));
+ }
}
// draw mean bar
- top = bar_top + 2;
- bottom = bar_top - bar_height - 2;
- left = (S32) ((mean - mMinBar) * value_scale) - 1;
- right = (S32) ((mean - mMinBar) * value_scale) + 1;
- gl_rect_2d(left, top, right, bottom, LLColor4(0.f, 1.f, 0.f, 1.f));
+ {
+ const S32 begin = (S32) ((mean - mMinBar) * value_scale) - 1;
+ const S32 end = (S32) ((mean - mMinBar) * value_scale) + 1;
+ if (mOrientation == HORIZONTAL)
+ {
+ gl_rect_2d(bar_left - 2, begin, bar_right + 2, end, LLColor4(0.f, 1.f, 0.f, 1.f));
+ }
+ else
+ {
+ gl_rect_2d(begin, bar_top + 2, end, bar_bottom - 2, LLColor4(0.f, 1.f, 0.f, 1.f));
+ }
+ }
}
LLView::draw();
}
+void LLStatBar::setStat(const std::string& stat_name)
+{
+ mCountFloatp = LLTrace::CountStatHandle<>::getInstance(stat_name);
+ mCountIntp = LLTrace::CountStatHandle<S64>::getInstance(stat_name);
+ mMeasurementFloatp = LLTrace::MeasurementStatHandle<>::getInstance(stat_name);
+ mMeasurementIntp = LLTrace::MeasurementStatHandle<S64>::getInstance(stat_name);
+}
+
+
void LLStatBar::setRange(F32 bar_min, F32 bar_max, F32 tick_spacing, F32 label_spacing)
{
mMinBar = bar_min;
@@ -272,7 +473,14 @@ LLRect LLStatBar::getRequiredRect()
{
if (mDisplayHistory)
{
- rect.mTop = 35 + mStatp->getNumBins();
+ if (mOrientation == HORIZONTAL)
+ {
+ rect.mTop = mMaxHeight;
+ }
+ else
+ {
+ rect.mTop = 35 + llmin(mMaxHeight, llmin(mNumFrames, (S32)LLTrace::get_frame_recording().getNumPeriods()));
+ }
}
else
{
diff --git a/indra/llui/llstatbar.h b/indra/llui/llstatbar.h
index 513fff3234..74a3ebde2f 100644
--- a/indra/llui/llstatbar.h
+++ b/indra/llui/llstatbar.h
@@ -29,27 +29,37 @@
#include "llview.h"
#include "llframetimer.h"
-
-class LLStat;
+#include "lltracerecording.h"
class LLStatBar : public LLView
{
public:
+
struct Params : public LLInitParam::Block<Params, LLView::Params>
{
- Optional<std::string> label;
- Optional<std::string> unit_label;
- Optional<F32> bar_min;
- Optional<F32> bar_max;
- Optional<F32> tick_spacing;
- Optional<F32> label_spacing;
- Optional<U32> precision;
- Optional<F32> update_rate;
- Optional<bool> show_per_sec;
- Optional<bool> show_bar;
- Optional<bool> show_history;
- Optional<bool> show_mean;
- Optional<std::string> stat;
+ Optional<std::string> label,
+ unit_label;
+
+ Optional<F32> bar_min,
+ bar_max,
+ tick_spacing,
+ label_spacing,
+ update_rate,
+ unit_scale;
+
+ Optional<U32> precision;
+
+ Optional<bool> show_per_sec,
+ show_bar,
+ show_history,
+ show_mean,
+ scale_range;
+
+ Optional<S32> num_frames,
+ max_height;
+ Optional<std::string> stat;
+ Optional<EOrientation> orientation;
+
Params()
: label("label"),
unit_label("unit_label"),
@@ -59,11 +69,16 @@ public:
label_spacing("label_spacing", 10.0f),
precision("precision", 0),
update_rate("update_rate", 5.0f),
- show_per_sec("show_per_sec", TRUE),
- show_bar("show_bar", TRUE),
- show_history("show_history", FALSE),
- show_mean("show_mean", TRUE),
- stat("stat")
+ unit_scale("unit_scale", 1.f),
+ show_per_sec("show_per_sec", true),
+ show_bar("show_bar", true),
+ show_history("show_history", false),
+ show_mean("show_mean", true),
+ scale_range("scale_range", true),
+ num_frames("num_frames", 300),
+ max_height("max_height", 200),
+ stat("stat"),
+ orientation("orientation", VERTICAL)
{
changeDefault(follows.flags, FOLLOWS_TOP | FOLLOWS_LEFT);
}
@@ -73,30 +88,40 @@ public:
virtual void draw();
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
- void setStat(LLStat* stat) { mStatp = stat; }
+ void setStat(const std::string& stat_name);
+
void setRange(F32 bar_min, F32 bar_max, F32 tick_spacing, F32 label_spacing);
void getRange(F32& bar_min, F32& bar_max) { bar_min = mMinBar; bar_max = mMaxBar; }
/*virtual*/ LLRect getRequiredRect(); // Return the height of this object, given the set options.
private:
- F32 mMinBar;
- F32 mMaxBar;
- F32 mTickSpacing;
- F32 mLabelSpacing;
- U32 mPrecision;
- F32 mUpdatesPerSec;
- BOOL mPerSec; // Use the per sec stats.
- BOOL mDisplayBar; // Display the bar graph.
- BOOL mDisplayHistory;
- BOOL mDisplayMean; // If true, display mean, if false, display current value
-
- LLStat* mStatp;
+ F32 mMinBar;
+ F32 mMaxBar;
+ F32 mCurMaxBar;
+ F32 mTickSpacing;
+ F32 mLabelSpacing;
+ U32 mPrecision;
+ F32 mUpdatesPerSec;
+ F32 mUnitScale;
+ S32 mNumFrames;
+ S32 mMaxHeight;
+ bool mPerSec; // Use the per sec stats.
+ bool mDisplayBar; // Display the bar graph.
+ bool mDisplayHistory;
+ bool mDisplayMean; // If true, display mean, if false, display current value
+ bool mScaleRange;
+ EOrientation mOrientation;
+
+ LLTrace::TraceType<LLTrace::CountAccumulator<F64> >* mCountFloatp;
+ LLTrace::TraceType<LLTrace::CountAccumulator<S64> >* mCountIntp;
+ LLTrace::TraceType<LLTrace::MeasurementAccumulator<F64> >* mMeasurementFloatp;
+ LLTrace::TraceType<LLTrace::MeasurementAccumulator<S64> >* mMeasurementIntp;
LLFrameTimer mUpdateTimer;
- LLUIString mLabel;
- std::string mUnitLabel;
- F32 mValue;
+ LLUIString mLabel;
+ std::string mUnitLabel;
+ F32 mValue;
};
#endif
diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp
index e44887ebf0..bdb378c9c5 100644
--- a/indra/llui/llstatgraph.cpp
+++ b/indra/llui/llstatgraph.cpp
@@ -32,48 +32,65 @@
#include "llmath.h"
#include "llui.h"
-#include "llstat.h"
#include "llgl.h"
#include "llglheaders.h"
+#include "lltracerecording.h"
+#include "lltracethreadrecorder.h"
//#include "llviewercontrol.h"
///////////////////////////////////////////////////////////////////////////////////
-LLStatGraph::LLStatGraph(const LLView::Params& p)
-: LLView(p)
+LLStatGraph::LLStatGraph(const Params& p)
+: LLView(p),
+ mMin(p.min),
+ mMax(p.max),
+ mPerSec(true),
+ mPrecision(p.precision),
+ mValue(p.value),
+ mNewStatFloatp(p.stat.count_stat_float),
+ mNewStatIntp(p.stat.count_stat_int)
{
- mStatp = NULL;
setToolTip(p.name());
- mNumThresholds = 3;
- mThresholdColors[0] = LLColor4(0.f, 1.f, 0.f, 1.f);
- mThresholdColors[1] = LLColor4(1.f, 1.f, 0.f, 1.f);
- mThresholdColors[2] = LLColor4(1.f, 0.f, 0.f, 1.f);
- mThresholdColors[3] = LLColor4(1.f, 0.f, 0.f, 1.f);
- mThresholds[0] = 50.f;
- mThresholds[1] = 75.f;
- mThresholds[2] = 100.f;
- mMin = 0.f;
- mMax = 125.f;
- mPerSec = TRUE;
- mValue = 0.f;
- mPrecision = 0;
+
+ for(LLInitParam::ParamIterator<ThresholdParams>::const_iterator it = p.thresholds.threshold.begin(), end_it = p.thresholds.threshold.end();
+ it != end_it;
+ ++it)
+ {
+ mThresholds.push_back(Threshold(it->value(), it->color));
+ }
}
void LLStatGraph::draw()
{
F32 range, frac;
range = mMax - mMin;
- if (mStatp)
+ if (mNewStatFloatp)
+ {
+ LLTrace::Recording& recording = LLTrace::get_frame_recording().getLastRecordingPeriod();
+
+ if (mPerSec)
+ {
+ mValue = recording.getPerSec(*mNewStatFloatp);
+ }
+ else
+ {
+ mValue = recording.getSum(*mNewStatFloatp);
+ }
+ }
+ else if (mNewStatIntp)
{
+ LLTrace::Recording& recording = LLTrace::get_frame_recording().getLastRecordingPeriod();
+
if (mPerSec)
{
- mValue = mStatp->getMeanPerSec();
+ mValue = recording.getPerSec(*mNewStatIntp);
}
else
{
- mValue = mStatp->getMean();
+ mValue = recording.getSum(*mNewStatIntp);
}
}
+
frac = (mValue - mMin) / range;
frac = llmax(0.f, frac);
frac = llmin(1.f, frac);
@@ -91,19 +108,13 @@ void LLStatGraph::draw()
LLColor4 color;
- S32 i;
- for (i = 0; i < mNumThresholds - 1; i++)
+ threshold_vec_t::iterator it = std::lower_bound(mThresholds.begin(), mThresholds.end(), Threshold(mValue / mMax, LLUIColor()));
+
+ if (it != mThresholds.begin())
{
- if (mThresholds[i] > mValue)
- {
- break;
- }
+ it--;
}
- //gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0,
- // LLUIColorTable::instance().getColor("ColorDropShadow"),
- // (S32) gSavedSettings.getF32("DropShadowFloater") );
-
color = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" );
gGL.color4fv(color.mV);
gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, TRUE);
@@ -111,16 +122,11 @@ void LLStatGraph::draw()
gGL.color4fv(LLColor4::black.mV);
gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, FALSE);
- color = mThresholdColors[i];
+ color = it->mColor;
gGL.color4fv(color.mV);
gl_rect_2d(1, llround(frac*getRect().getHeight()), getRect().getWidth() - 1, 0, TRUE);
}
-void LLStatGraph::setValue(const LLSD& value)
-{
- mValue = (F32)value.asReal();
-}
-
void LLStatGraph::setMin(const F32 min)
{
mMin = min;
@@ -131,27 +137,3 @@ void LLStatGraph::setMax(const F32 max)
mMax = max;
}
-void LLStatGraph::setStat(LLStat *statp)
-{
- mStatp = statp;
-}
-
-void LLStatGraph::setLabel(const std::string& label)
-{
- mLabel = label;
-}
-
-void LLStatGraph::setUnits(const std::string& units)
-{
- mUnits = units;
-}
-
-void LLStatGraph::setPrecision(const S32 precision)
-{
- mPrecision = precision;
-}
-
-void LLStatGraph::setThreshold(const S32 i, F32 value)
-{
- mThresholds[i] = value;
-}
diff --git a/indra/llui/llstatgraph.h b/indra/llui/llstatgraph.h
index 757525e232..c9e33ed902 100644
--- a/indra/llui/llstatgraph.h
+++ b/indra/llui/llstatgraph.h
@@ -30,29 +30,86 @@
#include "llview.h"
#include "llframetimer.h"
#include "v4color.h"
-
-class LLStat;
+#include "lltrace.h"
class LLStatGraph : public LLView
{
public:
- LLStatGraph(const LLView::Params&);
+ struct ThresholdParams : public LLInitParam::Block<ThresholdParams>
+ {
+ Mandatory<F32> value;
+ Optional<LLUIColor> color;
- virtual void draw();
+ ThresholdParams()
+ : value("value"),
+ color("color", LLColor4::white)
+ {}
+ };
+
+ struct Thresholds : public LLInitParam::Block<Thresholds>
+ {
+ Multiple<ThresholdParams> threshold;
+
+ Thresholds()
+ : threshold("threshold")
+ {}
+ };
+
+ struct StatParams : public LLInitParam::ChoiceBlock<StatParams>
+ {
+ Alternative<LLTrace::TraceType<LLTrace::CountAccumulator<F64> >* > count_stat_float;
+ Alternative<LLTrace::TraceType<LLTrace::CountAccumulator<S64> >* > count_stat_int;
+ Alternative<LLTrace::TraceType<LLTrace::MeasurementAccumulator<F64> >* > measurement_stat_float;
+ Alternative<LLTrace::TraceType<LLTrace::MeasurementAccumulator<S64> >* > measurement_stat_int;
+ };
+
+ struct Params : public LLInitParam::Block<Params, LLView::Params>
+ {
+ Mandatory<StatParams> stat;
+ Optional<std::string> label,
+ units;
+ Optional<S32> precision;
+ Optional<F32> min,
+ max;
+ Optional<bool> per_sec;
+ Optional<F32> value;
+
+ Optional<Thresholds> thresholds;
+
+ Params()
+ : stat("stat"),
+ label("label"),
+ units("units"),
+ precision("precision", 0),
+ min("min", 0.f),
+ max("max", 125.f),
+ per_sec("per_sec", true),
+ value("value", 0.f),
+ thresholds("thresholds")
+ {
+ Thresholds _thresholds;
+ _thresholds.threshold.add(ThresholdParams().value(0.f).color(LLColor4::green))
+ .add(ThresholdParams().value(0.33f).color(LLColor4::yellow))
+ .add(ThresholdParams().value(0.5f).color(LLColor4::red))
+ .add(ThresholdParams().value(0.75f).color(LLColor4::red));
+ thresholds = _thresholds;
+ }
+ };
+ LLStatGraph(const Params&);
- void setLabel(const std::string& label);
- void setUnits(const std::string& units);
- void setPrecision(const S32 precision);
- void setStat(LLStat *statp);
- void setThreshold(const S32 i, F32 value);
void setMin(const F32 min);
void setMax(const F32 max);
+ virtual void draw();
+
/*virtual*/ void setValue(const LLSD& value);
- LLStat *mStatp;
- BOOL mPerSec;
private:
+ LLTrace::TraceType<LLTrace::CountAccumulator<F64> >* mNewStatFloatp;
+ LLTrace::TraceType<LLTrace::CountAccumulator<S64> >* mNewStatIntp;
+
+ BOOL mPerSec;
+
F32 mValue;
F32 mMin;
@@ -62,9 +119,25 @@ private:
std::string mUnits;
S32 mPrecision; // Num of digits of precision after dot
- S32 mNumThresholds;
- F32 mThresholds[4];
- LLColor4 mThresholdColors[4];
+ struct Threshold
+ {
+ Threshold(F32 value, const LLUIColor& color)
+ : mValue(value),
+ mColor(color)
+ {}
+
+ F32 mValue;
+ LLUIColor mColor;
+ bool operator <(const Threshold& other)
+ {
+ return mValue < other.mValue;
+ }
+ };
+ typedef std::vector<Threshold> threshold_vec_t;
+ threshold_vec_t mThresholds;
+ //S32 mNumThresholds;
+ //F32 mThresholds[4];
+ //LLColor4 mThresholdColors[4];
};
#endif // LL_LLSTATGRAPH_H
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 5fc2cc350d..4df35f77a5 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -406,7 +406,7 @@ void LLTabContainer::draw()
}
}
- setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f)));
+ setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLSmoothInterpolation::getInterpolant(0.08f)));
BOOL has_scroll_arrows = !getTabsHidden() && ((mMaxScrollPos > 0) || (mScrollPosPixels > 0));
if (!mIsVertical)
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 3815eec447..680b6ed16d 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -47,6 +47,8 @@
const F32 CURSOR_FLASH_DELAY = 1.0f; // in seconds
const S32 CURSOR_THICKNESS = 2;
+LLTrace::MemStatHandle LLTextSegment::sMemStat("LLTextSegment");
+
LLTextBase::line_info::line_info(S32 index_start, S32 index_end, LLRect rect, S32 line_num)
: mDocIndexStart(index_start),
mDocIndexEnd(index_end),
@@ -561,7 +563,7 @@ void LLTextBase::drawText()
if ( (mSpellCheckStart != start) || (mSpellCheckEnd != end) )
{
const LLWString& wstrText = getWText();
- mMisspellRanges.clear();
+ memDisclaim(mMisspellRanges).clear();
segment_set_t::const_iterator seg_it = getSegIterContaining(start);
while (mSegments.end() != seg_it)
@@ -632,6 +634,7 @@ void LLTextBase::drawText()
mSpellCheckStart = start;
mSpellCheckEnd = end;
+ memClaim(mMisspellRanges);
}
}
@@ -890,10 +893,12 @@ void LLTextBase::createDefaultSegment()
// ensures that there is always at least one segment
if (mSegments.empty())
{
+ memDisclaim(mSegments);
LLStyleConstSP sp(new LLStyle(getDefaultStyleParams()));
LLTextSegmentPtr default_segment = new LLNormalTextSegment( sp, 0, getLength() + 1, *this);
mSegments.insert(default_segment);
default_segment->linkToDocument(this);
+ memClaim(mSegments);
}
}
@@ -904,6 +909,8 @@ void LLTextBase::insertSegment(LLTextSegmentPtr segment_to_insert)
return;
}
+ memDisclaim(mSegments);
+
segment_set_t::iterator cur_seg_iter = getSegIterContaining(segment_to_insert->getStart());
S32 reflow_start_index = 0;
@@ -976,6 +983,7 @@ void LLTextBase::insertSegment(LLTextSegmentPtr segment_to_insert)
// layout potentially changed
needsReflow(reflow_start_index);
+ memClaim(mSegments);
}
BOOL LLTextBase::handleMouseDown(S32 x, S32 y, MASK mask)
@@ -1271,8 +1279,11 @@ void LLTextBase::replaceWithSuggestion(U32 index)
removeStringNoUndo(it->first, it->second - it->first);
// Insert the suggestion in its place
+ memDisclaim(mSuggestionList);
LLWString suggestion = utf8str_to_wstring(mSuggestionList[index]);
insertStringNoUndo(it->first, utf8str_to_wstring(mSuggestionList[index]));
+ memClaim(mSuggestionList);
+
setCursorPos(it->first + (S32)suggestion.length());
break;
@@ -1334,7 +1345,7 @@ bool LLTextBase::isMisspelledWord(U32 pos) const
void LLTextBase::onSpellCheckSettingsChange()
{
// Recheck the spelling on every change
- mMisspellRanges.clear();
+ memDisclaim(mMisspellRanges).clear();
mSpellCheckStart = mSpellCheckEnd = -1;
}
@@ -1593,7 +1604,7 @@ LLRect LLTextBase::getTextBoundingRect()
void LLTextBase::clearSegments()
{
- mSegments.clear();
+ memDisclaim(mSegments).clear();
createDefaultSegment();
}
@@ -3057,7 +3068,9 @@ void LLNormalTextSegment::setToolTip(const std::string& tooltip)
llwarns << "LLTextSegment::setToolTip: cannot replace keyword tooltip." << llendl;
return;
}
+ memDisclaim(mTooltip);
mTooltip = tooltip;
+ memClaim(mTooltip);
}
bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index 90b147cee1..2ce15d891a 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -50,7 +50,10 @@ class LLUrlMatch;
/// includes a start/end offset from the start of the string, a
/// style to render with, an optional tooltip, etc.
///
-class LLTextSegment : public LLRefCount, public LLMouseHandler
+class LLTextSegment
+: public LLRefCount,
+ public LLMouseHandler,
+ public LLTrace::MemTrackable<LLTextSegment>
{
public:
LLTextSegment(S32 start, S32 end) : mStart(start), mEnd(end){};
@@ -91,10 +94,12 @@ public:
/*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const;
/*virtual*/ BOOL hasMouseCapture();
- S32 getStart() const { return mStart; }
- void setStart(S32 start) { mStart = start; }
- S32 getEnd() const { return mEnd; }
- void setEnd( S32 end ) { mEnd = end; }
+ S32 getStart() const { return mStart; }
+ void setStart(S32 start) { mStart = start; }
+ S32 getEnd() const { return mEnd; }
+ void setEnd( S32 end ) { mEnd = end; }
+
+ static LLTrace::MemStatHandle sMemStat;
protected:
S32 mStart;
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 63b7e452d2..13aa21b505 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -42,9 +42,9 @@
namespace LLToolBarEnums
{
- LLLayoutStack::ELayoutOrientation getOrientation(SideType sideType)
+ LLView::EOrientation getOrientation(SideType sideType)
{
- LLLayoutStack::ELayoutOrientation orientation = LLLayoutStack::HORIZONTAL;
+ LLView::EOrientation orientation = LLLayoutStack::HORIZONTAL;
if ((sideType == SIDE_LEFT) || (sideType == SIDE_RIGHT))
{
@@ -173,7 +173,7 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p)
// Initialize the base object
LLUICtrl::initFromParams(p);
- LLLayoutStack::ELayoutOrientation orientation = getOrientation(p.side);
+ LLView::EOrientation orientation = getOrientation(p.side);
LLLayoutStack::Params centering_stack_p;
centering_stack_p.name = "centering_stack";
@@ -525,7 +525,7 @@ int LLToolBar::getRankFromPosition(S32 x, S32 y)
int rank = 0;
// Convert the toolbar coord into button panel coords
- LLLayoutStack::ELayoutOrientation orientation = getOrientation(mSideType);
+ LLView::EOrientation orientation = getOrientation(mSideType);
S32 button_panel_x = 0;
S32 button_panel_y = 0;
localPointToOtherView(x, y, &button_panel_x, &button_panel_y, mButtonPanel);
@@ -644,7 +644,7 @@ void LLToolBar::updateLayoutAsNeeded()
{
if (!mNeedsLayout) return;
- LLLayoutStack::ELayoutOrientation orientation = getOrientation(mSideType);
+ LLView::EOrientation orientation = getOrientation(mSideType);
// our terminology for orientation-agnostic layout is such that
// length refers to a distance in the direction we stack the buttons
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index 31424a36d4..6936cb37f7 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -125,7 +125,7 @@ namespace LLToolBarEnums
SIDE_TOP,
};
- LLLayoutStack::ELayoutOrientation getOrientation(SideType sideType);
+ LLView::EOrientation getOrientation(SideType sideType);
}
// NOTE: This needs to occur before Param block declaration for proper compilation.
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 6d2bc1837c..b9d935847b 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -724,9 +724,14 @@ void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LL
gl_draw_scaled_rotated_image( x, y, image->getWidth(0), image->getHeight(0), degrees, image, color, uv_rect );
}
-void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect)
+void gl_draw_scaled_target(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* target, const LLColor4& color, const LLRectf& uv_rect)
{
- if (NULL == image)
+ gl_draw_scaled_rotated_image(x, y, width, height, 0.f, NULL, color, uv_rect, target);
+}
+
+void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees, LLTexture* image, const LLColor4& color, const LLRectf& uv_rect, LLRenderTarget* target)
+{
+ if (!image && !target)
{
llwarns << "image == NULL; aborting function" << llendl;
return;
@@ -734,8 +739,14 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
LLGLSUIDefault gls_ui;
-
- gGL.getTexUnit(0)->bind(image, true);
+ if(image != NULL)
+ {
+ gGL.getTexUnit(0)->bind(image, true);
+ }
+ else
+ {
+ gGL.getTexUnit(0)->bind(target);
+ }
gGL.color4fv(color.mV);
@@ -788,7 +799,14 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
LLMatrix3 quat(0.f, 0.f, degrees*DEG_TO_RAD);
- gGL.getTexUnit(0)->bind(image, true);
+ if(image != NULL)
+ {
+ gGL.getTexUnit(0)->bind(image, true);
+ }
+ else
+ {
+ gGL.getTexUnit(0)->bind(target);
+ }
gGL.color4fv(color.mV);
@@ -1129,6 +1147,8 @@ void gl_rect_2d_simple( S32 width, S32 height )
gGL.end();
}
+static LLFastTimer::DeclareTimer FTM_RENDER_SEGMENTED_RECT ("Render segmented rectangle");
+
void gl_segmented_rect_2d_tex(const S32 left,
const S32 top,
const S32 right,
@@ -1138,6 +1158,7 @@ void gl_segmented_rect_2d_tex(const S32 left,
const S32 border_size,
const U32 edges)
{
+ LLFastTimer _(FTM_RENDER_SEGMENTED_RECT);
S32 width = llabs(right - left);
S32 height = llabs(top - bottom);
@@ -1288,10 +1309,7 @@ void gl_segmented_rect_2d_tex(const S32 left,
}
//FIXME: rewrite to use scissor?
-void gl_segmented_rect_2d_fragment_tex(const S32 left,
- const S32 top,
- const S32 right,
- const S32 bottom,
+void gl_segmented_rect_2d_fragment_tex(const LLRect& rect,
const S32 texture_width,
const S32 texture_height,
const S32 border_size,
@@ -1299,6 +1317,11 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
const F32 end_fragment,
const U32 edges)
{
+ LLFastTimer _(FTM_RENDER_SEGMENTED_RECT);
+ const S32 left = rect.mLeft;
+ const S32 right = rect.mRight;
+ const S32 top = rect.mTop;
+ const S32 bottom = rect.mBottom;
S32 width = llabs(right - left);
S32 height = llabs(top - bottom);
@@ -1336,9 +1359,9 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
{
if (start_fragment < middle_start)
{
- u_min = (start_fragment / middle_start) * border_uv_scale.mV[VX];
+ u_min = (start_fragment / middle_start) * border_uv_scale.mV[VX];
u_max = llmin(end_fragment / middle_start, 1.f) * border_uv_scale.mV[VX];
- x_min = (start_fragment / middle_start) * border_width_left;
+ x_min = (start_fragment / middle_start) * border_width_left;
x_max = llmin(end_fragment / middle_start, 1.f) * border_width_left;
// draw bottom left
@@ -1428,10 +1451,10 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
if (end_fragment > middle_end)
{
- u_min = (1.f - llmax(0.f, ((start_fragment - middle_end) / middle_start))) * border_uv_scale.mV[VX];
- u_max = (1.f - ((end_fragment - middle_end) / middle_start)) * border_uv_scale.mV[VX];
- x_min = width_vec - ((1.f - llmax(0.f, ((start_fragment - middle_end) / middle_start))) * border_width_right);
- x_max = width_vec - ((1.f - ((end_fragment - middle_end) / middle_start)) * border_width_right);
+ u_min = 1.f - ((1.f - llmax(0.f, (start_fragment - middle_end) / middle_start)) * border_uv_scale.mV[VX]);
+ u_max = 1.f - ((1.f - ((end_fragment - middle_end) / middle_start)) * border_uv_scale.mV[VX]);
+ x_min = width_vec - ((1.f - llmax(0.f, (start_fragment - middle_end) / middle_start)) * border_width_right);
+ x_max = width_vec - ((1.f - ((end_fragment - middle_end) / middle_start)) * border_width_right);
// draw bottom right
gGL.texCoord2f(u_min, 0.f);
@@ -1482,6 +1505,7 @@ void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& bo
const LLVector3& border_height, const LLVector3& width_vec, const LLVector3& height_vec,
const U32 edges)
{
+ LLFastTimer _(FTM_RENDER_SEGMENTED_RECT);
LLVector3 left_border_width = ((edges & (~(U32)ROUNDED_RECT_RIGHT)) != 0) ? border_width : LLVector3::zero;
LLVector3 right_border_width = ((edges & (~(U32)ROUNDED_RECT_LEFT)) != 0) ? border_width : LLVector3::zero;
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index c5a12d2b31..dfb9fa60c9 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -58,6 +58,7 @@ class LLUUID;
class LLWindow;
class LLView;
class LLHelp;
+class LLRenderTarget;
// UI colors
extern const LLColor4 UI_VERTEX_COLOR;
@@ -93,8 +94,9 @@ void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians,
void gl_draw_image(S32 x, S32 y, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_scaled_image(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
+void gl_draw_scaled_target(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* target, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_rotated_image(S32 x, S32 y, F32 degrees, LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
-void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees,LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
+void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degrees,LLTexture* image, const LLColor4& color = UI_VERTEX_COLOR, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), LLRenderTarget* target = NULL);
void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f));
@@ -126,7 +128,7 @@ typedef enum e_rounded_edge
void gl_segmented_rect_2d_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const U32 edges = ROUNDED_RECT_ALL);
-void gl_segmented_rect_2d_fragment_tex(const S32 left, const S32 top, const S32 right, const S32 bottom, const S32 texture_width, const S32 texture_height, const S32 border_size, const F32 start_fragment, const F32 end_fragment, const U32 edges = ROUNDED_RECT_ALL);
+void gl_segmented_rect_2d_fragment_tex(const LLRect& rect, const S32 texture_width, const S32 texture_height, const S32 border_size, const F32 start_fragment, const F32 end_fragment, const U32 edges = ROUNDED_RECT_ALL);
void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& border_width, const LLVector3& border_height, const LLVector3& width_vec, const LLVector3& height_vec, U32 edges = ROUNDED_RECT_ALL);
void gl_segmented_rect_3d_tex_top(const LLVector2& border_scale, const LLVector3& border_width, const LLVector3& border_height, const LLVector3& width_vec, const LLVector3& height_vec);
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index b9c843e931..08358484ef 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -118,6 +118,7 @@ LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel)
mDoubleClickSignal(NULL),
mTransparencyType(TT_DEFAULT)
{
+ memClaim(viewmodel.get());
}
void LLUICtrl::initFromParams(const Params& p)
@@ -940,7 +941,7 @@ boost::signals2::connection LLUICtrl::setCommitCallback( boost::function<void (L
}
boost::signals2::connection LLUICtrl::setValidateBeforeCommit( boost::function<bool (const LLSD& data)> cb )
{
- if (!mValidateSignal) mValidateSignal = new enable_signal_t();
+ if (!mValidateSignal) mValidateSignal = memClaim(new enable_signal_t());
return mValidateSignal->connect(boost::bind(cb, _2));
}
@@ -1003,55 +1004,55 @@ boost::signals2::connection LLUICtrl::setValidateCallback(const EnableCallbackPa
boost::signals2::connection LLUICtrl::setCommitCallback( const commit_signal_t::slot_type& cb )
{
- if (!mCommitSignal) mCommitSignal = new commit_signal_t();
+ if (!mCommitSignal) mCommitSignal = memClaim(new commit_signal_t());
return mCommitSignal->connect(cb);
}
boost::signals2::connection LLUICtrl::setValidateCallback( const enable_signal_t::slot_type& cb )
{
- if (!mValidateSignal) mValidateSignal = new enable_signal_t();
+ if (!mValidateSignal) mValidateSignal = memClaim(new enable_signal_t());
return mValidateSignal->connect(cb);
}
boost::signals2::connection LLUICtrl::setMouseEnterCallback( const commit_signal_t::slot_type& cb )
{
- if (!mMouseEnterSignal) mMouseEnterSignal = new commit_signal_t();
+ if (!mMouseEnterSignal) mMouseEnterSignal = memClaim(new commit_signal_t());
return mMouseEnterSignal->connect(cb);
}
boost::signals2::connection LLUICtrl::setMouseLeaveCallback( const commit_signal_t::slot_type& cb )
{
- if (!mMouseLeaveSignal) mMouseLeaveSignal = new commit_signal_t();
+ if (!mMouseLeaveSignal) mMouseLeaveSignal = memClaim(new commit_signal_t());
return mMouseLeaveSignal->connect(cb);
}
boost::signals2::connection LLUICtrl::setMouseDownCallback( const mouse_signal_t::slot_type& cb )
{
- if (!mMouseDownSignal) mMouseDownSignal = new mouse_signal_t();
+ if (!mMouseDownSignal) mMouseDownSignal = memClaim(new mouse_signal_t());
return mMouseDownSignal->connect(cb);
}
boost::signals2::connection LLUICtrl::setMouseUpCallback( const mouse_signal_t::slot_type& cb )
{
- if (!mMouseUpSignal) mMouseUpSignal = new mouse_signal_t();
+ if (!mMouseUpSignal) mMouseUpSignal = memClaim(new mouse_signal_t());
return mMouseUpSignal->connect(cb);
}
boost::signals2::connection LLUICtrl::setRightMouseDownCallback( const mouse_signal_t::slot_type& cb )
{
- if (!mRightMouseDownSignal) mRightMouseDownSignal = new mouse_signal_t();
+ if (!mRightMouseDownSignal) mRightMouseDownSignal = memClaim(new mouse_signal_t());
return mRightMouseDownSignal->connect(cb);
}
boost::signals2::connection LLUICtrl::setRightMouseUpCallback( const mouse_signal_t::slot_type& cb )
{
- if (!mRightMouseUpSignal) mRightMouseUpSignal = new mouse_signal_t();
+ if (!mRightMouseUpSignal) mRightMouseUpSignal = memClaim(new mouse_signal_t());
return mRightMouseUpSignal->connect(cb);
}
boost::signals2::connection LLUICtrl::setDoubleClickCallback( const mouse_signal_t::slot_type& cb )
{
- if (!mDoubleClickSignal) mDoubleClickSignal = new mouse_signal_t();
+ if (!mDoubleClickSignal) mDoubleClickSignal = memClaim(new mouse_signal_t());
return mDoubleClickSignal->connect(cb);
}
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index f6971261d7..e6e9c66aef 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -165,17 +165,17 @@ public:
static T* createFromFile(const std::string &filename, LLView *parent, const widget_registry_t& registry)
{
T* widget = NULL;
-
+
instance().pushFileName(filename);
{
LLXMLNodePtr root_node;
if (!LLUICtrlFactory::getLayeredXMLNode(filename, root_node))
- {
+ {
llwarns << "Couldn't parse XUI file: " << instance().getCurFileName() << llendl;
goto fail;
}
-
+
LLView* view = getInstance()->createFromXML(root_node, parent, filename, registry, NULL);
if (view)
{
@@ -260,10 +260,8 @@ private:
// We always want to output top-left coordinates
typename T::Params output_params(params);
T::setupParamsForExport(output_params, parent);
- // Export only the differences between this any default params
- typename T::Params default_params(getDefaultParams<T>());
copyName(node, output_node);
- parser.writeXUI(output_node, output_params, &default_params);
+ parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &getDefaultParams<T>());
}
// Apply layout transformations, usually munging rect
diff --git a/indra/llui/lluistring.cpp b/indra/llui/lluistring.cpp
index c4e073ccdb..23fc53ea88 100644
--- a/indra/llui/lluistring.cpp
+++ b/indra/llui/lluistring.cpp
@@ -26,6 +26,8 @@
#include "linden_common.h"
#include "lluistring.h"
+
+#include "llfasttimer.h"
#include "llsd.h"
#include "lltrans.h"
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index ad9bec9f61..ba88396294 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -30,7 +30,6 @@
#define LLVIEW_CPP
#include "llview.h"
-#include <cassert>
#include <sstream>
#include <boost/tokenizer.hpp>
#include <boost/foreach.hpp>
@@ -68,6 +67,7 @@ LLView* LLView::sPreviewClickedElement = NULL;
BOOL LLView::sDrawPreviewHighlights = FALSE;
S32 LLView::sLastLeftXML = S32_MIN;
S32 LLView::sLastBottomXML = S32_MIN;
+LLTrace::MemStatHandle LLView::sMemStat("LLView");
std::vector<LLViewDrawContext*> LLViewDrawContext::sDrawContextStack;
LLView::DrilldownFunc LLView::sDrilldown =
@@ -83,6 +83,16 @@ template class LLView* LLView::getChild<class LLView>(
static LLDefaultChildRegistry::Register<LLView> r("view");
+namespace LLInitParam
+{
+ void TypeValues<LLView::EOrientation>::declareValues()
+ {
+ declare("horizontal", LLView::HORIZONTAL);
+ declare("vertical", LLView::VERTICAL);
+ }
+}
+
+
LLView::Follows::Follows()
: string(""),
flags("flags", FOLLOWS_LEFT | FOLLOWS_TOP)
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 1c35349510..88813da3c6 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -101,9 +101,13 @@ class LLView
: public LLMouseHandler, // handles mouse events
public LLFocusableElement, // handles keyboard events
public LLMortician, // lazy deletion
- public LLHandleProvider<LLView> // passes out weak references to self
+ public LLHandleProvider<LLView>, // passes out weak references to self
+ public LLTrace::MemTrackable<LLView> // track memory usage
{
public:
+
+ enum EOrientation { HORIZONTAL, VERTICAL, ORIENTATION_COUNT };
+
struct Follows : public LLInitParam::ChoiceBlock<Follows>
{
Alternative<std::string> string;
@@ -672,7 +676,18 @@ public:
static S32 sLastLeftXML;
static S32 sLastBottomXML;
static BOOL sForceReshape;
+ static LLTrace::MemStatHandle sMemStat;
+};
+
+namespace LLInitParam
+{
+template<>
+struct TypeValues<LLView::EOrientation> : public LLInitParam::TypeValuesHelper<LLView::EOrientation>
+{
+ static void declareValues();
};
+}
+
class LLCompareByTabOrder
{
diff --git a/indra/llui/llviewmodel.cpp b/indra/llui/llviewmodel.cpp
index a9f8acc440..901260bec8 100644
--- a/indra/llui/llviewmodel.cpp
+++ b/indra/llui/llviewmodel.cpp
@@ -35,6 +35,8 @@
// external library headers
// other Linden headers
+LLTrace::MemStatHandle LLViewModel::sMemStat("LLViewModel");
+
///
LLViewModel::LLViewModel()
: mDirty(false)
@@ -80,7 +82,10 @@ LLTextViewModel::LLTextViewModel(const LLSD& value)
void LLTextViewModel::setValue(const LLSD& value)
{
LLViewModel::setValue(value);
+ memDisclaim(mDisplay);
mDisplay = utf8str_to_wstring(value.asString());
+ memClaim(mDisplay);
+
// mDisplay and mValue agree
mUpdateFromDisplay = false;
}
@@ -91,7 +96,9 @@ void LLTextViewModel::setDisplay(const LLWString& value)
// and do the utf8str_to_wstring() to get the corresponding mDisplay
// value. But a text editor might want to edit the display string
// directly, then convert back to UTF8 on commit.
+ memDisclaim(mDisplay);
mDisplay = value;
+ memClaim(mDisplay);
mDirty = true;
// Don't immediately convert to UTF8 -- do it lazily -- we expect many
// more setDisplay() calls than getValue() calls. Just flag that it needs
diff --git a/indra/llui/llviewmodel.h b/indra/llui/llviewmodel.h
index ef2e314799..2c016d2560 100644
--- a/indra/llui/llviewmodel.h
+++ b/indra/llui/llviewmodel.h
@@ -39,6 +39,7 @@
#include "llrefcount.h"
#include "stdenums.h"
#include "llstring.h"
+#include "lltrace.h"
#include <string>
class LLScrollListItem;
@@ -60,7 +61,9 @@ typedef LLPointer<LLListViewModel> LLListViewModelPtr;
* LLViewModel data. This way, the LLViewModel is quietly deleted when the
* last referencing widget is destroyed.
*/
-class LLViewModel: public LLRefCount
+class LLViewModel
+: public LLRefCount,
+ public LLTrace::MemTrackable<LLViewModel>
{
public:
LLViewModel();
@@ -80,6 +83,8 @@ public:
//
void setDirty() { mDirty = true; }
+ static LLTrace::MemStatHandle sMemStat;
+
protected:
LLSD mValue;
bool mDirty;
diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp
index afc76024d1..903f10ce10 100644
--- a/indra/llui/llxuiparser.cpp
+++ b/indra/llui/llxuiparser.cpp
@@ -29,7 +29,7 @@
#include "llxuiparser.h"
#include "llxmlnode.h"
-
+#include "llfasttimer.h"
#ifdef LL_STANDALONE
#include <expat.h>
#else
@@ -861,11 +861,11 @@ bool LLXUIParser::readAttributes(LLXMLNodePtr nodep, LLInitParam::BaseBlock& blo
return any_parsed;
}
-void LLXUIParser::writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock &block, const LLInitParam::BaseBlock* diff_block)
+void LLXUIParser::writeXUIImpl(LLXMLNodePtr node, const LLInitParam::BaseBlock &block, const LLInitParam::predicate_rule_t rules, const LLInitParam::BaseBlock* diff_block)
{
mWriteRootNode = node;
name_stack_t name_stack = Parser::name_stack_t();
- block.serializeBlock(*this, name_stack, diff_block);
+ block.serializeBlock(*this, name_stack, rules, diff_block);
mOutNodes.clear();
}
@@ -880,16 +880,24 @@ LLXMLNodePtr LLXUIParser::getNode(name_stack_t& stack)
it = next_it)
{
++next_it;
+ bool force_new_node = false;
+
if (it->first.empty())
{
it->second = false;
continue;
}
+ if (next_it != stack.end() && next_it->first.empty() && next_it->second)
+ {
+ force_new_node = true;
+ }
+
+
out_nodes_t::iterator found_it = mOutNodes.find(it->first);
// node with this name not yet written
- if (found_it == mOutNodes.end() || it->second)
+ if (found_it == mOutNodes.end() || it->second || force_new_node)
{
// make an attribute if we are the last element on the name stack
bool is_attribute = next_it == stack.end();
diff --git a/indra/llui/llxuiparser.h b/indra/llui/llxuiparser.h
index d7cd256967..8d0276a8ad 100644
--- a/indra/llui/llxuiparser.h
+++ b/indra/llui/llxuiparser.h
@@ -109,9 +109,25 @@ public:
/*virtual*/ void parserError(const std::string& message);
void readXUI(LLXMLNodePtr node, LLInitParam::BaseBlock& block, const std::string& filename = LLStringUtil::null, bool silent=false);
- void writeXUI(LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const LLInitParam::BaseBlock* diff_block = NULL);
+ template<typename BLOCK>
+ void writeXUI(LLXMLNodePtr node,
+ const BLOCK& block,
+ const LLInitParam::predicate_rule_t rules = LLInitParam::default_parse_rules(),
+ const LLInitParam::BaseBlock* diff_block = NULL)
+ {
+ if (!diff_block
+ && !rules.isAmbivalent(LLInitParam::HAS_DEFAULT_VALUE))
+ {
+ diff_block = &LLInitParam::defaultValue<BLOCK>();
+ }
+ writeXUIImpl(node, block, rules, diff_block);
+ }
private:
+ void writeXUIImpl(LLXMLNodePtr node,
+ const LLInitParam::BaseBlock& block,
+ const LLInitParam::predicate_rule_t rules,
+ const LLInitParam::BaseBlock* diff_block);
bool readXUIImpl(LLXMLNodePtr node, LLInitParam::BaseBlock& block);
bool readAttributes(LLXMLNodePtr nodep, LLInitParam::BaseBlock& block);