diff options
author | Reid <reidyaro@gmail.com> | 2012-01-25 22:05:36 +0100 |
---|---|---|
committer | Reid <reidyaro@gmail.com> | 2012-01-25 22:05:36 +0100 |
commit | 8b612abb42853a22c1a9545e2c9280d154646543 (patch) | |
tree | f466167087c2b2de4b8aa9e6d1d1986f72f84147 /src/opengl1graphics.cpp | |
parent | a913dd41df61760de6ece552f941e002251ff54c (diff) | |
parent | d340b5a27a8f3b05d1764da9c114f5f59bd0cd46 (diff) | |
download | manaverse-8b612abb42853a22c1a9545e2c9280d154646543.tar.gz manaverse-8b612abb42853a22c1a9545e2c9280d154646543.tar.bz2 manaverse-8b612abb42853a22c1a9545e2c9280d154646543.tar.xz manaverse-8b612abb42853a22c1a9545e2c9280d154646543.zip |
Merge branch 'master' of gitorious.org:manaplus/manaplus
Diffstat (limited to 'src/opengl1graphics.cpp')
-rw-r--r-- | src/opengl1graphics.cpp | 12 |
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); |