summaryrefslogtreecommitdiff
path: root/src/opengl1graphics.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-01-22 02:20:43 +0300
committerAndrei Karas <akaras@inbox.ru>2012-01-22 02:20:43 +0300
commite71376322cbe85d59ca7d1a9d7f2a3db9ae9b914 (patch)
tree4e9f65c3ef67e6e06e1e1dca140e2d7ef6a22ff7 /src/opengl1graphics.cpp
parentb6eb53b9abdf48b88cb1978b9af97f2a879d2717 (diff)
parentacc25a7dffefb8b8b4e8022af918794d26048453 (diff)
downloadplus-e71376322cbe85d59ca7d1a9d7f2a3db9ae9b914.tar.gz
plus-e71376322cbe85d59ca7d1a9d7f2a3db9ae9b914.tar.bz2
plus-e71376322cbe85d59ca7d1a9d7f2a3db9ae9b914.tar.xz
plus-e71376322cbe85d59ca7d1a9d7f2a3db9ae9b914.zip
Merge commit 'v1.2.1.22' into stripped
Conflicts: data/fonts/mplus-1p-bold.ttf data/fonts/mplus-1p-regular.ttf src/CMakeLists.txt src/Makefile.am src/guichan/gui.cpp
Diffstat (limited to 'src/opengl1graphics.cpp')
-rw-r--r--src/opengl1graphics.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/opengl1graphics.cpp b/src/opengl1graphics.cpp
index 1f1a0231d..6f712f698 100644
--- a/src/opengl1graphics.cpp
+++ b/src/opengl1graphics.cpp
@@ -2,7 +2,7 @@
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
- * Copyright (C) 2011 The ManaPlus Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
@@ -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;
@@ -387,7 +390,8 @@ void OpenGL1Graphics::drawRescaledImagePattern(Image *image, int x, int y,
int dstX = x + px;
drawRescaledQuad(image, srcX, srcY, dstX, dstY,
- width, height, scaledWidth, scaledHeight);
+ width / scaleFactorW, height / scaleFactorH,
+ scaledWidth, scaledHeight);
}
}
@@ -474,6 +478,7 @@ SDL_Surface* OpenGL1Graphics::getScreenshot()
{
int h = mTarget->h;
int w = mTarget->w;
+ GLint pack = 1;
SDL_Surface *screenshot = SDL_CreateRGBSurface(
SDL_SWSURFACE,
@@ -484,6 +489,7 @@ SDL_Surface* OpenGL1Graphics::getScreenshot()
SDL_LockSurface(screenshot);
// Grap the pixel buffer and write it to the SDL surface
+ glGetIntegerv(GL_PACK_ALIGNMENT, &pack);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, screenshot->pixels);
@@ -505,6 +511,8 @@ SDL_Surface* OpenGL1Graphics::getScreenshot()
free(buf);
+ glPixelStorei(GL_PACK_ALIGNMENT, pack);
+
if (SDL_MUSTLOCK(screenshot))
SDL_UnlockSurface(screenshot);