From f94a6551b8d140e272ac1c46bce1ff0e5df34986 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 29 Dec 2013 21:22:33 +0300 Subject: improve draw image calls. --- src/render/nullopenglgraphics.cpp | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'src/render/nullopenglgraphics.cpp') diff --git a/src/render/nullopenglgraphics.cpp b/src/render/nullopenglgraphics.cpp index ab1291233..9e0b49aeb 100644 --- a/src/render/nullopenglgraphics.cpp +++ b/src/render/nullopenglgraphics.cpp @@ -138,30 +138,22 @@ static inline void drawRescaledQuad(const Image *const image A_UNUSED, bool NullOpenGLGraphics::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; - const SDL_Rect &imageRect = image->mBounds; - srcX += imageRect.x; - srcY += imageRect.y; - - if (!useColor) - setColorAlpha(image->mAlpha); - + setColorAlpha(image->mAlpha); #ifdef DEBUG_BIND_TEXTURE debugBindTexture(image); #endif bindTexture(OpenGLImageHelper::mTextureType, image->mGLImage); - setTexturingAndBlending(true); - drawQuad(image, srcX, srcY, dstX, dstY, width, height); + const SDL_Rect &imageRect = image->mBounds; + drawQuad(image, imageRect.x, imageRect.y, dstX, dstY, + imageRect.w, imageRect.h); return true; } @@ -211,10 +203,7 @@ bool NullOpenGLGraphics::drawRescaledImage(const Image *const image, // 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. -- cgit v1.2.3-60-g2f50