diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-05-12 17:30:40 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-05-13 10:39:22 +0200 |
commit | e2749597534d351d81cb8c2a2bc9b9886fef8028 (patch) | |
tree | da40b97177e848337d01aac8a1e4e1b8711f81ca /src | |
parent | 3ec48b10300e3fdd56851e80f830423123a106d4 (diff) | |
download | qtlocation-mapboxgl-e2749597534d351d81cb8c2a2bc9b9886fef8028.tar.gz |
abort rendering early when we don't need to
when rendering still images, we don't need to render until everything is completely loaded
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/map/map_context.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp index b239eb18a8..087b9ae9bf 100644 --- a/src/mbgl/map/map_context.cpp +++ b/src/mbgl/map/map_context.cpp @@ -216,6 +216,11 @@ void MapContext::render() { // Cleanup OpenGL objects that we abandoned since the last render call. env.performCleanup(); + if (data.mode == MapMode::Still && (!callback || !data.getFullyLoaded())) { + // We are either not waiting for a map to be rendered, or we don't have all resources yet. + return; + } + assert(style); if (!painter) { @@ -226,7 +231,7 @@ void MapContext::render() { painter->setDebug(data.getDebug()); painter->render(*style, transformState, data.getAnimationTime()); - if (data.mode == MapMode::Still && callback && style->isLoaded() && resourceLoader->getSprite()->isLoaded()) { + if (data.mode == MapMode::Still) { callback(view.readStillImage()); callback = nullptr; } |