summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender')
-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
4 files changed, 17 insertions, 21 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 11d9ef3f57..c908fac4ad 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 8c01784071..206e68f084 100644
--- a/indra/llrender/llrender2dutils.h
+++ b/indra/llrender/llrender2dutils.h
@@ -128,19 +128,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