diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-08-24 18:44:39 +0100 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-08-24 18:44:39 +0100 |
commit | 98cc2365034a93c69704daa69efb389799cc9627 (patch) | |
tree | 4c3ec75b78a26a736f18a2153af025040ae05a4b /indra/llui/lllocalcliprect.cpp | |
parent | 6ba23344c95157793af9e4154933ae8df61630e8 (diff) |
Backed out changeset a62bf7c0af21
Backing out this merge that I pushed (prematurely) to the wrong place.
Diffstat (limited to 'indra/llui/lllocalcliprect.cpp')
-rw-r--r-- | indra/llui/lllocalcliprect.cpp | 48 |
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; +} |