summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-01-20 21:10:08 +0300
committerAndrei Karas <akaras@inbox.ru>2012-01-20 21:10:08 +0300
commit54b1228263aeb48c766806c0391fbfdffe0bc1a5 (patch)
tree78b07ff46ca61cf14cafe3a98bd3469477cbed3a
parent3ce8eb744df104efc83e625b0aeb7b8fed1c3c79 (diff)
downloadmanaverse-54b1228263aeb48c766806c0391fbfdffe0bc1a5.tar.gz
manaverse-54b1228263aeb48c766806c0391fbfdffe0bc1a5.tar.bz2
manaverse-54b1228263aeb48c766806c0391fbfdffe0bc1a5.tar.xz
manaverse-54b1228263aeb48c766806c0391fbfdffe0bc1a5.zip
Bit improve rescalled images drawing in fast opengl mode.
-rw-r--r--src/openglgraphics.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index dc7e37e17..b744a3caf 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -588,22 +588,25 @@ void OpenGLGraphics::drawRescaledImagePattern(Image *image,
const int height = (py + scaledHeight >= h)
? h - py : scaledHeight;
const int dstY = y + py;
+ const int scaledY = srcY + height / scaleFactorH;
for (int px = 0; px < w; px += scaledWidth)
{
- int width = (px + scaledWidth >= w) ? w - px : scaledWidth;
- int dstX = x + px;
+ const int width = (px + scaledWidth >= w)
+ ? w - px : scaledWidth;
+ const int dstX = x + px;
+ const int scaledX = srcX + width / scaleFactorW;
mIntTexArray[vp + 0] = srcX;
mIntTexArray[vp + 1] = srcY;
- mIntTexArray[vp + 2] = srcX + width / scaleFactorW;
+ mIntTexArray[vp + 2] = scaledX;
mIntTexArray[vp + 3] = srcY;
- mIntTexArray[vp + 4] = srcX + width / scaleFactorW;
- mIntTexArray[vp + 5] = srcY + height / scaleFactorH;
+ mIntTexArray[vp + 4] = scaledX;
+ mIntTexArray[vp + 5] = scaledY;
mIntTexArray[vp + 6] = srcX;
- mIntTexArray[vp + 7] = srcY + height / scaleFactorH;
+ mIntTexArray[vp + 7] = scaledY;
mIntVertArray[vp + 0] = dstX;
mIntVertArray[vp + 1] = dstY;