summaryrefslogtreecommitdiff
path: root/src/resources/map
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-16 19:33:00 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-16 19:33:00 +0300
commita1a952c2b32d04477f3e10c0e40976f71adfa550 (patch)
tree2d4255c2d0509e7e35d6690359d7e06e97a21bf5 /src/resources/map
parent124cc470b5d66a7e2d1b2f49b5cccc0832db6779 (diff)
downloadmv-a1a952c2b32d04477f3e10c0e40976f71adfa550.tar.gz
mv-a1a952c2b32d04477f3e10c0e40976f71adfa550.tar.bz2
mv-a1a952c2b32d04477f3e10c0e40976f71adfa550.tar.xz
mv-a1a952c2b32d04477f3e10c0e40976f71adfa550.zip
Improve a bit map draw speed.
Diffstat (limited to 'src/resources/map')
-rw-r--r--src/resources/map/map.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index 4927485d4..e016654e8 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -341,7 +341,7 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY)
// Make sure actors are sorted ascending by Y-coordinate
// so that they overlap correctly
BLOCK_START("Map::draw sort")
- mActors.sort(actorCompare);
+ mActors.sort(actorCompare);
BLOCK_END("Map::draw sort")
// update scrolling of all ambient layers
@@ -404,20 +404,27 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY)
{
if (mCachedDraw)
{
- FOR_EACH (Layers::iterator, it, mDrawUnderLayers)
+ if (updateFlag)
{
- MapLayer *const layer = *it;
- if (updateFlag)
+ FOR_EACH (Layers::iterator, it, mDrawUnderLayers)
{
- layer->updateOGL(graphics,
+ (*it)->updateOGL(graphics,
+ startX, startY,
+ endX, endY,
+ scrollX, scrollY);
+ }
+ FOR_EACH (Layers::iterator, it, mDrawOverLayers)
+ {
+ (*it)->updateOGL(graphics,
startX, startY,
endX, endY,
scrollX, scrollY);
}
-
- layer->drawOGL(graphics);
}
+ FOR_EACH (Layers::iterator, it, mDrawUnderLayers)
+ (*it)->drawOGL(graphics);
+
if (mFringeLayer)
{
mFringeLayer->setSpecialLayer(mSpecialLayer);
@@ -430,18 +437,7 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY)
}
FOR_EACH (Layers::iterator, it, mDrawOverLayers)
- {
- MapLayer *const layer = *it;
- if (updateFlag)
- {
- layer->updateOGL(graphics,
- startX, startY,
- endX, endY,
- scrollX, scrollY);
- }
-
- layer->drawOGL(graphics);
- }
+ (*it)->drawOGL(graphics);
}
else
{