summaryrefslogtreecommitdiff
path: root/src/graphics.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-07-12 03:55:01 +0300
committerAndrei Karas <akaras@inbox.ru>2011-07-16 22:47:14 +0300
commitd0e6d477d245610288ab622ecf47426a9dcbc400 (patch)
treee998d168d8eb4397602021b3b1411f80cc1466a9 /src/graphics.cpp
parent68b1e0ec82321757f2a29792d38d7eabb7d2cf98 (diff)
downloadplus-d0e6d477d245610288ab622ecf47426a9dcbc400.tar.gz
plus-d0e6d477d245610288ab622ecf47426a9dcbc400.tar.bz2
plus-d0e6d477d245610288ab622ecf47426a9dcbc400.tar.xz
plus-d0e6d477d245610288ab622ecf47426a9dcbc400.zip
Add tiles caching for software mode.
Diffstat (limited to 'src/graphics.cpp')
-rw-r--r--src/graphics.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp
index d63c27324..88e88a905 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -26,6 +26,7 @@
#include "graphicsvertexes.h"
#include "log.h"
+#include "map.h"
#include "resources/image.h"
#include "resources/imageloader.h"
@@ -569,6 +570,49 @@ void Graphics::calcImagePattern(GraphicsVertexes* vert,
vert->incPtr(1);
}
+void Graphics::calcTile(ImageVertexes *vert, int x, int y)
+{
+ // Check that preconditions for blitting are met.
+ if (!vert || !vert->image || !vert->image->mSDLSurface)
+ return;
+
+ const Image *image = vert->image;
+
+ x += mClipStack.top().xOffset;
+ y += mClipStack.top().yOffset;
+
+ DoubleRect *rect = new DoubleRect();
+
+ rect->dst.x = static_cast<short>(x);
+ rect->dst.y = static_cast<short>(y);
+ rect->src.x = static_cast<short>(image->mBounds.x);
+ rect->src.y = static_cast<short>(image->mBounds.y);
+ rect->src.w = static_cast<Uint16>(image->mBounds.w);
+ rect->src.h = static_cast<Uint16>(image->mBounds.h);
+ if (SDL_FakeUpperBlit(image->mSDLSurface, &rect->src,
+ mTarget, &rect->dst) == 1)
+ {
+ vert->sdl.push_back(rect);
+ }
+ else
+ {
+ delete rect;
+ }
+}
+
+void Graphics::drawTile(ImageVertexes *vert)
+{
+ Image *img = vert->image;
+ DoubleRects *rects = &vert->sdl;
+ DoubleRects::iterator it = rects->begin();
+ DoubleRects::iterator it_end = rects->end();
+ while (it != it_end)
+ {
+ SDL_LowerBlit(img->mSDLSurface, &(*it)->src, mTarget, &(*it)->dst);
+ ++ it;
+ }
+}
+
void Graphics::updateScreen()
{
if (mDoubleBuffer)
@@ -845,3 +889,8 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle)
SDL_FillRect(mTarget, &rect, color);
}
}
+
+void Graphics::drawMapLayer(MapLayer *layer)
+{
+
+}