diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-07-21 16:36:31 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-07-26 09:50:38 -0700 |
commit | d4cb498d7abc612029c575fb290eb649a4697d57 (patch) | |
tree | 9e9221873a3c51ef538402f1f7dec4055cb828e5 | |
parent | 32bd1d54fa777035920b58e653905e4592ef187c (diff) | |
download | qtlocation-mapboxgl-d4cb498d7abc612029c575fb290eb649a4697d57.tar.gz |
[all] Merge View into RendererBackend
33 files changed, 53 insertions, 98 deletions
diff --git a/cmake/core-files.cmake b/cmake/core-files.cmake index 93bc8326d4..1bbe739256 100644 --- a/cmake/core-files.cmake +++ b/cmake/core-files.cmake @@ -107,7 +107,6 @@ set(MBGL_CORE_FILES include/mbgl/map/map.hpp include/mbgl/map/map_observer.hpp include/mbgl/map/mode.hpp - include/mbgl/map/view.hpp src/mbgl/map/map.cpp src/mbgl/map/transform.cpp src/mbgl/map/transform.hpp diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 14f42d7fd5..7d6678dc93 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -17,8 +17,6 @@ namespace mbgl { -class Backend; -class View; class FileSource; class Scheduler; class RendererFrontend; diff --git a/include/mbgl/map/view.hpp b/include/mbgl/map/view.hpp deleted file mode 100644 index 295779fe51..0000000000 --- a/include/mbgl/map/view.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -namespace mbgl { - -class Map; - -class View { -public: - virtual ~View() = default; - - // Called when this View is used for rendering. Implementations should ensure that a renderable - // object is bound and glClear/glDraw* calls can be done. They should also make sure that - // calling .bind() repeatedly is a no-op and that the appropriate gl::Context values are - // set to the current state. - virtual void bind() = 0; -}; - -} // namespace mbgl diff --git a/include/mbgl/renderer/renderer.hpp b/include/mbgl/renderer/renderer.hpp index 083102acbe..95828a1b79 100644 --- a/include/mbgl/renderer/renderer.hpp +++ b/include/mbgl/renderer/renderer.hpp @@ -20,7 +20,6 @@ class RenderedQueryOptions; class Scheduler; class SourceQueryOptions; class UpdateParameters; -class View; class Renderer { public: @@ -31,7 +30,7 @@ public: void setObserver(RendererObserver*); - void render(View& view, const UpdateParameters&); + void render(const UpdateParameters&); // Feature queries std::vector<Feature> queryRenderedFeatures(const ScreenLineString&, const RenderedQueryOptions& options = {}) const; diff --git a/include/mbgl/renderer/renderer_backend.hpp b/include/mbgl/renderer/renderer_backend.hpp index c12e162fd1..f7d19a1791 100644 --- a/include/mbgl/renderer/renderer_backend.hpp +++ b/include/mbgl/renderer/renderer_backend.hpp @@ -1,6 +1,5 @@ #pragma once -#include <mbgl/map/view.hpp> #include <mbgl/renderer/backend_scope.hpp> #include <mbgl/util/image.hpp> #include <mbgl/util/size.hpp> @@ -30,6 +29,12 @@ public: // Called prior to rendering to update the internally assumed OpenGL state. virtual void updateAssumedState() = 0; + // Called when this backend is used for rendering. Implementations should ensure that a renderable + // object is bound and glClear/glDraw* calls can be done. They should also make sure that + // calling .bind() repeatedly is a no-op and that the appropriate gl::Context values are + // set to the current state. + virtual void bind() = 0; + protected: // Called with the name of an OpenGL extension that should be loaded. RendererBackend implementations // must call the API-specific version that obtains the function pointer for this function, diff --git a/platform/android/src/android_renderer_frontend.cpp b/platform/android/src/android_renderer_frontend.cpp index 41e44d297a..597bebe40d 100644 --- a/platform/android/src/android_renderer_frontend.cpp +++ b/platform/android/src/android_renderer_frontend.cpp @@ -1,6 +1,5 @@ #include "android_renderer_frontend.hpp" -#include <mbgl/map/view.hpp> #include <mbgl/renderer/backend_scope.hpp> #include <mbgl/renderer/renderer.hpp> @@ -37,13 +36,13 @@ void AndroidRendererFrontend::update(std::shared_ptr<UpdateParameters> params) { asyncInvalidate.send(); } -void AndroidRendererFrontend::render(View& view) { +void AndroidRendererFrontend::render() { assert (renderer); if (!updateParameters) return; BackendScope guard { backend }; - renderer->render(view, *updateParameters); + renderer->render(*updateParameters); } void AndroidRendererFrontend::onLowMemory() { diff --git a/platform/android/src/android_renderer_frontend.hpp b/platform/android/src/android_renderer_frontend.hpp index 59ece88f19..107bbbe0b6 100644 --- a/platform/android/src/android_renderer_frontend.hpp +++ b/platform/android/src/android_renderer_frontend.hpp @@ -13,9 +13,7 @@ namespace mbgl { -class View; class Renderer; -class View; class RenderedQueryOptions; class SourceQueryOptions; @@ -31,7 +29,7 @@ public: void setObserver(RendererObserver&) override; void update(std::shared_ptr<UpdateParameters>) override; - void render(View& view); + void render(); // Feature querying std::vector<Feature> queryRenderedFeatures(const ScreenCoordinate&, const RenderedQueryOptions&) const; diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index 17f55d9827..fa9e90ddc6 100755 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -107,7 +107,7 @@ NativeMapView::~NativeMapView() { } /** - * From mbgl::View + * From mbgl::RendererBackend */ void NativeMapView::bind() { setFramebufferBinding(0); @@ -275,7 +275,7 @@ void NativeMapView::render(jni::JNIEnv& env) { framebufferSizeChanged = false; } - rendererFrontend->render(*this); + rendererFrontend->render(); if(snapshot){ snapshot = false; diff --git a/platform/android/src/native_map_view.hpp b/platform/android/src/native_map_view.hpp index 387593350a..ba1545728a 100755 --- a/platform/android/src/native_map_view.hpp +++ b/platform/android/src/native_map_view.hpp @@ -4,7 +4,6 @@ #include <mbgl/map/change.hpp> #include <mbgl/map/camera.hpp> #include <mbgl/map/map.hpp> -#include <mbgl/map/view.hpp> #include <mbgl/util/noncopyable.hpp> #include <mbgl/util/default_thread_pool.hpp> #include <mbgl/util/run_loop.hpp> @@ -38,7 +37,7 @@ namespace android { class AndroidRendererFrontend; -class NativeMapView : public View, public RendererBackend, public MapObserver { +class NativeMapView : public RendererBackend, public MapObserver { public: static constexpr auto Name() { return "com/mapbox/mapboxsdk/maps/NativeMapView"; }; @@ -55,12 +54,9 @@ public: virtual ~NativeMapView(); - // mbgl::View // - - void bind() override; - // mbgl::RendererBackend // + void bind() override; void updateAssumedState() override; // Deprecated // diff --git a/platform/darwin/src/MGLRendererFrontend.h b/platform/darwin/src/MGLRendererFrontend.h index 3611577f2e..76904d008b 100644 --- a/platform/darwin/src/MGLRendererFrontend.h +++ b/platform/darwin/src/MGLRendererFrontend.h @@ -13,12 +13,10 @@ class MGLRenderFrontend : public mbgl::RendererFrontend { public: - MGLRenderFrontend(std::unique_ptr<mbgl::Renderer> renderer_, MGLMapView* nativeView_, mbgl::RendererBackend& mbglBackend_, mbgl::View& mbglView_, bool async = false) + MGLRenderFrontend(std::unique_ptr<mbgl::Renderer> renderer_, MGLMapView* nativeView_, mbgl::RendererBackend& mbglBackend_, bool async = false) : renderer(std::move(renderer_)) , nativeView(nativeView_) - , mbglBackend(mbglBackend_) - , mbglView(mbglView_) { - + , mbglBackend(mbglBackend_) { if (async) { asyncInvalidate.emplace([&]() { [nativeView setNeedsGLDisplay]; @@ -51,7 +49,7 @@ public: mbgl::BackendScope guard { mbglBackend, mbgl::BackendScope::ScopeType::Implicit }; - renderer->render(mbglView, *updateParameters); + renderer->render(*updateParameters); } mbgl::Renderer* getRenderer() { @@ -67,7 +65,6 @@ private: std::unique_ptr<mbgl::Renderer> renderer; __weak MGLMapView *nativeView = nullptr; mbgl::RendererBackend& mbglBackend; - mbgl::View& mbglView; std::shared_ptr<mbgl::UpdateParameters> updateParameters; mbgl::optional<mbgl::util::AsyncTask> asyncInvalidate; }; diff --git a/platform/default/mbgl/gl/headless_backend.hpp b/platform/default/mbgl/gl/headless_backend.hpp index d845e9930c..8d86ea8c47 100644 --- a/platform/default/mbgl/gl/headless_backend.hpp +++ b/platform/default/mbgl/gl/headless_backend.hpp @@ -1,6 +1,5 @@ #pragma once -#include <mbgl/map/view.hpp> #include <mbgl/renderer/renderer_backend.hpp> #include <memory> @@ -10,7 +9,7 @@ namespace mbgl { class HeadlessDisplay; -class HeadlessBackend : public View, public RendererBackend { +class HeadlessBackend : public RendererBackend { public: HeadlessBackend(Size = { 256, 256 }); ~HeadlessBackend() override; diff --git a/platform/default/mbgl/gl/headless_frontend.cpp b/platform/default/mbgl/gl/headless_frontend.cpp index 3f34d8eeba..ad03706be7 100644 --- a/platform/default/mbgl/gl/headless_frontend.cpp +++ b/platform/default/mbgl/gl/headless_frontend.cpp @@ -17,7 +17,7 @@ HeadlessFrontend::HeadlessFrontend(Size size_, float pixelRatio_, FileSource& fi asyncInvalidate([this] { if (renderer && updateParameters) { mbgl::BackendScope guard { backend }; - renderer->render(backend, *updateParameters); + renderer->render(*updateParameters); } }), renderer(std::make_unique<Renderer>(backend, pixelRatio, fileSource, scheduler)) { diff --git a/platform/glfw/glfw_renderer_frontend.cpp b/platform/glfw/glfw_renderer_frontend.cpp index d0fefadf14..73205f1c56 100644 --- a/platform/glfw/glfw_renderer_frontend.cpp +++ b/platform/glfw/glfw_renderer_frontend.cpp @@ -32,7 +32,7 @@ void GLFWRendererFrontend::render() { mbgl::BackendScope guard { glfwView, mbgl::BackendScope::ScopeType::Implicit }; - renderer->render(glfwView, *updateParameters); + renderer->render(*updateParameters); } mbgl::Renderer* GLFWRendererFrontend::getRenderer() { diff --git a/platform/glfw/glfw_view.hpp b/platform/glfw/glfw_view.hpp index 12035f3e39..ccde4f027f 100644 --- a/platform/glfw/glfw_view.hpp +++ b/platform/glfw/glfw_view.hpp @@ -1,7 +1,6 @@ #pragma once #include <mbgl/map/map.hpp> -#include <mbgl/map/view.hpp> #include <mbgl/renderer/renderer_backend.hpp> #include <mbgl/util/run_loop.hpp> #include <mbgl/util/timer.hpp> @@ -10,7 +9,7 @@ struct GLFWwindow; class GLFWRendererFrontend; -class GLFWView : public mbgl::View, public mbgl::RendererBackend, public mbgl::MapObserver { +class GLFWView : public mbgl::RendererBackend, public mbgl::MapObserver { public: GLFWView(bool fullscreen = false, bool benchmark = false); ~GLFWView() override; @@ -37,12 +36,11 @@ public: void invalidate(); - // mbgl::View implementation - void bind() override; mbgl::Size getSize() const; mbgl::Size getFramebufferSize() const; // mbgl::RendererBackend implementation + void bind() override; void updateAssumedState() override; // mbgl::MapObserver implementation diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 83ea4a8d8f..175e1f125d 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -6,7 +6,6 @@ #import <OpenGLES/EAGL.h> #include <mbgl/map/map.hpp> -#include <mbgl/map/view.hpp> #include <mbgl/annotation/annotation.hpp> #include <mbgl/map/camera.hpp> #include <mbgl/map/mode.hpp> @@ -455,7 +454,7 @@ public: _mbglThreadPool = mbgl::sharedThreadPool(); auto renderer = std::make_unique<mbgl::Renderer>(*_mbglView, scaleFactor, *mbglFileSource, *_mbglThreadPool, mbgl::GLContextMode::Unique); - _rendererFrontend = std::make_unique<MGLRenderFrontend>(std::move(renderer), self, *_mbglView, *_mbglView); + _rendererFrontend = std::make_unique<MGLRenderFrontend>(std::move(renderer), self, *_mbglView); _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, self.size, scaleFactor, *mbglFileSource, *_mbglThreadPool, mbgl::MapMode::Continuous, mbgl::ConstrainMode::None, mbgl::ViewportMode::Default); // start paused if in IB @@ -5417,7 +5416,7 @@ public: return _annotationViewReuseQueueByIdentifier[identifier]; } -class MBGLView : public mbgl::View, public mbgl::RendererBackend, public mbgl::MapObserver +class MBGLView : public mbgl::RendererBackend, public mbgl::MapObserver { public: MBGLView(MGLMapView* nativeView_) : nativeView(nativeView_) { diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 6707f59628..5dbb134ef5 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -24,7 +24,6 @@ #import "MGLImageSource.h" #import <mbgl/map/map.hpp> -#import <mbgl/map/view.hpp> #import <mbgl/style/style.hpp> #import <mbgl/annotation/annotation.hpp> #import <mbgl/map/camera.hpp> @@ -275,7 +274,7 @@ public: _mbglThreadPool = mbgl::sharedThreadPool(); auto renderer = std::make_unique<mbgl::Renderer>(*_mbglView, [NSScreen mainScreen].backingScaleFactor, *mbglFileSource, *_mbglThreadPool, mbgl::GLContextMode::Unique); - _rendererFrontend = std::make_unique<MGLRenderFrontend>(std::move(renderer), self, *_mbglView, *_mbglView, true); + _rendererFrontend = std::make_unique<MGLRenderFrontend>(std::move(renderer), self, *_mbglView, true); _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, self.size, [NSScreen mainScreen].backingScaleFactor, *mbglFileSource, *_mbglThreadPool, mbgl::MapMode::Continuous, mbgl::ConstrainMode::None, mbgl::ViewportMode::Default); // Install the OpenGL layer. Interface Builder’s synchronous drawing means @@ -2763,7 +2762,7 @@ public: } /// Adapter responsible for bridging calls from mbgl to MGLMapView and Cocoa. -class MGLMapViewImpl : public mbgl::View, public mbgl::RendererBackend, public mbgl::MapObserver { +class MGLMapViewImpl : public mbgl::RendererBackend, public mbgl::MapObserver { public: MGLMapViewImpl(MGLMapView *nativeView_) : nativeView(nativeView_) {} diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index 6faffb5ffb..eeb0bece12 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -1502,7 +1502,6 @@ QMapboxGLPrivate::QMapboxGLPrivate(QMapboxGL *q, const QMapboxGLSettings &settin frontend = std::make_unique<QMapboxGLRendererFrontend>( std::make_unique<mbgl::Renderer>(*this, pixelRatio, *fileSourceObj, *threadPool, static_cast<mbgl::GLContextMode>(settings.contextMode())), - *this, *this); connect(frontend.get(), SIGNAL(updated()), this, SLOT(invalidate())); diff --git a/platform/qt/src/qmapboxgl_p.hpp b/platform/qt/src/qmapboxgl_p.hpp index 0fa9f6e8e4..7b0dd8c192 100644 --- a/platform/qt/src/qmapboxgl_p.hpp +++ b/platform/qt/src/qmapboxgl_p.hpp @@ -4,7 +4,6 @@ #include "qmapboxgl_renderer_frontend_p.hpp" #include <mbgl/map/map.hpp> -#include <mbgl/map/view.hpp> #include <mbgl/renderer/renderer_backend.hpp> #include <mbgl/util/default_thread_pool.hpp> #include <mbgl/storage/default_file_source.hpp> @@ -13,7 +12,7 @@ #include <QObject> #include <QSize> -class QMapboxGLPrivate : public QObject, public mbgl::View, public mbgl::RendererBackend, public mbgl::MapObserver +class QMapboxGLPrivate : public QObject, public mbgl::RendererBackend, public mbgl::MapObserver { Q_OBJECT @@ -23,11 +22,8 @@ public: mbgl::Size framebufferSize() const; - - // mbgl::View implementation. - void bind() final; - // mbgl::RendererBackend implementation. + void bind() final; void updateAssumedState() final; void activate() final {} void deactivate() final {} diff --git a/platform/qt/src/qmapboxgl_renderer_frontend_p.cpp b/platform/qt/src/qmapboxgl_renderer_frontend_p.cpp index d7d9e9c7b7..ea60851eb4 100644 --- a/platform/qt/src/qmapboxgl_renderer_frontend_p.cpp +++ b/platform/qt/src/qmapboxgl_renderer_frontend_p.cpp @@ -3,10 +3,9 @@ #include <mbgl/renderer/backend_scope.hpp> #include <mbgl/renderer/renderer.hpp> -QMapboxGLRendererFrontend::QMapboxGLRendererFrontend(std::unique_ptr<mbgl::Renderer> renderer_, mbgl::RendererBackend& backend_, mbgl::View& view_) +QMapboxGLRendererFrontend::QMapboxGLRendererFrontend(std::unique_ptr<mbgl::Renderer> renderer_, mbgl::RendererBackend& backend_) : renderer(std::move(renderer_)) - , backend(backend_) - , view(view_) { + , backend(backend_) { } QMapboxGLRendererFrontend::~QMapboxGLRendererFrontend() = default; @@ -34,5 +33,5 @@ void QMapboxGLRendererFrontend::render() { // The OpenGL implementation automatically enables the OpenGL context for us. mbgl::BackendScope scope { backend, mbgl::BackendScope::ScopeType::Implicit }; - renderer->render(view, *updateParameters); + renderer->render(*updateParameters); } diff --git a/platform/qt/src/qmapboxgl_renderer_frontend_p.hpp b/platform/qt/src/qmapboxgl_renderer_frontend_p.hpp index d7e414e5f9..c5e2bacc34 100644 --- a/platform/qt/src/qmapboxgl_renderer_frontend_p.hpp +++ b/platform/qt/src/qmapboxgl_renderer_frontend_p.hpp @@ -6,7 +6,6 @@ #include <QObject> namespace mbgl { - class View; class Renderer; } // namespace mbgl @@ -15,7 +14,7 @@ class QMapboxGLRendererFrontend : public QObject, public mbgl::RendererFrontend Q_OBJECT public: - explicit QMapboxGLRendererFrontend(std::unique_ptr<mbgl::Renderer>, mbgl::RendererBackend&, mbgl::View&); + explicit QMapboxGLRendererFrontend(std::unique_ptr<mbgl::Renderer>, mbgl::RendererBackend&); ~QMapboxGLRendererFrontend() override; void reset() override; @@ -32,6 +31,5 @@ signals: private: std::unique_ptr<mbgl::Renderer> renderer; mbgl::RendererBackend& backend; - mbgl::View& view; std::shared_ptr<mbgl::UpdateParameters> updateParameters; }; diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index 55dde604d3..e18f1e0bcf 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -1,4 +1,3 @@ -#include <mbgl/map/view.hpp> #include <mbgl/gl/context.hpp> #include <mbgl/gl/gl.hpp> #include <mbgl/gl/debugging_extension.hpp> diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp index 0dd67d2ed7..9923567276 100644 --- a/src/mbgl/gl/context.hpp +++ b/src/mbgl/gl/context.hpp @@ -25,9 +25,6 @@ #include <string> namespace mbgl { - -class View; - namespace gl { constexpr size_t TextureMax = 64; diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp index ab10b21cc1..2bb25af28f 100644 --- a/src/mbgl/map/transform.cpp +++ b/src/mbgl/map/transform.cpp @@ -1,6 +1,5 @@ #include <mbgl/map/camera.hpp> #include <mbgl/map/transform.hpp> -#include <mbgl/map/view.hpp> #include <mbgl/util/constants.hpp> #include <mbgl/util/mat4.hpp> #include <mbgl/util/math.hpp> diff --git a/src/mbgl/renderer/layers/render_custom_layer.cpp b/src/mbgl/renderer/layers/render_custom_layer.cpp index 49f94a699a..ae0c4b026b 100644 --- a/src/mbgl/renderer/layers/render_custom_layer.cpp +++ b/src/mbgl/renderer/layers/render_custom_layer.cpp @@ -1,10 +1,10 @@ #include <mbgl/renderer/layers/render_custom_layer.hpp> #include <mbgl/renderer/paint_parameters.hpp> #include <mbgl/renderer/backend_scope.hpp> +#include <mbgl/renderer/renderer_backend.hpp> #include <mbgl/renderer/bucket.hpp> #include <mbgl/style/layers/custom_layer_impl.hpp> #include <mbgl/map/transform_state.hpp> -#include <mbgl/map/view.hpp> namespace mbgl { @@ -70,7 +70,7 @@ void RenderCustomLayer::render(PaintParameters& paintParameters, RenderSource*) // Reset the view back to our original one, just in case the CustomLayer changed // the viewport or Framebuffer. - paintParameters.view.bind(); + paintParameters.backend.bind(); context.setDirtyState(); } diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp index 27ed4d8084..6295f62b21 100644 --- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp @@ -4,10 +4,10 @@ #include <mbgl/renderer/paint_parameters.hpp> #include <mbgl/renderer/image_manager.hpp> #include <mbgl/renderer/render_static_data.hpp> +#include <mbgl/renderer/renderer_backend.hpp> #include <mbgl/programs/programs.hpp> #include <mbgl/programs/fill_extrusion_program.hpp> #include <mbgl/tile/tile.hpp> -#include <mbgl/map/view.hpp> #include <mbgl/style/layers/fill_extrusion_layer_impl.hpp> #include <mbgl/geometry/feature_index.hpp> #include <mbgl/util/math.hpp> @@ -131,7 +131,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource* } } - parameters.view.bind(); + parameters.backend.bind(); parameters.context.bindTexture(parameters.staticData.extrusionTexture->getTexture()); mat4 viewportMat; diff --git a/src/mbgl/renderer/paint_parameters.cpp b/src/mbgl/renderer/paint_parameters.cpp index fc0bd40aeb..ebdaecd3a3 100644 --- a/src/mbgl/renderer/paint_parameters.cpp +++ b/src/mbgl/renderer/paint_parameters.cpp @@ -9,13 +9,13 @@ namespace mbgl { PaintParameters::PaintParameters(gl::Context& context_, float pixelRatio_, GLContextMode contextMode_, - View& view_, + RendererBackend& backend_, const UpdateParameters& updateParameters, RenderStyle& style, RenderStaticData& staticData_, FrameHistory& frameHistory_) : context(context_), - view(view_), + backend(backend_), state(updateParameters.transformState), evaluatedLight(style.getRenderLight().getEvaluated()), staticData(staticData_), diff --git a/src/mbgl/renderer/paint_parameters.hpp b/src/mbgl/renderer/paint_parameters.hpp index 811a99b58b..e9d3562a75 100644 --- a/src/mbgl/renderer/paint_parameters.hpp +++ b/src/mbgl/renderer/paint_parameters.hpp @@ -13,7 +13,7 @@ namespace mbgl { -class View; +class RendererBackend; class UpdateParameters; class RenderStyle; class RenderStaticData; @@ -29,14 +29,14 @@ public: PaintParameters(gl::Context&, float pixelRatio, GLContextMode, - View&, + RendererBackend&, const UpdateParameters&, RenderStyle&, RenderStaticData&, FrameHistory&); gl::Context& context; - View& view; + RendererBackend& backend; const TransformState& state; const EvaluatedLight& evaluatedLight; diff --git a/src/mbgl/renderer/renderer.cpp b/src/mbgl/renderer/renderer.cpp index 3c9715cd50..9f4b897d6e 100644 --- a/src/mbgl/renderer/renderer.cpp +++ b/src/mbgl/renderer/renderer.cpp @@ -21,8 +21,8 @@ void Renderer::setObserver(RendererObserver* observer) { impl->setObserver(observer); } -void Renderer::render(View& view, const UpdateParameters& updateParameters) { - impl->render(view, updateParameters); +void Renderer::render(const UpdateParameters& updateParameters) { + impl->render(updateParameters); } std::vector<Feature> Renderer::queryRenderedFeatures(const ScreenLineString& geometry, const RenderedQueryOptions& options) const { diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp index 4c45ab167d..dd3c0d41a1 100644 --- a/src/mbgl/renderer/renderer_impl.cpp +++ b/src/mbgl/renderer/renderer_impl.cpp @@ -44,7 +44,7 @@ void Renderer::Impl::setObserver(RendererObserver* observer_) { observer = observer_ ? observer_ : &nullObserver(); } -void Renderer::Impl::render(View& view, const UpdateParameters& updateParameters) { +void Renderer::Impl::render(const UpdateParameters& updateParameters) { // Don't load/render anyting in still mode until explicitly requested. if (updateParameters.mode == MapMode::Still && !updateParameters.stillImageRequest) return; @@ -61,7 +61,7 @@ void Renderer::Impl::render(View& view, const UpdateParameters& updateParameters backend.getContext(), pixelRatio, contextMode, - view, + backend, updateParameters, *renderStyle, *staticData, @@ -137,7 +137,7 @@ void Renderer::Impl::doRender(PaintParameters& parameters) { // tiles whatsoever. { MBGL_DEBUG_GROUP(parameters.context, "clear"); - parameters.view.bind(); + parameters.backend.bind(); parameters.context.clear((parameters.debugOptions & MapDebugOptions::Overdraw) ? Color::black() : renderData.backgroundColor, diff --git a/src/mbgl/renderer/renderer_impl.hpp b/src/mbgl/renderer/renderer_impl.hpp index 521df6ca63..079b00d0bb 100644 --- a/src/mbgl/renderer/renderer_impl.hpp +++ b/src/mbgl/renderer/renderer_impl.hpp @@ -13,7 +13,6 @@ namespace mbgl { -class View; class UpdateParameters; class PaintParameters; class RenderStyle; @@ -27,7 +26,7 @@ public: void setObserver(RendererObserver*); - void render(View&, const UpdateParameters&); + void render(const UpdateParameters&); std::vector<Feature> queryRenderedFeatures(const ScreenLineString&, const RenderedQueryOptions&) const; std::vector<Feature> querySourceFeatures(const std::string& sourceID, const SourceQueryOptions&) const; diff --git a/src/mbgl/util/offscreen_texture.hpp b/src/mbgl/util/offscreen_texture.hpp index c265700555..0353f3f9c5 100644 --- a/src/mbgl/util/offscreen_texture.hpp +++ b/src/mbgl/util/offscreen_texture.hpp @@ -1,6 +1,5 @@ #pragma once -#include <mbgl/map/view.hpp> #include <mbgl/util/image.hpp> namespace mbgl { @@ -15,16 +14,16 @@ enum class OffscreenTextureAttachment { Depth, }; -class OffscreenTexture : public View { +class OffscreenTexture { public: OffscreenTexture(gl::Context&, Size size = { 256, 256 }, OffscreenTextureAttachment type = OffscreenTextureAttachment::None); - ~OffscreenTexture() override; + ~OffscreenTexture(); OffscreenTexture(OffscreenTexture&&); OffscreenTexture& operator=(OffscreenTexture&&); - void bind() override; + void bind(); PremultipliedImage readStillImage(); diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp index d6476f9a3e..9e622f780a 100644 --- a/test/api/annotations.test.cpp +++ b/test/api/annotations.test.cpp @@ -50,7 +50,7 @@ TEST(Annotations, SymbolAnnotation) { test.map.addAnnotation(SymbolAnnotation { Point<double>(0, 0), "default_marker" }); test.checkRendering("point_annotation"); -// auto size = test.view.getSize(); +// auto size = test.frontend.getSize(); // auto screenBox = ScreenBox { {}, { double(size.width), double(size.height) } }; // for (uint8_t zoom = test.map.getMinZoom(); zoom <= test.map.getMaxZoom(); ++zoom) { // test.map.setZoom(zoom); diff --git a/test/renderer/backend_scope.test.cpp b/test/renderer/backend_scope.test.cpp index a8c92bb31f..06bf1e7750 100644 --- a/test/renderer/backend_scope.test.cpp +++ b/test/renderer/backend_scope.test.cpp @@ -9,6 +9,8 @@ using namespace mbgl; class StubRendererBackend: public RendererBackend { public: + void bind() override { + } void activate() override { if (activateFunction) activateFunction(); |