summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2019-03-07 23:24:52 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2019-03-08 18:37:41 +0200
commit2144e3f3b0b8f08b65c854225d7360847633f689 (patch)
tree16cadc63b1c3d438c5ddd4bf67aadb2e72e23130 /src/mbgl/renderer
parent2f88e8257b83b77f6c06c86c99f542976e7d5199 (diff)
downloadqtlocation-mapboxgl-2144e3f3b0b8f08b65c854225d7360847633f689.tar.gz
[core] Implement platform::Factory::sharedFileSource()upstream/map-refactor
Diffstat (limited to 'src/mbgl/renderer')
-rw-r--r--src/mbgl/renderer/renderer.cpp6
-rw-r--r--src/mbgl/renderer/renderer_impl.cpp11
-rw-r--r--src/mbgl/renderer/renderer_impl.hpp8
-rw-r--r--src/mbgl/renderer/tile_parameters.hpp6
4 files changed, 18 insertions, 13 deletions
diff --git a/src/mbgl/renderer/renderer.cpp b/src/mbgl/renderer/renderer.cpp
index c8be1d16ef..e5339326dd 100644
--- a/src/mbgl/renderer/renderer.cpp
+++ b/src/mbgl/renderer/renderer.cpp
@@ -9,12 +9,12 @@ namespace mbgl {
Renderer::Renderer(RendererBackend& backend,
float pixelRatio_,
- FileSource& fileSource_,
+ const FileSourceOptions& fileSourceOptions,
GLContextMode contextMode_,
const optional<std::string> programCacheDir_,
const optional<std::string> localFontFamily_)
- : impl(std::make_unique<Impl>(backend, pixelRatio_, fileSource_,
- contextMode_, std::move(programCacheDir_), std::move(localFontFamily_))) {
+ : impl(std::make_unique<Impl>(backend, pixelRatio_,
+ contextMode_, std::move(programCacheDir_), std::move(localFontFamily_), fileSourceOptions)) {
}
Renderer::~Renderer() {
diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp
index bfd518c11b..2ec271a444 100644
--- a/src/mbgl/renderer/renderer_impl.cpp
+++ b/src/mbgl/renderer/renderer_impl.cpp
@@ -1,5 +1,6 @@
#include <mbgl/annotation/annotation_manager.hpp>
#include <mbgl/layermanager/layer_manager.hpp>
+#include <mbgl/platform/factory.hpp>
#include <mbgl/renderer/renderer_impl.hpp>
#include <mbgl/renderer/renderer_backend.hpp>
#include <mbgl/renderer/renderer_observer.hpp>
@@ -37,17 +38,17 @@ static RendererObserver& nullObserver() {
Renderer::Impl::Impl(RendererBackend& backend_,
float pixelRatio_,
- FileSource& fileSource_,
GLContextMode contextMode_,
const optional<std::string> programCacheDir_,
- const optional<std::string> localFontFamily_)
+ const optional<std::string> localFontFamily_,
+ const FileSourceOptions& fileSourceOptions)
: backend(backend_)
- , fileSource(fileSource_)
, observer(&nullObserver())
, contextMode(contextMode_)
, pixelRatio(pixelRatio_)
, programCacheDir(programCacheDir_)
- , glyphManager(std::make_unique<GlyphManager>(fileSource, std::make_unique<LocalGlyphRasterizer>(localFontFamily_)))
+ , fileSource(platform::Factory::sharedFileSource(fileSourceOptions))
+ , glyphManager(std::make_unique<GlyphManager>(fileSourceOptions, std::make_unique<LocalGlyphRasterizer>(localFontFamily_)))
, imageManager(std::make_unique<ImageManager>())
, lineAtlas(std::make_unique<LineAtlas>(Size{ 256, 512 }))
, imageImpls(makeMutable<std::vector<Immutable<style::Image::Impl>>>())
@@ -107,9 +108,9 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
const TileParameters tileParameters {
updateParameters.pixelRatio,
+ fileSource,
updateParameters.debugOptions,
updateParameters.transformState,
- fileSource,
updateParameters.mode,
updateParameters.annotationManager,
*imageManager,
diff --git a/src/mbgl/renderer/renderer_impl.hpp b/src/mbgl/renderer/renderer_impl.hpp
index d820a50789..ded312527a 100644
--- a/src/mbgl/renderer/renderer_impl.hpp
+++ b/src/mbgl/renderer/renderer_impl.hpp
@@ -28,6 +28,7 @@ class RenderStaticData;
class RenderedQueryOptions;
class SourceQueryOptions;
class FileSource;
+class FileSourceOptions;
class GlyphManager;
class ImageManager;
class LineAtlas;
@@ -36,8 +37,8 @@ class CrossTileSymbolIndex;
class Renderer::Impl : public GlyphManagerObserver,
public RenderSourceObserver{
public:
- Impl(RendererBackend&, float pixelRatio_, FileSource&, GLContextMode,
- const optional<std::string> programCacheDir, const optional<std::string> localFontFamily);
+ Impl(RendererBackend&, float pixelRatio_, GLContextMode,
+ const optional<std::string> programCacheDir, const optional<std::string> localFontFamily, const FileSourceOptions&);
~Impl() final;
void markContextLost() {
@@ -89,7 +90,6 @@ private:
friend class Renderer;
RendererBackend& backend;
- FileSource& fileSource;
RendererObserver* observer;
@@ -107,6 +107,8 @@ private:
ZoomHistory zoomHistory;
TransformState transformState;
+ std::shared_ptr<FileSource> fileSource;
+
std::unique_ptr<GlyphManager> glyphManager;
std::unique_ptr<ImageManager> imageManager;
std::unique_ptr<LineAtlas> lineAtlas;
diff --git a/src/mbgl/renderer/tile_parameters.hpp b/src/mbgl/renderer/tile_parameters.hpp
index cbe8dfb3ba..9af7ceb736 100644
--- a/src/mbgl/renderer/tile_parameters.hpp
+++ b/src/mbgl/renderer/tile_parameters.hpp
@@ -2,10 +2,12 @@
#include <mbgl/map/mode.hpp>
+#include <memory>
+
namespace mbgl {
-class TransformState;
class FileSource;
+class TransformState;
class AnnotationManager;
class ImageManager;
class GlyphManager;
@@ -13,9 +15,9 @@ class GlyphManager;
class TileParameters {
public:
const float pixelRatio;
+ std::shared_ptr<FileSource> fileSource;
const MapDebugOptions debugOptions;
const TransformState& transformState;
- FileSource& fileSource;
const MapMode mode;
AnnotationManager& annotationManager;
ImageManager& imageManager;