diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-12-29 21:22:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-12-29 21:22:33 +0300 |
commit | f94a6551b8d140e272ac1c46bce1ff0e5df34986 (patch) | |
tree | 35c764dfec7b76f926c30cd186b6fe36968b6529 /src/render/safeopenglgraphics.cpp | |
parent | 0336b91f51cdf14e022f74d16c15892b63b658eb (diff) | |
download | manaverse-f94a6551b8d140e272ac1c46bce1ff0e5df34986.tar.gz manaverse-f94a6551b8d140e272ac1c46bce1ff0e5df34986.tar.bz2 manaverse-f94a6551b8d140e272ac1c46bce1ff0e5df34986.tar.xz manaverse-f94a6551b8d140e272ac1c46bce1ff0e5df34986.zip |
improve draw image calls.
Diffstat (limited to 'src/render/safeopenglgraphics.cpp')
-rw-r--r-- | src/render/safeopenglgraphics.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp index 1170f0300..614c4158c 100644 --- a/src/render/safeopenglgraphics.cpp +++ b/src/render/safeopenglgraphics.cpp @@ -140,26 +140,21 @@ static inline void drawRescaledQuad(const Image *const image, bool SafeOpenGLGraphics::drawImage2(const Image *const image, - int srcX, int srcY, - int dstX, int dstY, - const int width, const int height, - const bool useColor) + int dstX, int dstY) { FUNC_BLOCK("Graphics::drawImage2", 1) if (!image) return false; - if (!useColor) - setColorAlpha(image->mAlpha); - + setColorAlpha(image->mAlpha); bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); - setTexturingAndBlending(true); + const SDL_Rect &bounds = image->mBounds; // Draw a textured quad. glBegin(GL_QUADS); - drawQuad(image, srcX + image->mBounds.x, srcY + image->mBounds.y, - dstX, dstY, width, height); + drawQuad(image, bounds.x, bounds.y, + dstX, dstY, bounds.w, bounds.h); glEnd(); return true; @@ -254,10 +249,7 @@ bool SafeOpenGLGraphics::drawRescaledImage(const Image *const image, int srcX, // Just draw the image normally when no resizing is necessary, if (width == desiredWidth && height == desiredHeight) - { - return drawImage2(image, srcX, srcY, dstX, dstY, - width, height, useColor); - } + return drawImage2(image, dstX, dstY); // When the desired image is smaller than the current one, // disable smooth effect. |