[core] only update the render order array when there are changes to tiles

This commit is contained in:
Konstantin Käfer
2015-08-20 15:34:32 -04:00
parent 24285926c2
commit 177372b836
4 changed files with 31 additions and 22 deletions

View File

@@ -242,7 +242,11 @@ bool MapContext::renderSync(const TransformState& state, const FrameData& frame)
// Cleanup OpenGL objects that we abandoned since the last render call.
glObjectStore.performCleanup();
if (!painter) painter = std::make_unique<Painter>(data);
if (!painter) {
painter = std::make_unique<Painter>(data);
painter->updateRenderOrder(*style);
}
painter->render(*style, transformState, frame);
if (data.mode == MapMode::Still) {
@@ -314,6 +318,10 @@ void MapContext::setSprite(const std::string& name, std::shared_ptr<const Sprite
void MapContext::onTileDataChanged() {
assert(util::ThreadContext::currentlyOn(util::ThreadType::Map));
if (painter) {
painter->updateRenderOrder(*style);
}
updateFlags |= Update::Repaint;
asyncUpdate->send();
}