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/sdlgraphics.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/render/sdlgraphics.cpp') diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp index c46b65000..ef1f2d2a5 100644 --- a/src/render/sdlgraphics.cpp +++ b/src/render/sdlgraphics.cpp @@ -104,9 +104,8 @@ bool SDLGraphics::drawRescaledImage(const Image *const image, return returnValue; } -bool SDLGraphics::drawImage2(const Image *const image, int srcX, int srcY, - int dstX, int dstY, const int width, - const int height, const bool useColor A_UNUSED) +bool SDLGraphics::drawImage2(const Image *const image, + int dstX, int dstY) { FUNC_BLOCK("Graphics::drawImage2", 1) // Check that preconditions for blitting are met. @@ -118,13 +117,13 @@ bool SDLGraphics::drawImage2(const Image *const image, int srcX, int srcY, SDL_Surface *const src = image->mSDLSurface; - srcX += bounds.x; - srcY += bounds.y; + int srcX = bounds.x; + int srcY = bounds.y; dstX += top.xOffset; dstY += top.yOffset; - int w = width; - int h = height; + int w = bounds.w; + int h = bounds.h; if (srcX < 0) { w += srcX; @@ -174,8 +173,8 @@ bool SDLGraphics::drawImage2(const Image *const image, int srcX, int srcY, { SDL_Rect srcRect = { - static_cast(srcX), - static_cast(srcY), + static_cast(0), + static_cast(0), static_cast(w), static_cast(h) }; -- cgit v1.2.3-60-g2f50