From 3ce8eb744df104efc83e625b0aeb7b8fed1c3c79 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 20 Jan 2012 20:13:17 +0300 Subject: Fix ambient layer scalling in safe opengl mode. --- src/opengl1graphics.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') 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); } } -- cgit v1.2.3-60-g2f50