summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-09-17 19:34:03 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2020-09-17 19:59:48 +0300
commit177ad21ade8fbbb05ac5c373b8b43176e70e64a7 (patch)
treed8350ba9674a75c9181be525e7f58f09554dc945 /indra/llui
parentb193defea81f279f366035d628941e4f463b25fe (diff)
SL-13729 Performance of LLUI and LLRender2D
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llmultislider.cpp23
-rw-r--r--indra/llui/llmultislider.h1
-rw-r--r--indra/llui/llui.cpp12
-rw-r--r--indra/llui/llui.h16
4 files changed, 32 insertions, 20 deletions
diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp
index acfe4a0cba..f89064d59a 100644
--- a/indra/llui/llmultislider.cpp
+++ b/indra/llui/llmultislider.cpp
@@ -136,6 +136,7 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p)
}
}
+ mRoundedSquareImgp = LLUI::getUIImage("Rounded_Square");
if (p.thumb_image.isProvided())
{
mThumbImagep = LLUI::getUIImage(p.thumb_image());
@@ -666,8 +667,6 @@ void LLMultiSlider::draw()
F32 opacity = getEnabled() ? 1.f : 0.3f;
// Track
- LLUIImagePtr thumb_imagep = LLUI::getUIImage("Rounded_Square");
-
static LLUICachedControl<S32> multi_track_height_width ("UIMultiTrackHeight", 0);
S32 height_offset = 0;
S32 width_offset = 0;
@@ -685,7 +684,7 @@ void LLMultiSlider::draw()
if(mDrawTrack)
{
track_rect.stretch(-1);
- thumb_imagep->draw(track_rect, mTrackColor.get() % opacity);
+ mRoundedSquareImgp->draw(track_rect, mTrackColor.get() % opacity);
}
// if we're supposed to use a drawn triangle
@@ -704,7 +703,7 @@ void LLMultiSlider::draw()
mTriangleColor.get() % opacity, TRUE);
}
}
- else if (!thumb_imagep && !mThumbImagep)
+ else if (!mRoundedSquareImgp && !mThumbImagep)
{
// draw all the thumbs
curSldrIt = mThumbRects.end();
@@ -757,7 +756,7 @@ void LLMultiSlider::draw()
}
else
{
- thumb_imagep->drawSolid(mDragStartThumbRect, mThumbCenterColor.get() % 0.3f);
+ mRoundedSquareImgp->drawSolid(mDragStartThumbRect, mThumbCenterColor.get() % 0.3f);
}
}
@@ -772,7 +771,7 @@ void LLMultiSlider::draw()
}
else
{
- thumb_imagep->drawBorder(mThumbRects[mCurSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth());
+ mRoundedSquareImgp->drawBorder(mThumbRects[mCurSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth());
}
}
}
@@ -784,7 +783,7 @@ void LLMultiSlider::draw()
}
else
{
- thumb_imagep->drawBorder(mThumbRects[mHoverSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth());
+ mRoundedSquareImgp->drawBorder(mThumbRects[mHoverSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth());
}
}
@@ -822,11 +821,11 @@ void LLMultiSlider::draw()
}
else if (capture == this)
{
- thumb_imagep->drawSolid(mIt->second, curThumbColor);
+ mRoundedSquareImgp->drawSolid(mIt->second, curThumbColor);
}
else
{
- thumb_imagep->drawSolid(mIt->second, curThumbColor % opacity);
+ mRoundedSquareImgp->drawSolid(mIt->second, curThumbColor % opacity);
}
}
@@ -846,11 +845,11 @@ void LLMultiSlider::draw()
}
else if (capture == this)
{
- thumb_imagep->drawSolid(curSldrIt->second, mThumbCenterSelectedColor.get());
+ mRoundedSquareImgp->drawSolid(curSldrIt->second, mThumbCenterSelectedColor.get());
}
else
{
- thumb_imagep->drawSolid(curSldrIt->second, mThumbCenterSelectedColor.get() % opacity);
+ mRoundedSquareImgp->drawSolid(curSldrIt->second, mThumbCenterSelectedColor.get() % opacity);
}
}
if(hoverSldrIt != mThumbRects.end())
@@ -861,7 +860,7 @@ void LLMultiSlider::draw()
}
else
{
- thumb_imagep->drawSolid(hoverSldrIt->second, mThumbCenterSelectedColor.get());
+ mRoundedSquareImgp->drawSolid(hoverSldrIt->second, mThumbCenterSelectedColor.get());
}
}
}
diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h
index 99a78d6e09..3cb4b760b0 100644
--- a/indra/llui/llmultislider.h
+++ b/indra/llui/llmultislider.h
@@ -150,6 +150,7 @@ protected:
LLUIColor mDisabledThumbColor;
LLUIColor mTriangleColor;
LLUIImagePtr mThumbImagep; //blimps on the slider, for now no 'disabled' support
+ LLUIImagePtr mRoundedSquareImgp; //blimps on the slider, for now no 'disabled' support
const EOrientation mOrientation;
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 656b69d3ed..77b59e5bc5 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -510,6 +510,18 @@ const LLView* LLUI::resolvePath(const LLView* context, const std::string& path)
return context;
}
+//static
+LLVector2& LLUI::getScaleFactor()
+{
+ return LLRender::sUIGLScaleFactor;
+}
+
+//static
+void LLUI::setScaleFactor(const LLVector2& scale_factor)
+{
+ LLRender::sUIGLScaleFactor = scale_factor;
+}
+
// LLLocalClipRect and LLScreenClipRect moved to lllocalcliprect.h/cpp
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index 9856e551cc..238bef3bf8 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -313,14 +313,14 @@ public:
void positionViewNearMouse(LLView* view, S32 spawn_x = S32_MAX, S32 spawn_y = S32_MAX);
// LLRender2D wrappers
- static void pushMatrix() { LLRender2D::getInstance()->pushMatrix(); }
- static void popMatrix() { LLRender2D::getInstance()->popMatrix(); }
- static void loadIdentity() { LLRender2D::getInstance()->loadIdentity(); }
- static void translate(F32 x, F32 y, F32 z = 0.0f) { LLRender2D::getInstance()->translate(x, y, z); }
-
- static LLVector2& getScaleFactor() { return LLRender2D::getInstance()->mGLScaleFactor; }
- static void setScaleFactor(const LLVector2& scale_factor) { LLRender2D::getInstance()->setScaleFactor(scale_factor); }
- static void setLineWidth(F32 width) { LLRender2D::getInstance()->setLineWidth(width); }
+ static void pushMatrix() { LLRender2D::pushMatrix(); }
+ static void popMatrix() { LLRender2D::popMatrix(); }
+ static void loadIdentity() { LLRender2D::loadIdentity(); }
+ static void translate(F32 x, F32 y, F32 z = 0.0f) { LLRender2D::translate(x, y, z); }
+
+ static LLVector2& getScaleFactor();
+ static void setScaleFactor(const LLVector2& scale_factor);
+ static void setLineWidth(F32 width) { LLRender2D::setLineWidth(width); }
static LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0)
{ return LLRender2D::getInstance()->getUIImageByID(image_id, priority); }
static LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0)