summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-11-06 21:13:16 +0300
committerAndrei Karas <akaras@inbox.ru>2012-11-07 12:46:08 +0300
commitd812d9fac7bae4eff66a5ce8275be19d0ca77a32 (patch)
tree7f9619d23a44202a76282849bb1284773302309f /src/map.cpp
parent1bcaac517036751a8fee9ff3d6561f5866e6969e (diff)
downloadmanaplus-d812d9fac7bae4eff66a5ce8275be19d0ca77a32.tar.gz
manaplus-d812d9fac7bae4eff66a5ce8275be19d0ca77a32.tar.bz2
manaplus-d812d9fac7bae4eff66a5ce8275be19d0ca77a32.tar.xz
manaplus-d812d9fac7bae4eff66a5ce8275be19d0ca77a32.zip
Add own profiler and profiler info to some code.
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/map.cpp b/src/map.cpp
index c31356276..f0fae1a9c 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -325,6 +325,7 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY)
if (!player_node)
return;
+ BLOCK_START("Map::draw")
// Calculate range of tiles which are on-screen
const int endPixelY = graphics->mHeight + scrollY + mTileHeight - 1
+ mMaxTileHeight - mTileHeight;
@@ -338,7 +339,9 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY)
// so that they overlap correctly
// if (mSpritesUpdated)
// {
+ BLOCK_START("Map::draw sort")
mActors.sort(actorCompare);
+ BLOCK_END("Map::draw sort")
// mSpritesUpdated = false;
// }
@@ -475,6 +478,7 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY)
}
drawAmbientLayers(graphics, FOREGROUND_LAYERS, mOverlayDetail);
+ BLOCK_END("Map::draw")
}
#define fillCollision(collision, color) \
@@ -546,6 +550,7 @@ void Map::drawCollision(Graphics *const graphics,
void Map::updateAmbientLayers(const float scrollX, const float scrollY)
{
+ BLOCK_START("Map::updateAmbientLayers")
static int lastTick = tick_time; // static = only initialized at first call
if (mLastAScrollX == 0.0f && mLastAScrollY == 0.0f)
@@ -575,14 +580,19 @@ void Map::updateAmbientLayers(const float scrollX, const float scrollY)
mLastAScrollX = scrollX;
mLastAScrollY = scrollY;
lastTick = tick_time;
+ BLOCK_END("Map::updateAmbientLayers")
}
void Map::drawAmbientLayers(Graphics *const graphics, const LayerType type,
const int detail)
{
+ BLOCK_START("Map::drawAmbientLayers")
// Detail 0 = no ambient effects except background image
if (detail <= 0 && type != BACKGROUND_LAYERS)
+ {
+ BLOCK_END("Map::drawAmbientLayers")
return;
+ }
// find out which layer list to draw
AmbientLayerVector *layers;
@@ -609,6 +619,7 @@ void Map::drawAmbientLayers(Graphics *const graphics, const LayerType type,
if (detail == 1)
break;
}
+ BLOCK_END("Map::drawAmbientLayers")
}
Tileset *Map::getTilesetWithGid(const int gid) const