summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-04-20 12:39:51 -0700
committerAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-06-01 15:38:01 -0700
commit1b86bf16b2cfc37b86e526673bb2e25de6adf9ee (patch)
treec236a5f8e7c4eea9a8e7560620671217a791074d
parentaa6647e910073edffbd1f3c087ed110927c38aeb (diff)
downloadqtlocation-mapboxgl-1b86bf16b2cfc37b86e526673bb2e25de6adf9ee.tar.gz
[core] Render Image Source
-rw-r--r--cmake/core-files.cmake2
-rw-r--r--include/mbgl/style/sources/image_source.hpp2
-rw-r--r--src/mbgl/renderer/buckets/raster_bucket.cpp25
-rw-r--r--src/mbgl/renderer/buckets/raster_bucket.hpp18
-rw-r--r--src/mbgl/renderer/layers/render_raster_layer.cpp36
-rw-r--r--src/mbgl/renderer/layers/render_raster_layer.hpp3
-rw-r--r--src/mbgl/renderer/painter.hpp3
-rw-r--r--src/mbgl/renderer/painters/painter_debug.cpp28
-rw-r--r--src/mbgl/renderer/painters/painter_raster.cpp11
-rw-r--r--src/mbgl/renderer/render_source.cpp3
-rw-r--r--src/mbgl/renderer/sources/render_image_source.cpp176
-rw-r--r--src/mbgl/renderer/sources/render_image_source.hpp71
-rw-r--r--src/mbgl/style/sources/image_source.cpp2
-rw-r--r--src/mbgl/style/sources/image_source_impl.cpp2
-rw-r--r--src/mbgl/style/sources/image_source_impl.hpp2
15 files changed, 368 insertions, 16 deletions
diff --git a/cmake/core-files.cmake b/cmake/core-files.cmake
index f314f9e0ce..53873af7b1 100644
--- a/cmake/core-files.cmake
+++ b/cmake/core-files.cmake
@@ -242,6 +242,8 @@ set(MBGL_CORE_FILES
# renderer/sources
src/mbgl/renderer/sources/render_geojson_source.cpp
src/mbgl/renderer/sources/render_geojson_source.hpp
+ src/mbgl/renderer/sources/render_image_source.cpp
+ src/mbgl/renderer/sources/render_image_source.hpp
src/mbgl/renderer/sources/render_raster_source.cpp
src/mbgl/renderer/sources/render_raster_source.hpp
src/mbgl/renderer/sources/render_vector_source.cpp
diff --git a/include/mbgl/style/sources/image_source.hpp b/include/mbgl/style/sources/image_source.hpp
index e7e598a972..fd67ad38e5 100644
--- a/include/mbgl/style/sources/image_source.hpp
+++ b/include/mbgl/style/sources/image_source.hpp
@@ -18,7 +18,7 @@ public:
const std::string& getURL() const;
void setURL(const std::string& url) ;
- void setImage(mbgl::UnassociatedImage);
+ void setImage(mbgl::UnassociatedImage&&);
void setCoordinates(const std::vector<LatLng>&);
std::vector<LatLng> getCoordinates() const;
diff --git a/src/mbgl/renderer/buckets/raster_bucket.cpp b/src/mbgl/renderer/buckets/raster_bucket.cpp
index 4a25959868..fa105fd38d 100644
--- a/src/mbgl/renderer/buckets/raster_bucket.cpp
+++ b/src/mbgl/renderer/buckets/raster_bucket.cpp
@@ -1,18 +1,26 @@
+#include <mbgl/gl/context.hpp>
+#include <mbgl/programs/raster_program.hpp>
#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 {
-
using namespace style;
RasterBucket::RasterBucket(UnassociatedImage&& image_) : image(std::move(image_)) {
}
+RasterBucket::RasterBucket(RasterBucket&& other) : image(std::move(other.image)) {
+ uploaded = false;
+}
+
void RasterBucket::upload(gl::Context& context) {
- texture = context.createTexture(std::move(image));
+ texture = context.createTexture(image);
+ if (vertices.vertexSize() > 0) {
+ vertexBuffer = context.createVertexBuffer(std::move(vertices));
+ indexBuffer = context.createIndexBuffer(std::move(indices));
+ }
uploaded = true;
}
@@ -20,7 +28,14 @@ void RasterBucket::render(Painter& painter,
PaintParameters& parameters,
const RenderLayer& layer,
const RenderTile& tile) {
- painter.renderRaster(parameters, *this, *layer.as<RenderRasterLayer>(), 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 {
diff --git a/src/mbgl/renderer/buckets/raster_bucket.hpp b/src/mbgl/renderer/buckets/raster_bucket.hpp
index 334954e3f4..b7b1d312dc 100644
--- a/src/mbgl/renderer/buckets/raster_bucket.hpp
+++ b/src/mbgl/renderer/buckets/raster_bucket.hpp
@@ -1,22 +1,38 @@
#pragma once
+#include <mbgl/gl/index_buffer.hpp>
+#include <mbgl/gl/texture.hpp>
+#include <mbgl/gl/vertex_buffer.hpp>
+#include <mbgl/programs/raster_program.hpp>
#include <mbgl/renderer/bucket.hpp>
#include <mbgl/util/image.hpp>
+#include <mbgl/util/mat4.hpp>
#include <mbgl/util/optional.hpp>
-#include <mbgl/gl/texture.hpp>
namespace mbgl {
class RasterBucket : public Bucket {
public:
RasterBucket(UnassociatedImage&&);
+ RasterBucket(RasterBucket&&);
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;
UnassociatedImage image;
optional<gl::Texture> texture;
+
+ gl::VertexVector<RasterLayoutVertex> vertices;
+ gl::IndexVector<gl::Triangles> indices;
+ gl::SegmentVector<RasterAttributes> segments;
+
+ optional<gl::VertexBuffer<RasterLayoutVertex>> vertexBuffer;
+ optional<gl::IndexBuffer<gl::Triangles>> indexBuffer;
};
} // namespace mbgl
diff --git a/src/mbgl/renderer/layers/render_raster_layer.cpp b/src/mbgl/renderer/layers/render_raster_layer.cpp
index feb3a4aca9..3551f9fa9a 100644
--- a/src/mbgl/renderer/layers/render_raster_layer.cpp
+++ b/src/mbgl/renderer/layers/render_raster_layer.cpp
@@ -1,6 +1,11 @@
#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/render_tile.hpp>
+#include <mbgl/tile/tile.hpp>
+#include <mbgl/renderer/sources/render_image_source.hpp>
+#include <mbgl/renderer/painter.hpp>
namespace mbgl {
@@ -31,4 +36,35 @@ bool RenderRasterLayer::hasTransition() const {
return unevaluated.hasTransition();
}
+void RenderRasterLayer::uploadBuckets(gl::Context& context, RenderSource* source) {
+ if (renderTiles.size() > 0) {
+ for (const auto& tileRef : renderTiles) {
+ const auto& bucket = tileRef.get().tile.getBucket(impl());
+ if (bucket && bucket->needsUpload()) {
+ bucket->upload(context);
+ }
+ }
+ } else {
+ RenderImageSource* imageSource = dynamic_cast<RenderImageSource*>(source);
+ if (imageSource) {
+ imageSource->upload(context);
+ }
+ }
+}
+
+void RenderRasterLayer::render(Painter& painter, PaintParameters& parameters, RenderSource* source) {
+ if (renderTiles.size() > 0) {
+ for (auto& tileRef : renderTiles) {
+ auto& tile = tileRef.get();
+ auto bucket = tile.tile.getBucket(impl());
+ bucket->render(painter, parameters, *this, tile);
+ }
+ } else {
+ RenderImageSource* imageSource = dynamic_cast<RenderImageSource*>(source);
+ if (imageSource) {
+ imageSource->render(painter, parameters, *this);
+ }
+ }
+}
+
} // namespace mbgl
diff --git a/src/mbgl/renderer/layers/render_raster_layer.hpp b/src/mbgl/renderer/layers/render_raster_layer.hpp
index eecb0cd02d..f252d80242 100644
--- a/src/mbgl/renderer/layers/render_raster_layer.hpp
+++ b/src/mbgl/renderer/layers/render_raster_layer.hpp
@@ -15,6 +15,9 @@ public:
void evaluate(const PropertyEvaluationParameters&) override;
bool hasTransition() const override;
+ void uploadBuckets(gl::Context&, RenderSource*) override;
+ void render(Painter& , PaintParameters& , RenderSource*) override;
+
std::unique_ptr<Bucket> createBucket(const BucketParameters&, const std::vector<const RenderLayer*>&) const override;
// Paint properties
diff --git a/src/mbgl/renderer/painter.hpp b/src/mbgl/renderer/painter.hpp
index 5c3a8794a9..e361b0f7d7 100644
--- a/src/mbgl/renderer/painter.hpp
+++ b/src/mbgl/renderer/painter.hpp
@@ -85,12 +85,13 @@ public:
void renderClippingMask(const UnwrappedTileID&, const ClipID&);
void renderTileDebug(const RenderTile&);
+ void renderTileDebug(const mat4& matrix);
void renderFill(PaintParameters&, FillBucket&, const RenderFillLayer&, const RenderTile&);
void renderFillExtrusion(PaintParameters&, FillExtrusionBucket&, const RenderFillExtrusionLayer&, const RenderTile&);
void renderLine(PaintParameters&, LineBucket&, const RenderLineLayer&, const RenderTile&);
void renderCircle(PaintParameters&, CircleBucket&, const RenderCircleLayer&, const RenderTile&);
void renderSymbol(PaintParameters&, SymbolBucket&, const RenderSymbolLayer&, const RenderTile&);
- void renderRaster(PaintParameters&, RasterBucket&, const RenderRasterLayer&, const RenderTile&);
+ void renderRaster(PaintParameters&, RasterBucket&, const RenderRasterLayer&, const mat4&, bool useBucketBuffers /* = false */);
void renderBackground(PaintParameters&, const RenderBackgroundLayer&);
void renderItem(PaintParameters&, const RenderItem&);
diff --git a/src/mbgl/renderer/painters/painter_debug.cpp b/src/mbgl/renderer/painters/painter_debug.cpp
index 4794d79d45..ee76aee54c 100644
--- a/src/mbgl/renderer/painters/painter_debug.cpp
+++ b/src/mbgl/renderer/painters/painter_debug.cpp
@@ -77,6 +77,34 @@ void Painter::renderTileDebug(const RenderTile& renderTile) {
}
}
+void Painter::renderTileDebug(const mat4& matrix) {
+ if (frame.debugOptions == MapDebugOptions::NoDebug)
+ return;
+
+ static const style::Properties<>::PossiblyEvaluated properties {};
+ static const DebugProgram::PaintPropertyBinders paintAttibuteData(properties, 0);
+
+ if (frame.debugOptions & MapDebugOptions::TileBorders) {
+ programs->debug.draw(
+ context,
+ gl::LineStrip { 4.0f * frame.pixelRatio },
+ gl::DepthMode::disabled(),
+ gl::StencilMode::disabled(),
+ gl::ColorMode::unblended(),
+ DebugProgram::UniformValues {
+ uniforms::u_matrix::Value{ matrix },
+ uniforms::u_color::Value{ Color::red() }
+ },
+ tileVertexBuffer,
+ tileBorderIndexBuffer,
+ tileBorderSegments,
+ paintAttibuteData,
+ properties,
+ state.getZoom()
+ );
+ }
+}
+
#ifndef NDEBUG
void Painter::renderClipMasks(PaintParameters&) {
context.setStencilMode(gl::StencilMode::disabled());
diff --git a/src/mbgl/renderer/painters/painter_raster.cpp b/src/mbgl/renderer/painters/painter_raster.cpp
index 1f0d72be40..56e38ae8f4 100644
--- a/src/mbgl/renderer/painters/painter_raster.cpp
+++ b/src/mbgl/renderer/painters/painter_raster.cpp
@@ -42,7 +42,8 @@ static std::array<float, 3> spinWeights(float spin) {
void Painter::renderRaster(PaintParameters& parameters,
RasterBucket& bucket,
const RenderRasterLayer& layer,
- const RenderTile& tile) {
+ const mat4& matrix,
+ bool useBucketBuffers = false) {
if (pass != RenderPass::Translucent)
return;
if (!bucket.hasData())
@@ -62,7 +63,7 @@ void Painter::renderRaster(PaintParameters& parameters,
gl::StencilMode::disabled(),
colorModeForRenderPass(),
RasterProgram::UniformValues {
- uniforms::u_matrix::Value{ tile.matrix },
+ uniforms::u_matrix::Value{ matrix },
uniforms::u_image0::Value{ 0 },
uniforms::u_image1::Value{ 1 },
uniforms::u_opacity::Value{ properties.get<RasterOpacity>() },
@@ -76,9 +77,9 @@ void Painter::renderRaster(PaintParameters& parameters,
uniforms::u_scale_parent::Value{ 1.0f },
uniforms::u_tl_parent::Value{ std::array<float, 2> {{ 0.0f, 0.0f }} },
},
- rasterVertexBuffer,
- quadTriangleIndexBuffer,
- rasterSegments,
+ useBucketBuffers ? *bucket.vertexBuffer : rasterVertexBuffer,
+ useBucketBuffers ? *bucket.indexBuffer : quadTriangleIndexBuffer,
+ useBucketBuffers ? bucket.segments : rasterSegments,
paintAttributeData,
properties,
state.getZoom()
diff --git a/src/mbgl/renderer/render_source.cpp b/src/mbgl/renderer/render_source.cpp
index 4b411aa703..c59f767d26 100644
--- a/src/mbgl/renderer/render_source.cpp
+++ b/src/mbgl/renderer/render_source.cpp
@@ -4,6 +4,7 @@
#include <mbgl/renderer/sources/render_raster_source.hpp>
#include <mbgl/renderer/sources/render_vector_source.hpp>
#include <mbgl/annotation/render_annotation_source.hpp>
+#include <mbgl/renderer/sources/render_image_source.hpp>
#include <mbgl/tile/tile.hpp>
namespace mbgl {
@@ -23,6 +24,8 @@ std::unique_ptr<RenderSource> RenderSource::create(Immutable<Source::Impl> impl)
return nullptr;
case SourceType::Annotations:
return std::make_unique<RenderAnnotationSource>(staticImmutableCast<AnnotationSource::Impl>(impl));
+ case SourceType::Image:
+ return std::make_unique<RenderImageSource>(staticImmutableCast<ImageSource::Impl>(impl));
}
// Not reachable, but placate GCC.
diff --git a/src/mbgl/renderer/sources/render_image_source.cpp b/src/mbgl/renderer/sources/render_image_source.cpp
new file mode 100644
index 0000000000..975b08eb47
--- /dev/null
+++ b/src/mbgl/renderer/sources/render_image_source.cpp
@@ -0,0 +1,176 @@
+#include <mbgl/map/transform_state.hpp>
+#include <mbgl/math/log2.hpp>
+#include <mbgl/renderer/buckets/raster_bucket.hpp>
+#include <mbgl/renderer/painter.hpp>
+#include <mbgl/renderer/render_tile.hpp>
+#include <mbgl/renderer/sources/render_image_source.hpp>
+#include <mbgl/renderer/tile_parameters.hpp>
+#include <mbgl/util/tile_coordinate.hpp>
+#include <mbgl/util/tile_cover.hpp>
+
+namespace mbgl {
+
+using namespace style;
+
+RenderImageSource::RenderImageSource(Immutable<style::ImageSource::Impl> impl_)
+ : RenderSource(impl_), shouldRender(false) {
+}
+
+const style::ImageSource::Impl& RenderImageSource::impl() const {
+ return static_cast<const style::ImageSource::Impl&>(*baseImpl);
+}
+
+bool RenderImageSource::isLoaded() const {
+ return !!bucket;
+}
+
+void RenderImageSource::startRender(algorithm::ClipIDGenerator&,
+ const mat4& projMatrix,
+ const mat4&,
+ const TransformState& transformState) {
+
+ if (!isLoaded()) {
+ return;
+ }
+ matrices.clear();
+
+ for (size_t i = 0; i < tileIds.size(); i++) {
+ mat4 matrix;
+ matrix::identity(matrix);
+ transformState.matrixFor(matrix, tileIds[i]);
+ matrix::multiply(matrix, projMatrix, matrix);
+ matrices.push_back(matrix);
+ }
+}
+
+void RenderImageSource::finishRender(Painter& painter) {
+ if (!isLoaded() || !shouldRender) {
+ return;
+ }
+ for (auto matrix : matrices) {
+ painter.renderTileDebug(matrix);
+ }
+}
+
+std::unordered_map<std::string, std::vector<Feature>> RenderImageSource::queryRenderedFeatures(
+ const ScreenLineString&, const TransformState&, const RenderedQueryOptions&) const {
+ return {};
+}
+
+std::vector<Feature> RenderImageSource::querySourceFeatures(const SourceQueryOptions&) const {
+ return {};
+}
+
+void RenderImageSource::upload(gl::Context& context) {
+ if (isLoaded() && bucket->needsUpload() && shouldRender) {
+ bucket->upload(context);
+ }
+}
+
+void RenderImageSource::updateTiles(const TileParameters& parameters) {
+
+ auto transformState = parameters.transformState;
+ auto size = transformState.getSize();
+ double viewportHeight = size.height;
+
+ auto coords = impl().getCoordinates();
+
+ // Compute the screen coordinates at wrap=0 for the given LatLng
+ ScreenCoordinate nePixel = { -INFINITY, -INFINITY };
+ ScreenCoordinate swPixel = { INFINITY, INFINITY };
+
+ for (LatLng latLng : coords) {
+ ScreenCoordinate pixel = transformState.latLngToScreenCoordinate(latLng);
+ swPixel.x = std::min(swPixel.x, pixel.x);
+ nePixel.x = std::max(nePixel.x, pixel.x);
+ swPixel.y = std::min(swPixel.y, viewportHeight - pixel.y);
+ nePixel.y = std::max(nePixel.y, viewportHeight - pixel.y);
+ }
+ double width = nePixel.x - swPixel.x;
+ double height = nePixel.y - swPixel.y;
+
+ // Don't bother drawing the ImageSource unless it occupies >4 screen pixels
+ shouldRender = (width * height > 4);
+ if (!shouldRender) {
+ return;
+ }
+
+ // Calculate the optimum zoom level to determine the tile ids to use for transforms
+ double minScale = INFINITY;
+ if (width > 0 || height > 0) {
+ double scaleX = double(size.width) / width;
+ double scaleY = double(size.height) / height;
+ minScale = util::min(scaleX, scaleY);
+ }
+ double zoom = transformState.getZoom() + util::log2(minScale);
+ zoom = util::clamp(zoom, transformState.getMinZoom(), transformState.getMaxZoom());
+
+ auto imageBounds = LatLngBounds::hull(coords[0], coords[1]);
+ imageBounds.extend(coords[2]);
+ imageBounds.extend(coords[3]);
+ auto tileCover = util::tileCover(imageBounds, ::floor(zoom));
+ tileIds.clear();
+ tileIds.push_back(tileCover[0]);
+
+ // Add additional wrapped tile ids if neccessary
+ auto idealTiles = util::tileCover(transformState, transformState.getZoom());
+ for (auto tile : idealTiles) {
+ if (tile.wrap != 0 && tileCover[0].canonical.isChildOf(tile.canonical)) {
+ tileIds.push_back({ tile.wrap, tileCover[0].canonical });
+ }
+ }
+
+ // Calculate Geometry Coordinates based on tile cover at ideal zoom
+ GeometryCoordinates geomCoords;
+ for (auto latLng : coords) {
+ auto tc = TileCoordinate::fromLatLng(0, latLng);
+ auto gc = TileCoordinate::toGeometryCoordinate(tileIds[0], tc.p);
+ geomCoords.push_back(gc);
+ }
+ setupBucket(geomCoords);
+}
+
+void RenderImageSource::setupBucket(GeometryCoordinates& geomCoords) {
+ if (!bucket) {
+ UnassociatedImage img = impl().getImage().clone();
+ if (!img.valid()) {
+ return;
+ }
+ bucket = std::make_unique<RasterBucket>(std::move(img));
+ } else {
+ // Reuse the bucket
+ bucket = std::make_unique<RasterBucket>(std::move(*bucket));
+ }
+
+ // Set Bucket Vertices, Indices, and segments
+ bucket->vertices.emplace_back(
+ RasterProgram::layoutVertex({ geomCoords[0].x, geomCoords[0].y }, { 0, 0 }));
+ bucket->vertices.emplace_back(
+ RasterProgram::layoutVertex({ geomCoords[1].x, geomCoords[1].y }, { 32767, 0 }));
+ bucket->vertices.emplace_back(
+ RasterProgram::layoutVertex({ geomCoords[3].x, geomCoords[3].y }, { 0, 32767 }));
+ bucket->vertices.emplace_back(
+ RasterProgram::layoutVertex({ geomCoords[2].x, geomCoords[2].y }, { 32767, 32767 }));
+
+ bucket->indices.emplace_back(0, 1, 2);
+ bucket->indices.emplace_back(1, 2, 3);
+
+ bucket->segments.emplace_back(0, 0, 4, 6);
+}
+
+void RenderImageSource::render(Painter& painter,
+ PaintParameters& parameters,
+ const RenderLayer& layer) {
+ if (isLoaded() && !bucket->needsUpload() && shouldRender) {
+ for (auto matrix : matrices) {
+ bucket->render(painter, parameters, layer, matrix);
+ }
+ }
+}
+
+void RenderImageSource::dumpDebugLogs() const {
+ Log::Info(Event::General, "RenderImageSource::id: %s", impl().id.c_str());
+ Log::Info(Event::General, "RenderImageSource::loaded: %s", isLoaded() ? "yes" : "no");
+}
+
+} // namespace mbgl
diff --git a/src/mbgl/renderer/sources/render_image_source.hpp b/src/mbgl/renderer/sources/render_image_source.hpp
new file mode 100644
index 0000000000..769f932f27
--- /dev/null
+++ b/src/mbgl/renderer/sources/render_image_source.hpp
@@ -0,0 +1,71 @@
+#pragma once
+
+#include <mbgl/renderer/buckets/raster_bucket.hpp>
+#include <mbgl/renderer/render_source.hpp>
+#include <mbgl/renderer/render_tile.hpp>
+#include <mbgl/style/sources/image_source_impl.hpp>
+#include <mbgl/tile/geometry_tile_data.hpp>
+#include <mbgl/util/image.hpp>
+#include <mbgl/util/optional.hpp>
+
+namespace mbgl {
+class RenderLayer;
+class PaintParameters;
+
+namespace gl {
+class Context;
+} // namespace gl
+
+class RenderImageSource : public RenderSource {
+public:
+ RenderImageSource(Immutable<style::ImageSource::Impl>);
+
+ bool isLoaded() const final;
+ void upload(gl::Context&);
+
+ void startRender(algorithm::ClipIDGenerator&,
+ const mat4& projMatrix,
+ const mat4& clipMatrix,
+ const TransformState&) final;
+
+ void render(Painter&, PaintParameters&, const RenderLayer&);
+
+ void finishRender(Painter&) final;
+
+ void updateTiles(const TileParameters&) final;
+ void removeTiles() final {
+ }
+ void invalidateTiles() final {
+ }
+ void reloadTiles() final {
+ }
+
+ std::map<UnwrappedTileID, RenderTile>& getRenderTiles() final {
+ return tiles;
+ }
+
+ std::unordered_map<std::string, std::vector<Feature>>
+ queryRenderedFeatures(const ScreenLineString& geometry,
+ const TransformState& transformState,
+ const RenderedQueryOptions& options) const final;
+
+ std::vector<Feature> querySourceFeatures(const SourceQueryOptions&) const final;
+
+ void setCacheSize(size_t) final {
+ }
+ void onLowMemory() final {
+ }
+ void dumpDebugLogs() const final;
+
+private:
+ const style::ImageSource::Impl& impl() const;
+ void setupBucket(GeometryCoordinates& coordiantes);
+ std::map<UnwrappedTileID, RenderTile> tiles;
+
+ std::vector<UnwrappedTileID> tileIds;
+ std::unique_ptr<RasterBucket> bucket;
+ std::vector<mat4> matrices;
+ bool shouldRender;
+};
+
+} // namespace mbgl
diff --git a/src/mbgl/style/sources/image_source.cpp b/src/mbgl/style/sources/image_source.cpp
index 3c33a7807f..79df65697c 100644
--- a/src/mbgl/style/sources/image_source.cpp
+++ b/src/mbgl/style/sources/image_source.cpp
@@ -37,7 +37,7 @@ void ImageSource::setURL(const std::string& url_) {
}
}
-void ImageSource::setImage(mbgl::UnassociatedImage image_) {
+void ImageSource::setImage(mbgl::UnassociatedImage&& image_) {
url = {};
if (req) {
req.reset();
diff --git a/src/mbgl/style/sources/image_source_impl.cpp b/src/mbgl/style/sources/image_source_impl.cpp
index e16b33b4ca..3678f641cb 100644
--- a/src/mbgl/style/sources/image_source_impl.cpp
+++ b/src/mbgl/style/sources/image_source_impl.cpp
@@ -22,7 +22,7 @@ ImageSource::Impl::Impl(const Impl& rhs, UnassociatedImage image_)
}
ImageSource::Impl::~Impl() = default;
-void ImageSource::Impl::setImage(UnassociatedImage image_) {
+void ImageSource::Impl::setImage(UnassociatedImage&& image_) {
image = std::move(image_);
}
diff --git a/src/mbgl/style/sources/image_source_impl.hpp b/src/mbgl/style/sources/image_source_impl.hpp
index 439db4fa64..26f025db74 100644
--- a/src/mbgl/style/sources/image_source_impl.hpp
+++ b/src/mbgl/style/sources/image_source_impl.hpp
@@ -17,7 +17,7 @@ public:
~Impl() final;
- void setImage(UnassociatedImage );
+ void setImage(UnassociatedImage&& );
const mbgl::UnassociatedImage& getImage() const;
std::vector<LatLng> getCoordinates() const;