add rcScopedTimer to fix timers not being stopped on all paths and to prevent it in the future.

This commit is contained in:
Rafael Stahl
2015-12-18 14:48:31 +01:00
parent 68ec46a685
commit 6d3c9b38ba
10 changed files with 110 additions and 144 deletions
+4 -10
View File
@@ -37,7 +37,7 @@ void rcFilterLowHangingWalkableObstacles(rcContext* ctx, const int walkableClimb
{
rcAssert(ctx);
ctx->startTimer(RC_TIMER_FILTER_LOW_OBSTACLES);
rcScopedTimer timer(ctx, RC_TIMER_FILTER_LOW_OBSTACLES);
const int w = solid.width;
const int h = solid.height;
@@ -67,8 +67,6 @@ void rcFilterLowHangingWalkableObstacles(rcContext* ctx, const int walkableClimb
}
}
}
ctx->stopTimer(RC_TIMER_FILTER_LOW_OBSTACLES);
}
/// @par
@@ -86,7 +84,7 @@ void rcFilterLedgeSpans(rcContext* ctx, const int walkableHeight, const int walk
{
rcAssert(ctx);
ctx->startTimer(RC_TIMER_FILTER_BORDER);
rcScopedTimer timer(ctx, RC_TIMER_FILTER_BORDER);
const int w = solid.width;
const int h = solid.height;
@@ -167,9 +165,7 @@ void rcFilterLedgeSpans(rcContext* ctx, const int walkableHeight, const int walk
}
}
}
ctx->stopTimer(RC_TIMER_FILTER_BORDER);
}
}
/// @par
///
@@ -181,7 +177,7 @@ void rcFilterWalkableLowHeightSpans(rcContext* ctx, int walkableHeight, rcHeight
{
rcAssert(ctx);
ctx->startTimer(RC_TIMER_FILTER_WALKABLE);
rcScopedTimer timer(ctx, RC_TIMER_FILTER_WALKABLE);
const int w = solid.width;
const int h = solid.height;
@@ -202,6 +198,4 @@ void rcFilterWalkableLowHeightSpans(rcContext* ctx, int walkableHeight, rcHeight
}
}
}
ctx->stopTimer(RC_TIMER_FILTER_WALKABLE);
}