summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2018-12-11 13:41:23 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2018-12-11 15:09:34 +0200
commitc043d01e14900461935ebee490fd93e492c5e7ae (patch)
tree2ba2552cc0ce1f6a8160f48cd62d6e7762164348 /src
parentebd87a5442772e9e840cd5c00be56cccfddb5c68 (diff)
downloadqtlocation-mapboxgl-c043d01e14900461935ebee490fd93e492c5e7ae.tar.gz
[core]Disable RenderAnnotationSource when annotations are disabled
This patch disables creation of `RenderAnnotationSource` instances and thus saves extra 4Ki on Android when `LayerManager::annotationsEnabled` is `false`.
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/annotation/render_annotation_source.cpp3
-rw-r--r--src/mbgl/renderer/render_source.cpp9
2 files changed, 11 insertions, 1 deletions
diff --git a/src/mbgl/annotation/render_annotation_source.cpp b/src/mbgl/annotation/render_annotation_source.cpp
index 7d776f21c4..d83f4d0fa4 100644
--- a/src/mbgl/annotation/render_annotation_source.cpp
+++ b/src/mbgl/annotation/render_annotation_source.cpp
@@ -6,12 +6,15 @@
#include <mbgl/algorithm/generate_clip_ids.hpp>
#include <mbgl/algorithm/generate_clip_ids_impl.hpp>
+#include <mbgl/layermanager/layer_manager.hpp>
+
namespace mbgl {
using namespace style;
RenderAnnotationSource::RenderAnnotationSource(Immutable<AnnotationSource::Impl> impl_)
: RenderSource(impl_) {
+ assert(LayerManager::annotationsEnabled);
tilePyramid.setObserver(this);
}
diff --git a/src/mbgl/renderer/render_source.cpp b/src/mbgl/renderer/render_source.cpp
index d160eb16e3..dfe1f25ed6 100644
--- a/src/mbgl/renderer/render_source.cpp
+++ b/src/mbgl/renderer/render_source.cpp
@@ -10,6 +10,8 @@
#include <mbgl/renderer/sources/render_custom_geometry_source.hpp>
#include <mbgl/tile/tile.hpp>
+#include <mbgl/layermanager/layer_manager.hpp>
+
namespace mbgl {
using namespace style;
@@ -28,7 +30,12 @@ std::unique_ptr<RenderSource> RenderSource::create(Immutable<Source::Impl> impl)
assert(false);
return nullptr;
case SourceType::Annotations:
- return std::make_unique<RenderAnnotationSource>(staticImmutableCast<AnnotationSource::Impl>(impl));
+ if (LayerManager::annotationsEnabled) {
+ return std::make_unique<RenderAnnotationSource>(staticImmutableCast<AnnotationSource::Impl>(impl));
+ } else {
+ assert(false);
+ return nullptr;
+ }
case SourceType::Image:
return std::make_unique<RenderImageSource>(staticImmutableCast<ImageSource::Impl>(impl));
case SourceType::CustomVector: