diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-07-13 08:34:15 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-07-13 08:34:15 +0200 |
commit | 353a4bb01c7050273007527b33afc76d25d6cc71 (patch) | |
tree | 68ce34f4b7f8a961380b9e4090e4613a27deee73 /src | |
parent | e8bb63f0a1dadcb75ccf5b6928d055f22375fca1 (diff) | |
download | mana-353a4bb01c7050273007527b33afc76d25d6cc71.tar.gz mana-353a4bb01c7050273007527b33afc76d25d6cc71.tar.bz2 mana-353a4bb01c7050273007527b33afc76d25d6cc71.tar.xz mana-353a4bb01c7050273007527b33afc76d25d6cc71.zip |
Small optimization in OpenGL clip area code
I added mScale later and forgot to make the clip area code use it.
Diffstat (limited to 'src')
-rw-r--r-- | src/openglgraphics.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index b6048202..14c32a95 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -726,8 +726,6 @@ SDL_Surface* OpenGLGraphics::getScreenshot() bool OpenGLGraphics::pushClipArea(gcn::Rectangle area) { - const double ratio = (double) mTarget->w / mWidth; - int transX = 0; int transY = 0; @@ -742,11 +740,11 @@ bool OpenGLGraphics::pushClipArea(gcn::Rectangle area) transX += mClipStack.top().xOffset; transY += mClipStack.top().yOffset; - int x = (int) (mClipStack.top().x * ratio); + int x = (int) (mClipStack.top().x * mScale); int y = mTarget->h - (int) ((mClipStack.top().y + - mClipStack.top().height) * ratio); - int width = (int) (mClipStack.top().width * ratio); - int height = (int) (mClipStack.top().height * ratio); + mClipStack.top().height) * mScale); + int width = (int) (mClipStack.top().width * mScale); + int height = (int) (mClipStack.top().height * mScale); glPushMatrix(); glTranslatef(transX, transY, 0); @@ -762,12 +760,11 @@ void OpenGLGraphics::popClipArea() if (mClipStack.empty()) return; - const double ratio = (double) mTarget->w / mWidth; - int x = (int) (mClipStack.top().x * ratio); + int x = (int) (mClipStack.top().x * mScale); int y = mTarget->h - (int) ((mClipStack.top().y + - mClipStack.top().height) * ratio); - int width = (int) (mClipStack.top().width * ratio); - int height = (int) (mClipStack.top().height * ratio); + mClipStack.top().height) * mScale); + int width = (int) (mClipStack.top().width * mScale); + int height = (int) (mClipStack.top().height * mScale); glPopMatrix(); glScissor(x, y, width, height); |