summaryrefslogtreecommitdiff
path: root/src/render/surfacegraphics.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-12-28 23:06:17 +0300
committerAndrei Karas <akaras@inbox.ru>2013-12-29 14:55:33 +0300
commitc9f8bba932022ffd90031713c51861587f86b244 (patch)
treedb2184f1a1ac5649792c5ac57415bfa71a2c307a /src/render/surfacegraphics.cpp
parent9bc564d99774045fa0c10f253dd54b223416bc34 (diff)
downloadmv-c9f8bba932022ffd90031713c51861587f86b244.tar.gz
mv-c9f8bba932022ffd90031713c51861587f86b244.tar.bz2
mv-c9f8bba932022ffd90031713c51861587f86b244.tar.xz
mv-c9f8bba932022ffd90031713c51861587f86b244.zip
Add cached draw methods into renderers.
Diffstat (limited to 'src/render/surfacegraphics.cpp')
-rw-r--r--src/render/surfacegraphics.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/render/surfacegraphics.cpp b/src/render/surfacegraphics.cpp
index 879d44f60..db2722164 100644
--- a/src/render/surfacegraphics.cpp
+++ b/src/render/surfacegraphics.cpp
@@ -80,3 +80,41 @@ bool SurfaceGraphics::drawImage2(const Image *const image, int srcX, int srcY,
}
#endif
}
+
+void SurfaceGraphics::drawImageCached(const Image *const image,
+ int x, int y)
+{
+ FUNC_BLOCK("Graphics::drawImageCached", 1)
+ // Check that preconditions for blitting are met.
+ if (!mTarget || !image || !image->mSDLSurface)
+ return;
+
+ const SDL_Rect &rect = image->mBounds;
+
+ SDL_Rect dstRect;
+ SDL_Rect srcRect;
+ dstRect.x = static_cast<int16_t>(x);
+ dstRect.y = static_cast<int16_t>(y);
+ srcRect.x = static_cast<int16_t>(rect.x);
+ srcRect.y = static_cast<int16_t>(rect.y);
+ srcRect.w = static_cast<uint16_t>(rect.w);
+ srcRect.h = static_cast<uint16_t>(rect.h);
+
+#ifdef USE_SDL2
+ SDL_BlitSurface(image->mSDLSurface, &srcRect, mTarget, &dstRect);
+#else
+ if (mBlitMode == BLIT_NORMAL)
+ {
+ SDL_BlitSurface(image->mSDLSurface, &srcRect, mTarget, &dstRect);
+ }
+ else
+ {
+ SurfaceImageHelper::combineSurface(image->mSDLSurface, &srcRect,
+ mTarget, &dstRect);
+ }
+#endif
+}
+
+void SurfaceGraphics::completeCache()
+{
+}