summaryrefslogtreecommitdiff
path: root/src/render/surfacegraphics.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-12-29 21:22:33 +0300
committerAndrei Karas <akaras@inbox.ru>2013-12-29 21:22:33 +0300
commitf94a6551b8d140e272ac1c46bce1ff0e5df34986 (patch)
tree35c764dfec7b76f926c30cd186b6fe36968b6529 /src/render/surfacegraphics.cpp
parent0336b91f51cdf14e022f74d16c15892b63b658eb (diff)
downloadmv-f94a6551b8d140e272ac1c46bce1ff0e5df34986.tar.gz
mv-f94a6551b8d140e272ac1c46bce1ff0e5df34986.tar.bz2
mv-f94a6551b8d140e272ac1c46bce1ff0e5df34986.tar.xz
mv-f94a6551b8d140e272ac1c46bce1ff0e5df34986.zip
improve draw image calls.
Diffstat (limited to 'src/render/surfacegraphics.cpp')
-rw-r--r--src/render/surfacegraphics.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/render/surfacegraphics.cpp b/src/render/surfacegraphics.cpp
index db2722164..fe2926473 100644
--- a/src/render/surfacegraphics.cpp
+++ b/src/render/surfacegraphics.cpp
@@ -42,27 +42,23 @@ SurfaceGraphics::~SurfaceGraphics()
{
}
-bool SurfaceGraphics::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 SurfaceGraphics::drawImage2(const Image *const image,
+ int dstX, int dstY)
{
FUNC_BLOCK("Graphics::drawImage2", 1)
// Check that preconditions for blitting are met.
if (!mTarget || !image || !image->mSDLSurface)
return false;
- srcX += image->mBounds.x;
- srcY += image->mBounds.y;
-
+ const SDL_Rect &imageRect = image->mBounds;
SDL_Rect dstRect;
SDL_Rect srcRect;
dstRect.x = static_cast<int16_t>(dstX);
dstRect.y = static_cast<int16_t>(dstY);
- srcRect.x = static_cast<int16_t>(srcX);
- srcRect.y = static_cast<int16_t>(srcY);
- srcRect.w = static_cast<uint16_t>(width);
- srcRect.h = static_cast<uint16_t>(height);
+ srcRect.x = static_cast<int16_t>(imageRect.x);
+ srcRect.y = static_cast<int16_t>(imageRect.y);
+ srcRect.w = static_cast<uint16_t>(imageRect.w);
+ srcRect.h = static_cast<uint16_t>(imageRect.h);
#ifdef USE_SDL2
return !(SDL_BlitSurface(image->mSDLSurface, &srcRect,