summaryrefslogtreecommitdiff
path: root/indra/llui/lllocalcliprect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/lllocalcliprect.cpp')
-rw-r--r--indra/llui/lllocalcliprect.cpp48
1 files changed, 39 insertions, 9 deletions
diff --git a/indra/llui/lllocalcliprect.cpp b/indra/llui/lllocalcliprect.cpp
index 6841301219..1a311bb13a 100644
--- a/indra/llui/lllocalcliprect.cpp
+++ b/indra/llui/lllocalcliprect.cpp
@@ -27,8 +27,33 @@
#include "lllocalcliprect.h"
#include "llfontgl.h"
+#include "llgl.h"
#include "llui.h"
+#include <stack>
+
+//---------------------------------------------------------------------------
+// LLScreenClipRect
+// implementation class in screen space
+//---------------------------------------------------------------------------
+class LLScreenClipRect
+{
+public:
+ LLScreenClipRect(const LLRect& rect, BOOL enabled = TRUE);
+ virtual ~LLScreenClipRect();
+
+private:
+ static void pushClipRect(const LLRect& rect);
+ static void popClipRect();
+ static void updateScissorRegion();
+
+private:
+ LLGLState mScissorState;
+ BOOL mEnabled;
+
+ static std::stack<LLRect> sClipRectStack;
+};
+
/*static*/ std::stack<LLRect> LLScreenClipRect::sClipRectStack;
@@ -39,9 +64,9 @@ LLScreenClipRect::LLScreenClipRect(const LLRect& rect, BOOL enabled)
if (mEnabled)
{
pushClipRect(rect);
- mScissorState.setEnabled(!sClipRectStack.empty());
- updateScissorRegion();
}
+ mScissorState.setEnabled(!sClipRectStack.empty());
+ updateScissorRegion();
}
LLScreenClipRect::~LLScreenClipRect()
@@ -49,8 +74,8 @@ LLScreenClipRect::~LLScreenClipRect()
if (mEnabled)
{
popClipRect();
- updateScissorRegion();
}
+ updateScissorRegion();
}
//static
@@ -100,11 +125,16 @@ void LLScreenClipRect::updateScissorRegion()
// LLLocalClipRect
//---------------------------------------------------------------------------
LLLocalClipRect::LLLocalClipRect(const LLRect& rect, BOOL enabled /* = TRUE */)
-: LLScreenClipRect(LLRect(rect.mLeft + LLFontGL::sCurOrigin.mX,
- rect.mTop + LLFontGL::sCurOrigin.mY,
- rect.mRight + LLFontGL::sCurOrigin.mX,
- rect.mBottom + LLFontGL::sCurOrigin.mY), enabled)
-{}
+{
+ LLRect screen(rect.mLeft + LLFontGL::sCurOrigin.mX,
+ rect.mTop + LLFontGL::sCurOrigin.mY,
+ rect.mRight + LLFontGL::sCurOrigin.mX,
+ rect.mBottom + LLFontGL::sCurOrigin.mY);
+ mScreenClipRect = new LLScreenClipRect(screen, enabled);
+}
LLLocalClipRect::~LLLocalClipRect()
-{}
+{
+ delete mScreenClipRect;
+ mScreenClipRect = NULL;
+}