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/openglgraphics.cpp | |
parent | a913dd41df61760de6ece552f941e002251ff54c (diff) | |
parent | d340b5a27a8f3b05d1764da9c114f5f59bd0cd46 (diff) | |
download | plus-8b612abb42853a22c1a9545e2c9280d154646543.tar.gz plus-8b612abb42853a22c1a9545e2c9280d154646543.tar.bz2 plus-8b612abb42853a22c1a9545e2c9280d154646543.tar.xz plus-8b612abb42853a22c1a9545e2c9280d154646543.zip |
Merge branch 'master' of gitorious.org:manaplus/manaplus
Diffstat (limited to 'src/openglgraphics.cpp')
-rw-r--r-- | src/openglgraphics.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index f5e9f8107..b744a3caf 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.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. * @@ -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; @@ -1020,6 +1023,7 @@ SDL_Surface* OpenGLGraphics::getScreenshot() { int h = mTarget->h; int w = mTarget->w; + GLint pack = 1; SDL_Surface *screenshot = SDL_CreateRGBSurface( SDL_SWSURFACE, @@ -1033,6 +1037,7 @@ SDL_Surface* OpenGLGraphics::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); @@ -1054,6 +1059,8 @@ SDL_Surface* OpenGLGraphics::getScreenshot() free(buf); + glPixelStorei(GL_PACK_ALIGNMENT, pack); + if (SDL_MUSTLOCK(screenshot)) SDL_UnlockSurface(screenshot); |