summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-07-18 09:45:04 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-07-19 09:31:07 -0700
commit5c24636c26ae8e01ec2b9bf65d7b08054bb43b1d (patch)
tree31a5c1a3f8a63406d3d28fcb542d5d708a13b5b5
parent4954da23e76d1dcf87c65804d154ca034193cb4b (diff)
downloadqtlocation-mapboxgl-5c24636c26ae8e01ec2b9bf65d7b08054bb43b1d.tar.gz
[core] Eliminate Bucket::render
-rw-r--r--src/mbgl/renderer/bucket.hpp4
-rw-r--r--src/mbgl/renderer/buckets/circle_bucket.cpp8
-rw-r--r--src/mbgl/renderer/buckets/circle_bucket.hpp2
-rw-r--r--src/mbgl/renderer/buckets/fill_bucket.cpp8
-rw-r--r--src/mbgl/renderer/buckets/fill_bucket.hpp1
-rw-r--r--src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp8
-rw-r--r--src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp1
-rw-r--r--src/mbgl/renderer/buckets/line_bucket.cpp8
-rw-r--r--src/mbgl/renderer/buckets/line_bucket.hpp1
-rw-r--r--src/mbgl/renderer/buckets/raster_bucket.cpp16
-rw-r--r--src/mbgl/renderer/buckets/raster_bucket.hpp6
-rw-r--r--src/mbgl/renderer/buckets/symbol_bucket.cpp8
-rw-r--r--src/mbgl/renderer/buckets/symbol_bucket.hpp1
-rw-r--r--src/mbgl/renderer/layers/render_background_layer.cpp5
-rw-r--r--src/mbgl/renderer/layers/render_background_layer.hpp1
-rw-r--r--src/mbgl/renderer/layers/render_circle_layer.cpp15
-rw-r--r--src/mbgl/renderer/layers/render_circle_layer.hpp1
-rw-r--r--src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp15
-rw-r--r--src/mbgl/renderer/layers/render_fill_extrusion_layer.hpp1
-rw-r--r--src/mbgl/renderer/layers/render_fill_layer.cpp15
-rw-r--r--src/mbgl/renderer/layers/render_fill_layer.hpp1
-rw-r--r--src/mbgl/renderer/layers/render_line_layer.cpp15
-rw-r--r--src/mbgl/renderer/layers/render_line_layer.hpp1
-rw-r--r--src/mbgl/renderer/layers/render_raster_layer.cpp24
-rw-r--r--src/mbgl/renderer/layers/render_symbol_layer.cpp19
-rw-r--r--src/mbgl/renderer/layers/render_symbol_layer.hpp1
-rw-r--r--src/mbgl/renderer/painter.cpp5
-rw-r--r--src/mbgl/renderer/render_layer.cpp10
-rw-r--r--src/mbgl/renderer/render_layer.hpp2
-rw-r--r--src/mbgl/renderer/sources/render_image_source.cpp4
-rw-r--r--src/mbgl/renderer/sources/render_image_source.hpp10
31 files changed, 112 insertions, 105 deletions
diff --git a/src/mbgl/renderer/bucket.hpp b/src/mbgl/renderer/bucket.hpp
index a411daf3d4..f8e297b316 100644
--- a/src/mbgl/renderer/bucket.hpp
+++ b/src/mbgl/renderer/bucket.hpp
@@ -38,10 +38,6 @@ public:
// this only happens once when the bucket is being rendered for the first time.
virtual void upload(gl::Context&) = 0;
- // Every time this bucket is getting rendered, this function is called. This happens either
- // once or twice (for Opaque and Transparent render passes).
- virtual void render(Painter&, PaintParameters&, const RenderLayer&, const RenderTile&) = 0;
-
virtual bool hasData() const = 0;
virtual float getQueryRadius(const RenderLayer&) const {
diff --git a/src/mbgl/renderer/buckets/circle_bucket.cpp b/src/mbgl/renderer/buckets/circle_bucket.cpp
index 8b5743d500..04126990b3 100644
--- a/src/mbgl/renderer/buckets/circle_bucket.cpp
+++ b/src/mbgl/renderer/buckets/circle_bucket.cpp
@@ -1,6 +1,5 @@
#include <mbgl/renderer/buckets/circle_bucket.hpp>
#include <mbgl/renderer/bucket_parameters.hpp>
-#include <mbgl/renderer/painter.hpp>
#include <mbgl/programs/circle_program.hpp>
#include <mbgl/style/layers/circle_layer_impl.hpp>
#include <mbgl/renderer/layers/render_circle_layer.hpp>
@@ -34,13 +33,6 @@ void CircleBucket::upload(gl::Context& context) {
uploaded = true;
}
-void CircleBucket::render(Painter& painter,
- PaintParameters& parameters,
- const RenderLayer& layer,
- const RenderTile& tile) {
- painter.renderCircle(parameters, *this, *layer.as<RenderCircleLayer>(), tile);
-}
-
bool CircleBucket::hasData() const {
return !segments.empty();
}
diff --git a/src/mbgl/renderer/buckets/circle_bucket.hpp b/src/mbgl/renderer/buckets/circle_bucket.hpp
index 0f27e2a7e3..78b6351bcb 100644
--- a/src/mbgl/renderer/buckets/circle_bucket.hpp
+++ b/src/mbgl/renderer/buckets/circle_bucket.hpp
@@ -23,8 +23,6 @@ public:
void upload(gl::Context&) override;
- void render(Painter&, PaintParameters&, const RenderLayer&, const RenderTile&) override;
-
float getQueryRadius(const RenderLayer&) const override;
gl::VertexVector<CircleLayoutVertex> vertices;
diff --git a/src/mbgl/renderer/buckets/fill_bucket.cpp b/src/mbgl/renderer/buckets/fill_bucket.cpp
index 042d7b7506..110db887a1 100644
--- a/src/mbgl/renderer/buckets/fill_bucket.cpp
+++ b/src/mbgl/renderer/buckets/fill_bucket.cpp
@@ -1,5 +1,4 @@
#include <mbgl/renderer/buckets/fill_bucket.hpp>
-#include <mbgl/renderer/painter.hpp>
#include <mbgl/programs/fill_program.hpp>
#include <mbgl/renderer/bucket_parameters.hpp>
#include <mbgl/style/layers/fill_layer_impl.hpp>
@@ -121,13 +120,6 @@ void FillBucket::upload(gl::Context& context) {
uploaded = true;
}
-void FillBucket::render(Painter& painter,
- PaintParameters& parameters,
- const RenderLayer& layer,
- const RenderTile& tile) {
- painter.renderFill(parameters, *this, *layer.as<RenderFillLayer>(), tile);
-}
-
bool FillBucket::hasData() const {
return !triangleSegments.empty() || !lineSegments.empty();
}
diff --git a/src/mbgl/renderer/buckets/fill_bucket.hpp b/src/mbgl/renderer/buckets/fill_bucket.hpp
index d3cd92d451..a50e1971f5 100644
--- a/src/mbgl/renderer/buckets/fill_bucket.hpp
+++ b/src/mbgl/renderer/buckets/fill_bucket.hpp
@@ -23,7 +23,6 @@ public:
bool hasData() const override;
void upload(gl::Context&) override;
- void render(Painter&, PaintParameters&, const RenderLayer&, const RenderTile&) override;
float getQueryRadius(const RenderLayer&) const override;
diff --git a/src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp b/src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp
index f61f1d1549..7f53326fe1 100644
--- a/src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp
+++ b/src/mbgl/renderer/buckets/fill_extrusion_bucket.cpp
@@ -1,5 +1,4 @@
#include <mbgl/renderer/buckets/fill_extrusion_bucket.hpp>
-#include <mbgl/renderer/painter.hpp>
#include <mbgl/programs/fill_extrusion_program.hpp>
#include <mbgl/renderer/bucket_parameters.hpp>
#include <mbgl/style/layers/fill_extrusion_layer_impl.hpp>
@@ -154,13 +153,6 @@ void FillExtrusionBucket::upload(gl::Context& context) {
uploaded = true;
}
-void FillExtrusionBucket::render(Painter& painter,
- PaintParameters& parameters,
- const RenderLayer& layer,
- const RenderTile& tile) {
- painter.renderFillExtrusion(parameters, *this, *layer.as<RenderFillExtrusionLayer>(), tile);
-}
-
bool FillExtrusionBucket::hasData() const {
return !triangleSegments.empty();
}
diff --git a/src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp b/src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp
index d1e695c5a3..d57265ab16 100644
--- a/src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp
+++ b/src/mbgl/renderer/buckets/fill_extrusion_bucket.hpp
@@ -21,7 +21,6 @@ public:
bool hasData() const override;
void upload(gl::Context&) override;
- void render(Painter&, PaintParameters&, const RenderLayer&, const RenderTile&) override;
float getQueryRadius(const RenderLayer&) const override;
diff --git a/src/mbgl/renderer/buckets/line_bucket.cpp b/src/mbgl/renderer/buckets/line_bucket.cpp
index 3af3cd63d3..d1771d484a 100644
--- a/src/mbgl/renderer/buckets/line_bucket.cpp
+++ b/src/mbgl/renderer/buckets/line_bucket.cpp
@@ -1,5 +1,4 @@
#include <mbgl/renderer/buckets/line_bucket.hpp>
-#include <mbgl/renderer/painter.hpp>
#include <mbgl/renderer/layers/render_line_layer.hpp>
#include <mbgl/renderer/bucket_parameters.hpp>
#include <mbgl/style/layers/line_layer_impl.hpp>
@@ -458,13 +457,6 @@ void LineBucket::upload(gl::Context& context) {
uploaded = true;
}
-void LineBucket::render(Painter& painter,
- PaintParameters& parameters,
- const RenderLayer& layer,
- const RenderTile& tile) {
- painter.renderLine(parameters, *this, *layer.as<RenderLineLayer>(), tile);
-}
-
bool LineBucket::hasData() const {
return !segments.empty();
}
diff --git a/src/mbgl/renderer/buckets/line_bucket.hpp b/src/mbgl/renderer/buckets/line_bucket.hpp
index c0a0614d33..8ef25b02ec 100644
--- a/src/mbgl/renderer/buckets/line_bucket.hpp
+++ b/src/mbgl/renderer/buckets/line_bucket.hpp
@@ -26,7 +26,6 @@ public:
bool hasData() const override;
void upload(gl::Context&) override;
- void render(Painter&, PaintParameters&, const RenderLayer&, const RenderTile&) override;
float getQueryRadius(const RenderLayer&) const override;
diff --git a/src/mbgl/renderer/buckets/raster_bucket.cpp b/src/mbgl/renderer/buckets/raster_bucket.cpp
index 8a2f1227a5..3f5879262d 100644
--- a/src/mbgl/renderer/buckets/raster_bucket.cpp
+++ b/src/mbgl/renderer/buckets/raster_bucket.cpp
@@ -1,9 +1,7 @@
#include <mbgl/renderer/buckets/raster_bucket.hpp>
#include <mbgl/renderer/layers/render_raster_layer.hpp>
#include <mbgl/programs/raster_program.hpp>
-#include <mbgl/renderer/painter.hpp>
#include <mbgl/gl/context.hpp>
-#include <mbgl/renderer/render_tile.hpp>
namespace mbgl {
@@ -16,6 +14,7 @@ RasterBucket::RasterBucket(PremultipliedImage&& image_) {
RasterBucket::RasterBucket(std::shared_ptr<PremultipliedImage> image_): image(image_) {
}
+
void RasterBucket::upload(gl::Context& context) {
if (!hasData()) {
return;
@@ -45,19 +44,6 @@ void RasterBucket::setImage(std::shared_ptr<PremultipliedImage> image_) {
texture = {};
uploaded = false;
}
-void RasterBucket::render(Painter& painter,
- PaintParameters& parameters,
- const RenderLayer& layer,
- const RenderTile& tile) {
- painter.renderRaster(parameters, *this, *layer.as<RenderRasterLayer>(), tile.matrix, false);
-}
-
-void RasterBucket::render(Painter& painter,
- PaintParameters& parameters,
- const RenderLayer& layer,
- const mat4& matrix) {
- painter.renderRaster(parameters, *this, *layer.as<RenderRasterLayer>(), matrix, true);
-}
bool RasterBucket::hasData() const {
return !!image;
diff --git a/src/mbgl/renderer/buckets/raster_bucket.hpp b/src/mbgl/renderer/buckets/raster_bucket.hpp
index 1b0d787bcd..0b8432eaaf 100644
--- a/src/mbgl/renderer/buckets/raster_bucket.hpp
+++ b/src/mbgl/renderer/buckets/raster_bucket.hpp
@@ -15,12 +15,8 @@ class RasterBucket : public Bucket {
public:
RasterBucket(PremultipliedImage&&);
RasterBucket(std::shared_ptr<PremultipliedImage>);
+
void upload(gl::Context&) override;
- void render(Painter&, PaintParameters&, const RenderLayer&, const RenderTile&) override;
- void render(Painter& painter,
- PaintParameters& parameters,
- const RenderLayer& layer,
- const mat4& matrix);
bool hasData() const override;
void clear();
diff --git a/src/mbgl/renderer/buckets/symbol_bucket.cpp b/src/mbgl/renderer/buckets/symbol_bucket.cpp
index 1bd73e95dd..a3f71f1f6e 100644
--- a/src/mbgl/renderer/buckets/symbol_bucket.cpp
+++ b/src/mbgl/renderer/buckets/symbol_bucket.cpp
@@ -1,5 +1,4 @@
#include <mbgl/renderer/buckets/symbol_bucket.hpp>
-#include <mbgl/renderer/painter.hpp>
#include <mbgl/renderer/layers/render_symbol_layer.hpp>
#include <mbgl/renderer/bucket_parameters.hpp>
#include <mbgl/style/layers/symbol_layer_impl.hpp>
@@ -61,13 +60,6 @@ void SymbolBucket::upload(gl::Context& context) {
uploaded = true;
}
-void SymbolBucket::render(Painter& painter,
- PaintParameters& parameters,
- const RenderLayer& layer,
- const RenderTile& tile) {
- painter.renderSymbol(parameters, *this, *layer.as<RenderSymbolLayer>(), tile);
-}
-
bool SymbolBucket::hasData() const {
return hasTextData() || hasIconData() || hasCollisionBoxData();
}
diff --git a/src/mbgl/renderer/buckets/symbol_bucket.hpp b/src/mbgl/renderer/buckets/symbol_bucket.hpp
index 424c9d0f74..32f976bcb2 100644
--- a/src/mbgl/renderer/buckets/symbol_bucket.hpp
+++ b/src/mbgl/renderer/buckets/symbol_bucket.hpp
@@ -43,7 +43,6 @@ public:
bool iconsNeedLinear);
void upload(gl::Context&) override;
- void render(Painter&, PaintParameters&, const RenderLayer&, const RenderTile&) override;
bool hasData() const override;
bool hasTextData() const;
bool hasIconData() const;
diff --git a/src/mbgl/renderer/layers/render_background_layer.cpp b/src/mbgl/renderer/layers/render_background_layer.cpp
index 702977cd23..f17d8d9eed 100644
--- a/src/mbgl/renderer/layers/render_background_layer.cpp
+++ b/src/mbgl/renderer/layers/render_background_layer.cpp
@@ -1,6 +1,7 @@
#include <mbgl/renderer/layers/render_background_layer.hpp>
#include <mbgl/style/layers/background_layer_impl.hpp>
#include <mbgl/renderer/bucket.hpp>
+#include <mbgl/renderer/painter.hpp>
namespace mbgl {
@@ -34,4 +35,8 @@ bool RenderBackgroundLayer::hasTransition() const {
return unevaluated.hasTransition();
}
+void RenderBackgroundLayer::render(Painter& painter, PaintParameters& parameters, RenderSource*) {
+ painter.renderBackground(parameters, *this);
+}
+
} // namespace mbgl
diff --git a/src/mbgl/renderer/layers/render_background_layer.hpp b/src/mbgl/renderer/layers/render_background_layer.hpp
index 0fba3d2bb1..a7b15ab178 100644
--- a/src/mbgl/renderer/layers/render_background_layer.hpp
+++ b/src/mbgl/renderer/layers/render_background_layer.hpp
@@ -14,6 +14,7 @@ public:
void transition(const TransitionParameters&) override;
void evaluate(const PropertyEvaluationParameters&) override;
bool hasTransition() const override;
+ void render(Painter&, PaintParameters&, RenderSource*) override;
std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const override;
diff --git a/src/mbgl/renderer/layers/render_circle_layer.cpp b/src/mbgl/renderer/layers/render_circle_layer.cpp
index 51a5ecd7d6..c80b7bd27d 100644
--- a/src/mbgl/renderer/layers/render_circle_layer.cpp
+++ b/src/mbgl/renderer/layers/render_circle_layer.cpp
@@ -1,5 +1,8 @@
#include <mbgl/renderer/layers/render_circle_layer.hpp>
#include <mbgl/renderer/buckets/circle_bucket.hpp>
+#include <mbgl/renderer/painter.hpp>
+#include <mbgl/renderer/render_tile.hpp>
+#include <mbgl/tile/tile.hpp>
#include <mbgl/style/layers/circle_layer_impl.hpp>
#include <mbgl/geometry/feature_index.hpp>
#include <mbgl/util/math.hpp>
@@ -40,6 +43,18 @@ bool RenderCircleLayer::hasTransition() const {
return unevaluated.hasTransition();
}
+void RenderCircleLayer::render(Painter& painter, PaintParameters& parameters, RenderSource*) {
+ for (const RenderTile& tile : renderTiles) {
+ Bucket* bucket = tile.tile.getBucket(*baseImpl);
+ assert(dynamic_cast<CircleBucket*>(bucket));
+ painter.renderCircle(
+ parameters,
+ *reinterpret_cast<CircleBucket*>(bucket),
+ *this,
+ tile);
+ }
+}
+
bool RenderCircleLayer::queryIntersectsFeature(
const GeometryCoordinates& queryGeometry,
const GeometryTileFeature& feature,
diff --git a/src/mbgl/renderer/layers/render_circle_layer.hpp b/src/mbgl/renderer/layers/render_circle_layer.hpp
index 4ae7399ad1..7c3c19d21a 100644
--- a/src/mbgl/renderer/layers/render_circle_layer.hpp
+++ b/src/mbgl/renderer/layers/render_circle_layer.hpp
@@ -14,6 +14,7 @@ public:
void transition(const TransitionParameters&) override;
void evaluate(const PropertyEvaluationParameters&) override;
bool hasTransition() const override;
+ void render(Painter&, PaintParameters&, RenderSource*) override;
bool queryIntersectsFeature(
const GeometryCoordinates&,
diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
index cd69316670..4a28b3b752 100644
--- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
+++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp
@@ -1,5 +1,8 @@
#include <mbgl/renderer/layers/render_fill_extrusion_layer.hpp>
#include <mbgl/renderer/buckets/fill_extrusion_bucket.hpp>
+#include <mbgl/renderer/painter.hpp>
+#include <mbgl/renderer/render_tile.hpp>
+#include <mbgl/tile/tile.hpp>
#include <mbgl/style/layers/fill_extrusion_layer_impl.hpp>
#include <mbgl/geometry/feature_index.hpp>
#include <mbgl/util/math.hpp>
@@ -35,6 +38,18 @@ bool RenderFillExtrusionLayer::hasTransition() const {
return unevaluated.hasTransition();
}
+void RenderFillExtrusionLayer::render(Painter& painter, PaintParameters& parameters, RenderSource*) {
+ for (const RenderTile& tile : renderTiles) {
+ Bucket* bucket = tile.tile.getBucket(*baseImpl);
+ assert(dynamic_cast<FillExtrusionBucket*>(bucket));
+ painter.renderFillExtrusion(
+ parameters,
+ *reinterpret_cast<FillExtrusionBucket*>(bucket),
+ *this,
+ tile);
+ }
+}
+
bool RenderFillExtrusionLayer::queryIntersectsFeature(
const GeometryCoordinates& queryGeometry,
const GeometryTileFeature& feature,
diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.hpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.hpp
index 1a55b56836..b3f1115790 100644
--- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.hpp
+++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.hpp
@@ -14,6 +14,7 @@ public:
void transition(const TransitionParameters&) override;
void evaluate(const PropertyEvaluationParameters&) override;
bool hasTransition() const override;
+ void render(Painter&, PaintParameters&, RenderSource*) override;
bool queryIntersectsFeature(
const GeometryCoordinates&,
diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp
index f1c7e97067..3063da36be 100644
--- a/src/mbgl/renderer/layers/render_fill_layer.cpp
+++ b/src/mbgl/renderer/layers/render_fill_layer.cpp
@@ -1,5 +1,8 @@
#include <mbgl/renderer/layers/render_fill_layer.hpp>
#include <mbgl/renderer/buckets/fill_bucket.hpp>
+#include <mbgl/renderer/painter.hpp>
+#include <mbgl/renderer/render_tile.hpp>
+#include <mbgl/tile/tile.hpp>
#include <mbgl/style/layers/fill_layer_impl.hpp>
#include <mbgl/geometry/feature_index.hpp>
#include <mbgl/util/math.hpp>
@@ -50,6 +53,18 @@ bool RenderFillLayer::hasTransition() const {
return unevaluated.hasTransition();
}
+void RenderFillLayer::render(Painter& painter, PaintParameters& parameters, RenderSource*) {
+ for (const RenderTile& tile : renderTiles) {
+ Bucket* bucket = tile.tile.getBucket(*baseImpl);
+ assert(dynamic_cast<FillBucket*>(bucket));
+ painter.renderFill(
+ parameters,
+ *reinterpret_cast<FillBucket*>(bucket),
+ *this,
+ tile);
+ }
+}
+
bool RenderFillLayer::queryIntersectsFeature(
const GeometryCoordinates& queryGeometry,
const GeometryTileFeature& feature,
diff --git a/src/mbgl/renderer/layers/render_fill_layer.hpp b/src/mbgl/renderer/layers/render_fill_layer.hpp
index 1960fb653f..0dc5dd0b1d 100644
--- a/src/mbgl/renderer/layers/render_fill_layer.hpp
+++ b/src/mbgl/renderer/layers/render_fill_layer.hpp
@@ -14,6 +14,7 @@ public:
void transition(const TransitionParameters&) override;
void evaluate(const PropertyEvaluationParameters&) override;
bool hasTransition() const override;
+ void render(Painter&, PaintParameters&, RenderSource*) override;
bool queryIntersectsFeature(
const GeometryCoordinates&,
diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp
index c27e5ea990..68b4eaeaef 100644
--- a/src/mbgl/renderer/layers/render_line_layer.cpp
+++ b/src/mbgl/renderer/layers/render_line_layer.cpp
@@ -1,5 +1,8 @@
#include <mbgl/renderer/layers/render_line_layer.hpp>
#include <mbgl/renderer/buckets/line_bucket.hpp>
+#include <mbgl/renderer/painter.hpp>
+#include <mbgl/renderer/render_tile.hpp>
+#include <mbgl/tile/tile.hpp>
#include <mbgl/style/layers/line_layer_impl.hpp>
#include <mbgl/geometry/feature_index.hpp>
#include <mbgl/util/math.hpp>
@@ -43,6 +46,18 @@ bool RenderLineLayer::hasTransition() const {
return unevaluated.hasTransition();
}
+void RenderLineLayer::render(Painter& painter, PaintParameters& parameters, RenderSource*) {
+ for (const RenderTile& tile : renderTiles) {
+ Bucket* bucket = tile.tile.getBucket(*baseImpl);
+ assert(dynamic_cast<LineBucket*>(bucket));
+ painter.renderLine(
+ parameters,
+ *reinterpret_cast<LineBucket*>(bucket),
+ *this,
+ tile);
+ }
+}
+
optional<GeometryCollection> offsetLine(const GeometryCollection& rings, const double offset) {
if (offset == 0) return {};
diff --git a/src/mbgl/renderer/layers/render_line_layer.hpp b/src/mbgl/renderer/layers/render_line_layer.hpp
index 77551b6b7c..47c526fd1e 100644
--- a/src/mbgl/renderer/layers/render_line_layer.hpp
+++ b/src/mbgl/renderer/layers/render_line_layer.hpp
@@ -23,6 +23,7 @@ public:
void transition(const TransitionParameters&) override;
void evaluate(const PropertyEvaluationParameters&) override;
bool hasTransition() const override;
+ void render(Painter&, PaintParameters&, RenderSource*) override;
bool queryIntersectsFeature(
const GeometryCoordinates&,
diff --git a/src/mbgl/renderer/layers/render_raster_layer.cpp b/src/mbgl/renderer/layers/render_raster_layer.cpp
index 84e27a3895..b678398eca 100644
--- a/src/mbgl/renderer/layers/render_raster_layer.cpp
+++ b/src/mbgl/renderer/layers/render_raster_layer.cpp
@@ -1,11 +1,10 @@
#include <mbgl/renderer/layers/render_raster_layer.hpp>
-#include <mbgl/renderer/bucket.hpp>
-#include <mbgl/style/layers/raster_layer_impl.hpp>
-#include <mbgl/gl/context.hpp>
+#include <mbgl/renderer/buckets/raster_bucket.hpp>
+#include <mbgl/renderer/painter.hpp>
#include <mbgl/renderer/render_tile.hpp>
#include <mbgl/tile/tile.hpp>
#include <mbgl/renderer/sources/render_image_source.hpp>
-#include <mbgl/renderer/painter.hpp>
+#include <mbgl/style/layers/raster_layer_impl.hpp>
namespace mbgl {
@@ -38,11 +37,18 @@ bool RenderRasterLayer::hasTransition() const {
}
void RenderRasterLayer::render(Painter& painter, PaintParameters& parameters, RenderSource* source) {
- RenderLayer::render(painter, parameters, source);
- if (renderTiles.empty()) {
- RenderImageSource* imageSource = source->as<RenderImageSource>();
- if (imageSource) {
- imageSource->render(painter, parameters, *this);
+ if (RenderImageSource* imageSource = source->as<RenderImageSource>()) {
+ imageSource->render(painter, parameters, *this);
+ } else {
+ for (const RenderTile& tile : renderTiles) {
+ Bucket* bucket = tile.tile.getBucket(*baseImpl);
+ assert(dynamic_cast<RasterBucket*>(bucket));
+ painter.renderRaster(
+ parameters,
+ *reinterpret_cast<RasterBucket*>(bucket),
+ *this,
+ tile.matrix,
+ false);
}
}
}
diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp
index 2af7b2f7ca..f04f7d34f3 100644
--- a/src/mbgl/renderer/layers/render_symbol_layer.cpp
+++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp
@@ -1,9 +1,12 @@
#include <mbgl/renderer/layers/render_symbol_layer.hpp>
-#include <mbgl/layout/symbol_layout.hpp>
-#include <mbgl/renderer/bucket.hpp>
+#include <mbgl/renderer/buckets/symbol_bucket.hpp>
#include <mbgl/renderer/bucket_parameters.hpp>
#include <mbgl/renderer/property_evaluation_parameters.hpp>
+#include <mbgl/renderer/painter.hpp>
+#include <mbgl/renderer/render_tile.hpp>
+#include <mbgl/tile/tile.hpp>
#include <mbgl/style/layers/symbol_layer_impl.hpp>
+#include <mbgl/layout/symbol_layout.hpp>
#include <mbgl/tile/geometry_tile_data.hpp>
namespace mbgl {
@@ -55,6 +58,18 @@ bool RenderSymbolLayer::hasTransition() const {
return unevaluated.hasTransition();
}
+void RenderSymbolLayer::render(Painter& painter, PaintParameters& parameters, RenderSource*) {
+ for (const RenderTile& tile : renderTiles) {
+ Bucket* bucket = tile.tile.getBucket(*baseImpl);
+ assert(dynamic_cast<SymbolBucket*>(bucket));
+ painter.renderSymbol(
+ parameters,
+ *reinterpret_cast<SymbolBucket*>(bucket),
+ *this,
+ tile);
+ }
+}
+
style::IconPaintProperties::PossiblyEvaluated RenderSymbolLayer::iconPaintProperties() const {
return style::IconPaintProperties::PossiblyEvaluated {
evaluated.get<style::IconOpacity>(),
diff --git a/src/mbgl/renderer/layers/render_symbol_layer.hpp b/src/mbgl/renderer/layers/render_symbol_layer.hpp
index a201b6298f..f29ceb504c 100644
--- a/src/mbgl/renderer/layers/render_symbol_layer.hpp
+++ b/src/mbgl/renderer/layers/render_symbol_layer.hpp
@@ -66,6 +66,7 @@ public:
void transition(const TransitionParameters&) override;
void evaluate(const PropertyEvaluationParameters&) override;
bool hasTransition() const override;
+ void render(Painter&, PaintParameters&, RenderSource*) override;
style::IconPaintProperties::PossiblyEvaluated iconPaintProperties() const;
style::TextPaintProperties::PossiblyEvaluated textPaintProperties() const;
diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp
index 8e76d6bfc4..3835cedd92 100644
--- a/src/mbgl/renderer/painter.cpp
+++ b/src/mbgl/renderer/painter.cpp
@@ -287,10 +287,7 @@ void Painter::renderPass(PaintParameters& parameters,
if (!layer.hasRenderPass(pass))
continue;
- if (layer.is<RenderBackgroundLayer>()) {
- MBGL_DEBUG_GROUP(context, "background");
- renderBackground(parameters, *layer.as<RenderBackgroundLayer>());
- } else if (layer.is<RenderFillExtrusionLayer>()) {
+ if (layer.is<RenderFillExtrusionLayer>()) {
const auto size = context.viewport.getCurrentValue().size;
if (!extrusionTexture || extrusionTexture->getSize() != size) {
diff --git a/src/mbgl/renderer/render_layer.cpp b/src/mbgl/renderer/render_layer.cpp
index 3f9d68003e..eb2b74ffe0 100644
--- a/src/mbgl/renderer/render_layer.cpp
+++ b/src/mbgl/renderer/render_layer.cpp
@@ -9,7 +9,6 @@
#include <mbgl/renderer/layers/render_symbol_layer.hpp>
#include <mbgl/style/types.hpp>
#include <mbgl/renderer/render_tile.hpp>
-#include <mbgl/tile/tile.hpp>
namespace mbgl {
@@ -68,14 +67,5 @@ void RenderLayer::setRenderTiles(std::vector<std::reference_wrapper<RenderTile>>
renderTiles = std::move(tiles);
}
-void RenderLayer::render(Painter& painter, PaintParameters& parameters, RenderSource*) {
- for (auto& tileRef : renderTiles) {
- auto& tile = tileRef.get();
- auto bucket = tile.tile.getBucket(*baseImpl);
- bucket->render(painter, parameters, *this, tile);
- }
-}
-
-
} //namespace mbgl
diff --git a/src/mbgl/renderer/render_layer.hpp b/src/mbgl/renderer/render_layer.hpp
index e06f479281..79a292953b 100644
--- a/src/mbgl/renderer/render_layer.hpp
+++ b/src/mbgl/renderer/render_layer.hpp
@@ -62,7 +62,7 @@ public:
// Checks whether this layer can be rendered.
bool needsRendering(float zoom) const;
- virtual void render(Painter&, PaintParameters&, RenderSource*);
+ virtual void render(Painter&, PaintParameters&, RenderSource*) = 0;
// Check wether the given geometry intersects
// with the feature
diff --git a/src/mbgl/renderer/sources/render_image_source.cpp b/src/mbgl/renderer/sources/render_image_source.cpp
index 475b852412..f654b83884 100644
--- a/src/mbgl/renderer/sources/render_image_source.cpp
+++ b/src/mbgl/renderer/sources/render_image_source.cpp
@@ -184,10 +184,10 @@ void RenderImageSource::update(Immutable<style::Source::Impl> baseImpl_,
void RenderImageSource::render(Painter& painter,
PaintParameters& parameters,
- const RenderLayer& layer) {
+ const RenderRasterLayer& layer) {
if (isEnabled() && isLoaded() && !bucket->needsUpload()) {
for (auto matrix : matrices) {
- bucket->render(painter, parameters, layer, matrix);
+ painter.renderRaster(parameters, *bucket, layer, matrix, true);
}
}
}
diff --git a/src/mbgl/renderer/sources/render_image_source.hpp b/src/mbgl/renderer/sources/render_image_source.hpp
index 6389251709..6deffca046 100644
--- a/src/mbgl/renderer/sources/render_image_source.hpp
+++ b/src/mbgl/renderer/sources/render_image_source.hpp
@@ -5,14 +5,10 @@
#include <mbgl/style/sources/image_source_impl.hpp>
namespace mbgl {
-class RenderLayer;
+
+class RenderRasterLayer;
class PaintParameters;
class RasterBucket;
-class LatLng;
-
-namespace gl {
-class Context;
-} // namespace gl
class RenderImageSource : public RenderSource {
public:
@@ -22,7 +18,7 @@ public:
bool isLoaded() const final;
void startRender(Painter&) final;
- void render(Painter&, PaintParameters&, const RenderLayer&);
+ void render(Painter&, PaintParameters&, const RenderRasterLayer&);
void finishRender(Painter&) final;
void update(Immutable<style::Source::Impl>,