diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-30 13:40:36 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-06-05 19:38:08 -0700 |
commit | 591af0021bfb8b9fdfd803b55fb6c18a24c46943 (patch) | |
tree | b0952184aca90ddda6ce170c4e2cc287824fbf54 /src/mbgl/style/layers | |
parent | 32589c271c6f4885dadb6291c4bf637b72659a9f (diff) | |
download | qtlocation-mapboxgl-591af0021bfb8b9fdfd803b55fb6c18a24c46943.tar.gz |
[core] Refactor RenderSource updates
* Eliminate updateBatch in favor of diffing layers and detecting changes to properties upon which layout depends.
* Replace RenderSource::{update,remove,invalidate,reload}Tiles with a single update method
* Replace TilePyramid::{update,remove,invalidate,reload}Tiles with a single update method
* Remove Style& dependency TODO from GeometryTile and TileParameters
Diffstat (limited to 'src/mbgl/style/layers')
-rw-r--r-- | src/mbgl/style/layers/background_layer_impl.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/style/layers/background_layer_impl.hpp | 1 | ||||
-rw-r--r-- | src/mbgl/style/layers/circle_layer_impl.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/style/layers/circle_layer_impl.hpp | 1 | ||||
-rw-r--r-- | src/mbgl/style/layers/custom_layer_impl.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/style/layers/custom_layer_impl.hpp | 1 | ||||
-rw-r--r-- | src/mbgl/style/layers/fill_extrusion_layer_impl.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/style/layers/fill_extrusion_layer_impl.hpp | 1 | ||||
-rw-r--r-- | src/mbgl/style/layers/fill_layer_impl.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/style/layers/fill_layer_impl.hpp | 1 | ||||
-rw-r--r-- | src/mbgl/style/layers/line_layer_impl.cpp | 9 | ||||
-rw-r--r-- | src/mbgl/style/layers/line_layer_impl.hpp | 1 | ||||
-rw-r--r-- | src/mbgl/style/layers/raster_layer_impl.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/style/layers/raster_layer_impl.hpp | 1 | ||||
-rw-r--r-- | src/mbgl/style/layers/symbol_layer_impl.cpp | 9 | ||||
-rw-r--r-- | src/mbgl/style/layers/symbol_layer_impl.hpp | 1 |
16 files changed, 62 insertions, 0 deletions
diff --git a/src/mbgl/style/layers/background_layer_impl.cpp b/src/mbgl/style/layers/background_layer_impl.cpp index 4b4f44a8d8..a59a84fbe9 100644 --- a/src/mbgl/style/layers/background_layer_impl.cpp +++ b/src/mbgl/style/layers/background_layer_impl.cpp @@ -3,5 +3,9 @@ namespace mbgl { namespace style { +bool BackgroundLayer::Impl::hasLayoutDifference(const Layer::Impl&) const { + return false; +} + } // namespace style } // namespace mbgl diff --git a/src/mbgl/style/layers/background_layer_impl.hpp b/src/mbgl/style/layers/background_layer_impl.hpp index 4f14662658..248a751027 100644 --- a/src/mbgl/style/layers/background_layer_impl.hpp +++ b/src/mbgl/style/layers/background_layer_impl.hpp @@ -11,6 +11,7 @@ class BackgroundLayer::Impl : public Layer::Impl { public: using Layer::Impl::Impl; + bool hasLayoutDifference(const Layer::Impl&) const override; void stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const override; BackgroundPaintProperties::Transitionable paint; diff --git a/src/mbgl/style/layers/circle_layer_impl.cpp b/src/mbgl/style/layers/circle_layer_impl.cpp index cdb371bd58..69f574cd6b 100644 --- a/src/mbgl/style/layers/circle_layer_impl.cpp +++ b/src/mbgl/style/layers/circle_layer_impl.cpp @@ -3,5 +3,13 @@ namespace mbgl { namespace style { +bool CircleLayer::Impl::hasLayoutDifference(const Layer::Impl& other) const { + assert(dynamic_cast<const CircleLayer::Impl*>(&other)); + const auto& impl = static_cast<const style::CircleLayer::Impl&>(other); + return filter != impl.filter || + visibility != impl.visibility || + paint.hasDataDrivenPropertyDifference(impl.paint); +} + } // namespace style } // namespace mbgl diff --git a/src/mbgl/style/layers/circle_layer_impl.hpp b/src/mbgl/style/layers/circle_layer_impl.hpp index 79ef879ab9..4b148cdc42 100644 --- a/src/mbgl/style/layers/circle_layer_impl.hpp +++ b/src/mbgl/style/layers/circle_layer_impl.hpp @@ -11,6 +11,7 @@ class CircleLayer::Impl : public Layer::Impl { public: using Layer::Impl::Impl; + bool hasLayoutDifference(const Layer::Impl&) const override; void stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const override; CirclePaintProperties::Transitionable paint; diff --git a/src/mbgl/style/layers/custom_layer_impl.cpp b/src/mbgl/style/layers/custom_layer_impl.cpp index e2ed00a10d..10dd058861 100644 --- a/src/mbgl/style/layers/custom_layer_impl.cpp +++ b/src/mbgl/style/layers/custom_layer_impl.cpp @@ -16,6 +16,10 @@ CustomLayer::Impl::Impl(const std::string& id_, context = context_; } +bool CustomLayer::Impl::hasLayoutDifference(const Layer::Impl&) const { + return false; +} + void CustomLayer::Impl::stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const { } diff --git a/src/mbgl/style/layers/custom_layer_impl.hpp b/src/mbgl/style/layers/custom_layer_impl.hpp index 26a75f5834..466d1f3e3f 100644 --- a/src/mbgl/style/layers/custom_layer_impl.hpp +++ b/src/mbgl/style/layers/custom_layer_impl.hpp @@ -22,6 +22,7 @@ public: void render(const TransformState&) const; private: + bool hasLayoutDifference(const Layer::Impl&) const override; void stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const override; CustomLayerInitializeFunction initializeFn = nullptr; diff --git a/src/mbgl/style/layers/fill_extrusion_layer_impl.cpp b/src/mbgl/style/layers/fill_extrusion_layer_impl.cpp index 07df4cd331..d37c2ad29b 100644 --- a/src/mbgl/style/layers/fill_extrusion_layer_impl.cpp +++ b/src/mbgl/style/layers/fill_extrusion_layer_impl.cpp @@ -3,5 +3,13 @@ namespace mbgl { namespace style { +bool FillExtrusionLayer::Impl::hasLayoutDifference(const Layer::Impl& other) const { + assert(dynamic_cast<const FillExtrusionLayer::Impl*>(&other)); + const auto& impl = static_cast<const style::FillExtrusionLayer::Impl&>(other); + return filter != impl.filter || + visibility != impl.visibility || + paint.hasDataDrivenPropertyDifference(impl.paint); +} + } // namespace style } // namespace mbgl diff --git a/src/mbgl/style/layers/fill_extrusion_layer_impl.hpp b/src/mbgl/style/layers/fill_extrusion_layer_impl.hpp index 73c65469d1..9abc6fc4b3 100644 --- a/src/mbgl/style/layers/fill_extrusion_layer_impl.hpp +++ b/src/mbgl/style/layers/fill_extrusion_layer_impl.hpp @@ -11,6 +11,7 @@ class FillExtrusionLayer::Impl : public Layer::Impl { public: using Layer::Impl::Impl; + bool hasLayoutDifference(const Layer::Impl&) const override; void stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const override; FillExtrusionPaintProperties::Transitionable paint; diff --git a/src/mbgl/style/layers/fill_layer_impl.cpp b/src/mbgl/style/layers/fill_layer_impl.cpp index 38672c5bfe..0dc7ed14d5 100644 --- a/src/mbgl/style/layers/fill_layer_impl.cpp +++ b/src/mbgl/style/layers/fill_layer_impl.cpp @@ -3,5 +3,13 @@ namespace mbgl { namespace style { +bool FillLayer::Impl::hasLayoutDifference(const Layer::Impl& other) const { + assert(dynamic_cast<const FillLayer::Impl*>(&other)); + const auto& impl = static_cast<const style::FillLayer::Impl&>(other); + return filter != impl.filter || + visibility != impl.visibility || + paint.hasDataDrivenPropertyDifference(impl.paint); +} + } // namespace style } // namespace mbgl diff --git a/src/mbgl/style/layers/fill_layer_impl.hpp b/src/mbgl/style/layers/fill_layer_impl.hpp index 72ea8ab352..2673cd7443 100644 --- a/src/mbgl/style/layers/fill_layer_impl.hpp +++ b/src/mbgl/style/layers/fill_layer_impl.hpp @@ -11,6 +11,7 @@ class FillLayer::Impl : public Layer::Impl { public: using Layer::Impl::Impl; + bool hasLayoutDifference(const Layer::Impl&) const override; void stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const override; FillPaintProperties::Transitionable paint; diff --git a/src/mbgl/style/layers/line_layer_impl.cpp b/src/mbgl/style/layers/line_layer_impl.cpp index 16a164eb9d..bee88d6a47 100644 --- a/src/mbgl/style/layers/line_layer_impl.cpp +++ b/src/mbgl/style/layers/line_layer_impl.cpp @@ -3,5 +3,14 @@ namespace mbgl { namespace style { +bool LineLayer::Impl::hasLayoutDifference(const Layer::Impl& other) const { + assert(dynamic_cast<const LineLayer::Impl*>(&other)); + const auto& impl = static_cast<const style::LineLayer::Impl&>(other); + return filter != impl.filter || + visibility != impl.visibility || + layout != impl.layout || + paint.hasDataDrivenPropertyDifference(impl.paint); +} + } // namespace style } // namespace mbgl diff --git a/src/mbgl/style/layers/line_layer_impl.hpp b/src/mbgl/style/layers/line_layer_impl.hpp index 333821dc17..04adc0e85c 100644 --- a/src/mbgl/style/layers/line_layer_impl.hpp +++ b/src/mbgl/style/layers/line_layer_impl.hpp @@ -11,6 +11,7 @@ class LineLayer::Impl : public Layer::Impl { public: using Layer::Impl::Impl; + bool hasLayoutDifference(const Layer::Impl&) const override; void stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const override; LineLayoutProperties::Unevaluated layout; diff --git a/src/mbgl/style/layers/raster_layer_impl.cpp b/src/mbgl/style/layers/raster_layer_impl.cpp index 1c2204c5d7..a995f50dd3 100644 --- a/src/mbgl/style/layers/raster_layer_impl.cpp +++ b/src/mbgl/style/layers/raster_layer_impl.cpp @@ -3,5 +3,9 @@ namespace mbgl { namespace style { +bool RasterLayer::Impl::hasLayoutDifference(const Layer::Impl&) const { + return false; +} + } // namespace style } // namespace mbgl diff --git a/src/mbgl/style/layers/raster_layer_impl.hpp b/src/mbgl/style/layers/raster_layer_impl.hpp index 2178fd69d4..adbe703e92 100644 --- a/src/mbgl/style/layers/raster_layer_impl.hpp +++ b/src/mbgl/style/layers/raster_layer_impl.hpp @@ -11,6 +11,7 @@ class RasterLayer::Impl : public Layer::Impl { public: using Layer::Impl::Impl; + bool hasLayoutDifference(const Layer::Impl&) const override; void stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const override; RasterPaintProperties::Transitionable paint; diff --git a/src/mbgl/style/layers/symbol_layer_impl.cpp b/src/mbgl/style/layers/symbol_layer_impl.cpp index 3f0ab9b8fb..b59768725d 100644 --- a/src/mbgl/style/layers/symbol_layer_impl.cpp +++ b/src/mbgl/style/layers/symbol_layer_impl.cpp @@ -3,5 +3,14 @@ namespace mbgl { namespace style { +bool SymbolLayer::Impl::hasLayoutDifference(const Layer::Impl& other) const { + assert(dynamic_cast<const SymbolLayer::Impl*>(&other)); + const auto& impl = static_cast<const style::SymbolLayer::Impl&>(other); + return filter != impl.filter || + visibility != impl.visibility || + layout != impl.layout || + paint.hasDataDrivenPropertyDifference(impl.paint); +} + } // namespace style } // namespace mbgl diff --git a/src/mbgl/style/layers/symbol_layer_impl.hpp b/src/mbgl/style/layers/symbol_layer_impl.hpp index 7b9415436d..f8ef87dcdf 100644 --- a/src/mbgl/style/layers/symbol_layer_impl.hpp +++ b/src/mbgl/style/layers/symbol_layer_impl.hpp @@ -11,6 +11,7 @@ class SymbolLayer::Impl : public Layer::Impl { public: using Layer::Impl::Impl; + bool hasLayoutDifference(const Layer::Impl&) const override; void stringifyLayout(rapidjson::Writer<rapidjson::StringBuffer>&) const override; SymbolLayoutProperties::Unevaluated layout; |