summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llrender/llrender.cpp1
-rw-r--r--indra/llrender/llrender.h1
-rw-r--r--indra/llrender/llrender2dutils.cpp23
-rw-r--r--indra/llrender/llrender2dutils.h13
-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
-rw-r--r--indra/newview/llhudnametag.cpp11
-rw-r--r--indra/newview/llhudnametag.h4
-rw-r--r--indra/newview/llhudtext.cpp3
11 files changed, 57 insertions, 51 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index ebc4659bcf..9f95b62b8a 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -50,6 +50,7 @@ U32 LLRender::sUIVerts = 0;
U32 LLTexUnit::sWhiteTexture = 0;
bool LLRender::sGLCoreProfile = false;
bool LLRender::sNsightDebugSupport = false;
+LLVector2 LLRender::sUIGLScaleFactor = LLVector2(1.f, 1.f);
static const U32 LL_NUM_TEXTURE_LAYERS = 32;
static const U32 LL_NUM_LIGHT_UNITS = 8;
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index 41f4fe4017..af8568f8a3 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -463,6 +463,7 @@ public:
static U32 sUIVerts;
static bool sGLCoreProfile;
static bool sNsightDebugSupport;
+ static LLVector2 sUIGLScaleFactor;
private:
friend class LLLightState;
diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp
index 801b945806..dd34f3e383 100644
--- a/indra/llrender/llrender2dutils.cpp
+++ b/indra/llrender/llrender2dutils.cpp
@@ -106,11 +106,10 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixe
top += LLFontGL::sCurOrigin.mY;
gGL.loadUIIdentity();
- LLRender2D *r2d_inst = LLRender2D::getInstance();
- gl_rect_2d(llfloor((F32)left * r2d_inst->mGLScaleFactor.mV[VX]) - pixel_offset,
- llfloor((F32)top * r2d_inst->mGLScaleFactor.mV[VY]) + pixel_offset,
- llfloor((F32)right * r2d_inst->mGLScaleFactor.mV[VX]) + pixel_offset,
- llfloor((F32)bottom * r2d_inst->mGLScaleFactor.mV[VY]) - pixel_offset,
+ gl_rect_2d(llfloor((F32)left * LLRender::sUIGLScaleFactor.mV[VX]) - pixel_offset,
+ llfloor((F32)top * LLRender::sUIGLScaleFactor.mV[VY]) + pixel_offset,
+ llfloor((F32)right * LLRender::sUIGLScaleFactor.mV[VX]) + pixel_offset,
+ llfloor((F32)bottom * LLRender::sUIGLScaleFactor.mV[VY]) - pixel_offset,
filled);
gGL.popUIMatrix();
}
@@ -1568,7 +1567,6 @@ void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv
LLRender2D::LLRender2D(LLImageProviderInterface* image_provider)
{
- mGLScaleFactor = LLVector2(1.f, 1.f);
mImageProvider = image_provider;
if(mImageProvider)
{
@@ -1585,7 +1583,7 @@ LLRender2D::~LLRender2D()
}
}
-
+// static
void LLRender2D::translate(F32 x, F32 y, F32 z)
{
gGL.translateUI(x,y,z);
@@ -1594,12 +1592,14 @@ void LLRender2D::translate(F32 x, F32 y, F32 z)
LLFontGL::sCurDepth += z;
}
+// static
void LLRender2D::pushMatrix()
{
gGL.pushUIMatrix();
LLFontGL::sOriginStack.push_back(std::make_pair(LLFontGL::sCurOrigin, LLFontGL::sCurDepth));
}
+// static
void LLRender2D::popMatrix()
{
gGL.popUIMatrix();
@@ -1608,6 +1608,7 @@ void LLRender2D::popMatrix()
LLFontGL::sOriginStack.pop_back();
}
+// static
void LLRender2D::loadIdentity()
{
gGL.loadUIIdentity();
@@ -1616,15 +1617,11 @@ void LLRender2D::loadIdentity()
LLFontGL::sCurDepth = 0.f;
}
-void LLRender2D::setScaleFactor(const LLVector2 &scale_factor)
-{
- mGLScaleFactor = scale_factor;
-}
-
+// static
void LLRender2D::setLineWidth(F32 width)
{
gGL.flush();
- glLineWidth(width * lerp(mGLScaleFactor.mV[VX], mGLScaleFactor.mV[VY], 0.5f));
+ glLineWidth(width * lerp(LLRender::sUIGLScaleFactor.mV[VX], LLRender::sUIGLScaleFactor.mV[VY], 0.5f));
}
LLPointer<LLUIImage> LLRender2D::getUIImageByID(const LLUUID& image_id, S32 priority)
diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h
index 70ab006fd6..395c153820 100644
--- a/indra/llrender/llrender2dutils.h
+++ b/indra/llrender/llrender2dutils.h
@@ -127,19 +127,16 @@ class LLRender2D : public LLParamSingleton<LLRender2D>
LOG_CLASS(LLRender2D);
~LLRender2D();
public:
- void pushMatrix();
- void popMatrix();
- void loadIdentity();
- void translate(F32 x, F32 y, F32 z = 0.0f);
+ static void pushMatrix();
+ static void popMatrix();
+ static void loadIdentity();
+ static void translate(F32 x, F32 y, F32 z = 0.0f);
- void setLineWidth(F32 width);
- void setScaleFactor(const LLVector2& scale_factor);
+ static void setLineWidth(F32 width);
LLPointer<LLUIImage> getUIImageByID(const LLUUID& image_id, S32 priority = 0);
LLPointer<LLUIImage> getUIImage(const std::string& name, S32 priority = 0);
- LLVector2 mGLScaleFactor;
-
protected:
// since LLRender2D has no control of image provider's lifecycle
// we need a way to tell LLRender2D that provider died and
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)
diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp
index 81d862a827..fa89d3986d 100644
--- a/indra/newview/llhudnametag.cpp
+++ b/indra/newview/llhudnametag.cpp
@@ -105,6 +105,9 @@ LLHUDNameTag::LLHUDNameTag(const U8 type)
{
LLPointer<LLHUDNameTag> ptr(this);
sTextObjects.insert(ptr);
+
+ mRoundedRectImgp = LLUI::getUIImage("Rounded_Rect");
+ mRoundedRectTopImgp = LLUI::getUIImage("Rounded_Rect_Top");
}
LLHUDNameTag::~LLHUDNameTag()
@@ -274,9 +277,6 @@ void LLHUDNameTag::renderText(BOOL for_select)
mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f));
- // *TODO: cache this image
- LLUIImagePtr imagep = LLUI::getUIImage("Rounded_Rect");
-
// *TODO: make this a per-text setting
LLColor4 bg_color = LLUIColorTable::instance().getColor("NameTagBackground");
bg_color.setAlpha(gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor);
@@ -306,17 +306,16 @@ void LLHUDNameTag::renderText(BOOL for_select)
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
LLRect screen_rect;
screen_rect.setCenterAndSize(0, static_cast<S32>(lltrunc(-mHeight / 2 + mOffsetY)), static_cast<S32>(lltrunc(mWidth)), static_cast<S32>(lltrunc(mHeight)));
- imagep->draw3D(render_position, x_pixel_vec, y_pixel_vec, screen_rect, bg_color);
+ mRoundedRectImgp->draw3D(render_position, x_pixel_vec, y_pixel_vec, screen_rect, bg_color);
if (mLabelSegments.size())
{
- LLUIImagePtr rect_top_image = LLUI::getUIImage("Rounded_Rect_Top");
LLRect label_top_rect = screen_rect;
const S32 label_height = ll_round((mFontp->getLineHeight() * (F32)mLabelSegments.size() + (VERTICAL_PADDING / 3.f)));
label_top_rect.mBottom = label_top_rect.mTop - label_height;
LLColor4 label_top_color = text_color;
label_top_color.mV[VALPHA] = gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor;
- rect_top_image->draw3D(render_position, x_pixel_vec, y_pixel_vec, label_top_rect, label_top_color);
+ mRoundedRectTopImgp->draw3D(render_position, x_pixel_vec, y_pixel_vec, label_top_rect, label_top_color);
}
F32 y_offset = (F32)mOffsetY;
diff --git a/indra/newview/llhudnametag.h b/indra/newview/llhudnametag.h
index 38a4f18415..f7d7c2a51a 100644
--- a/indra/newview/llhudnametag.h
+++ b/indra/newview/llhudnametag.h
@@ -40,8 +40,8 @@
#include <set>
#include <vector>
-class LLDrawable;
class LLHUDNameTag;
+class LLUIImage;
struct llhudnametag_further_away
{
@@ -171,6 +171,8 @@ private:
EVertAlignment mVertAlignment;
S32 mLOD;
BOOL mHidden;
+ LLPointer<LLUIImage> mRoundedRectImgp;
+ LLPointer<LLUIImage> mRoundedRectTopImgp;
static BOOL sDisplayText ;
static std::set<LLPointer<LLHUDNameTag> > sTextObjects;
diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp
index 82824861a9..98ce632254 100644
--- a/indra/newview/llhudtext.cpp
+++ b/indra/newview/llhudtext.cpp
@@ -138,9 +138,6 @@ void LLHUDText::renderText()
mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f));
- // *TODO: cache this image
- LLUIImagePtr imagep = LLUI::getUIImage("Rounded_Square");
-
// *TODO: make this a per-text setting
LLColor4 bg_color = LLUIColorTable::instance().getColor("ObjectBubbleColor");
bg_color.setAlpha(gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor);