summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/opengl1graphics.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/opengl1graphics.cpp b/src/opengl1graphics.cpp
index 672962f7b..b6ecd068b 100644
--- a/src/opengl1graphics.cpp
+++ b/src/opengl1graphics.cpp
@@ -377,6 +377,9 @@ void OpenGL1Graphics::drawRescaledImagePattern(Image *image, int x, int y,
// Draw a set of textured rectangles
glBegin(GL_QUADS);
+ const float scaleFactorW = (float) scaledWidth / image->getWidth();
+ const float scaleFactorH = (float) scaledHeight / image->getHeight();
+
for (int py = 0; py < h; py += ih)
{
const int height = (py + ih >= h) ? h - py : ih;
@@ -386,8 +389,8 @@ void OpenGL1Graphics::drawRescaledImagePattern(Image *image, int x, int y,
int width = (px + iw >= w) ? w - px : iw;
int dstX = x + px;
- drawRescaledQuad(image, srcX, srcY, dstX, dstY,
- width, height, scaledWidth, scaledHeight);
+ drawRescaledQuad(image, srcX, srcY, dstX, dstY, width / scaleFactorW,
+ height / scaleFactorH, scaledWidth, scaledHeight);
}
}