summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/render/mobileopenglgraphics.cpp16
-rw-r--r--src/render/normalopenglgraphics.cpp16
2 files changed, 28 insertions, 4 deletions
diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp
index 3fec19f15..91184958b 100644
--- a/src/render/mobileopenglgraphics.cpp
+++ b/src/render/mobileopenglgraphics.cpp
@@ -960,7 +960,6 @@ bool MobileOpenGLGraphics::pushClipArea(gcn::Rectangle area)
transX += clipArea.xOffset;
transY += clipArea.yOffset;
- glPushMatrix();
if (transX || transY)
{
glTranslatef(static_cast<GLfloat>(transX),
@@ -974,13 +973,26 @@ bool MobileOpenGLGraphics::pushClipArea(gcn::Rectangle area)
void MobileOpenGLGraphics::popClipArea()
{
+ if (mClipStack.empty())
+ return;
+
+ const gcn::ClipRectangle &clipArea1 = mClipStack.top();
+ int transX = -clipArea1.xOffset;
+ int transY = -clipArea1.yOffset;
+
gcn::Graphics::popClipArea();
if (mClipStack.empty())
return;
- glPopMatrix();
const gcn::ClipRectangle &clipArea = mClipStack.top();
+ transX += clipArea.xOffset;
+ transY += clipArea.yOffset;
+ if (transX || transY)
+ {
+ glTranslatef(static_cast<GLfloat>(transX),
+ static_cast<GLfloat>(transY), 0);
+ }
glScissor(clipArea.x, mRect.h - clipArea.y - clipArea.height,
clipArea.width, clipArea.height);
}
diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp
index d78cad4ad..4222051ea 100644
--- a/src/render/normalopenglgraphics.cpp
+++ b/src/render/normalopenglgraphics.cpp
@@ -1170,7 +1170,6 @@ bool NormalOpenGLGraphics::pushClipArea(gcn::Rectangle area)
transX += clipArea.xOffset;
transY += clipArea.yOffset;
- glPushMatrix();
if (transX || transY)
{
glTranslatef(static_cast<GLfloat>(transX),
@@ -1184,13 +1183,26 @@ bool NormalOpenGLGraphics::pushClipArea(gcn::Rectangle area)
void NormalOpenGLGraphics::popClipArea()
{
+ if (mClipStack.empty())
+ return;
+
+ const gcn::ClipRectangle &clipArea1 = mClipStack.top();
+ int transX = -clipArea1.xOffset;
+ int transY = -clipArea1.yOffset;
+
gcn::Graphics::popClipArea();
if (mClipStack.empty())
return;
- glPopMatrix();
const gcn::ClipRectangle &clipArea = mClipStack.top();
+ transX += clipArea.xOffset;
+ transY += clipArea.yOffset;
+ if (transX || transY)
+ {
+ glTranslatef(static_cast<GLfloat>(transX),
+ static_cast<GLfloat>(transY), 0);
+ }
glScissor(clipArea.x, mRect.h - clipArea.y - clipArea.height,
clipArea.width, clipArea.height);
}