From 353a4bb01c7050273007527b33afc76d25d6cc71 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Fri, 13 Jul 2012 08:34:15 +0200 Subject: Small optimization in OpenGL clip area code I added mScale later and forgot to make the clip area code use it. --- src/openglgraphics.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src') 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); -- cgit v1.2.3-60-g2f50