diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-08-12 14:22:01 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-08-24 13:06:23 -0700 |
commit | 9c02e4d7dd536253f9ce3194fa9930a842fa4888 (patch) | |
tree | c0b9150419658925a43e0dd47895926eaaa2c624 /src | |
parent | d05486391a75de8dace7aec258121a92a3e698fb (diff) | |
download | qtlocation-mapboxgl-9c02e4d7dd536253f9ce3194fa9930a842fa4888.tar.gz |
[core] Inline Renderer::Impl::doRender
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/map/map.cpp | 6 | ||||
-rw-r--r-- | src/mbgl/renderer/renderer_impl.cpp | 58 | ||||
-rw-r--r-- | src/mbgl/renderer/renderer_impl.hpp | 2 |
3 files changed, 25 insertions, 41 deletions
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index b7978f0e9b..324bcc8b5d 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -196,6 +196,9 @@ void Map::Impl::onDidFinishRenderingFrame(RenderMode renderMode, bool needsRepai if (needsRepaint || transform.inTransition()) { onUpdate(Update::Repaint); } + } else if (stillImageRequest && rendererFullyLoaded) { + auto request = std::move(stillImageRequest); + request->callback(nullptr); } } @@ -206,9 +209,6 @@ void Map::Impl::onDidFinishRenderingMap() { loading = false; observer.onDidFinishLoadingMap(); } - } else if (stillImageRequest) { - auto request = std::move(stillImageRequest); - request->callback(nullptr); } }; diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp index 0e1e621770..fc1cfca518 100644 --- a/src/mbgl/renderer/renderer_impl.cpp +++ b/src/mbgl/renderer/renderer_impl.cpp @@ -243,47 +243,18 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { }; bool loaded = updateParameters.styleLoaded && isLoaded(); + if (updateParameters.mode == MapMode::Still && !loaded) { + return; + } - if (updateParameters.mode == MapMode::Continuous) { - if (renderState == RenderState::Never) { - observer->onWillStartRenderingMap(); - } - - observer->onWillStartRenderingFrame(); - - backend.updateAssumedState(); - - doRender(parameters); - parameters.context.performCleanup(); - - observer->onDidFinishRenderingFrame( - loaded ? RendererObserver::RenderMode::Full : RendererObserver::RenderMode::Partial, - hasTransitions() || frameHistory.needsAnimation(util::DEFAULT_TRANSITION_DURATION) - ); - - if (!loaded) { - renderState = RenderState::Partial; - } else if (renderState != RenderState::Fully) { - renderState = RenderState::Fully; - observer->onDidFinishRenderingMap(); - } - } else if (loaded) { + if (renderState == RenderState::Never) { observer->onWillStartRenderingMap(); - observer->onWillStartRenderingFrame(); - - backend.updateAssumedState(); - - doRender(parameters); + } - observer->onDidFinishRenderingFrame(RendererObserver::RenderMode::Full, false); - observer->onDidFinishRenderingMap(); + observer->onWillStartRenderingFrame(); - // Cleanup only after signaling completion - parameters.context.performCleanup(); - } -} + backend.updateAssumedState(); -void Renderer::Impl::doRender(PaintParameters& parameters) { if (parameters.contextMode == GLContextMode::Shared) { parameters.context.setDirtyState(); } @@ -606,6 +577,21 @@ void Renderer::Impl::doRender(PaintParameters& parameters) { parameters.context.bindVertexArray = 0; } + + observer->onDidFinishRenderingFrame( + loaded ? RendererObserver::RenderMode::Full : RendererObserver::RenderMode::Partial, + updateParameters.mode == MapMode::Continuous && (hasTransitions() || frameHistory.needsAnimation(util::DEFAULT_TRANSITION_DURATION)) + ); + + if (!loaded) { + renderState = RenderState::Partial; + } else if (renderState != RenderState::Fully) { + renderState = RenderState::Fully; + observer->onDidFinishRenderingMap(); + } + + // Cleanup only after signaling completion + parameters.context.performCleanup(); } std::vector<Feature> Renderer::Impl::queryRenderedFeatures(const ScreenLineString& geometry, const RenderedQueryOptions& options) const { diff --git a/src/mbgl/renderer/renderer_impl.hpp b/src/mbgl/renderer/renderer_impl.hpp index c326ebcac2..717834f6e8 100644 --- a/src/mbgl/renderer/renderer_impl.hpp +++ b/src/mbgl/renderer/renderer_impl.hpp @@ -57,8 +57,6 @@ public: void dumDebugLogs(); private: - void doRender(PaintParameters&); - bool isLoaded() const; bool hasTransitions() const; |