diff options
author | Leith Bade <leith@mapbox.com> | 2014-12-03 19:56:20 +1100 |
---|---|---|
committer | Leith Bade <leith@mapbox.com> | 2014-12-03 19:56:20 +1100 |
commit | 8762d5a9b6d8e6da624ac86cd21d8a40efbc1895 (patch) | |
tree | e235764c1772127b2c5aad3ff20288588cb42070 /include | |
parent | 1bffbb09082cb399f4eb19d85f5d8fcb767a4498 (diff) | |
parent | 50669307c5648e62941a63e0c75dba8602448d9d (diff) | |
download | qtlocation-mapboxgl-8762d5a9b6d8e6da624ac86cd21d8a40efbc1895.tar.gz |
Merge branch 'master' of github.com:mapbox/mapbox-gl-native into android-mason
Conflicts:
include/mbgl/map/map.hpp
src/map/map.cpp
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/map/map.hpp | 26 | ||||
-rw-r--r-- | include/mbgl/map/raster_tile_data.hpp | 4 | ||||
-rw-r--r-- | include/mbgl/map/source.hpp | 6 | ||||
-rw-r--r-- | include/mbgl/map/tile_parser.hpp | 10 | ||||
-rw-r--r-- | include/mbgl/map/vector_tile_data.hpp | 6 | ||||
-rw-r--r-- | include/mbgl/renderer/raster_bucket.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/util/raster.hpp | 6 | ||||
-rw-r--r-- | include/mbgl/util/texture_pool.hpp (renamed from include/mbgl/util/texturepool.hpp) | 2 | ||||
-rw-r--r-- | include/mbgl/util/uv_detail.hpp | 18 |
9 files changed, 48 insertions, 32 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 9d00d0f523..25cbf8bde1 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -26,7 +26,7 @@ class Style; class StyleLayer; class StyleLayerGroup; class StyleSource; -class Texturepool; +class TexturePool; class FileSource; class View; @@ -82,12 +82,12 @@ public: void setAppliedClasses(const std::vector<std::string> &classes); void toggleClass(const std::string &name); const std::vector<std::string> &getAppliedClasses() const; - void setDefaultTransitionDuration(uint64_t duration_milliseconds = 0); + void setDefaultTransitionDuration(uint64_t milliseconds = 0); uint64_t getDefaultTransitionDuration(); void setStyleURL(const std::string &url); void setStyleJSON(std::string newStyleJSON, const std::string &base = ""); std::string getStyleJSON() const; - void setAccessToken(std::string access_token); + void setAccessToken(std::string accessToken); std::string getAccessToken() const; // Transition @@ -160,9 +160,9 @@ private: std::unique_ptr<uv::loop> loop; std::unique_ptr<uv::worker> workers; std::unique_ptr<uv::thread> thread; - std::unique_ptr<uv::async> async_terminate; - std::unique_ptr<uv::async> async_render; - std::unique_ptr<uv::async> async_cleanup; + std::unique_ptr<uv::async> asyncTerminate; + std::unique_ptr<uv::async> asyncRender; + std::unique_ptr<uv::async> asyncCleanup; bool terminating = false; bool pausing = false; @@ -174,24 +174,24 @@ private: // If cleared, the next time the render thread attempts to render the map, it will *actually* // render the map. - std::atomic_flag is_clean = ATOMIC_FLAG_INIT; + std::atomic_flag isClean = ATOMIC_FLAG_INIT; // If this flag is cleared, the current back buffer is ready for being swapped with the front // buffer (i.e. it has rendered data). - std::atomic_flag is_swapped = ATOMIC_FLAG_INIT; + std::atomic_flag isSwapped = ATOMIC_FLAG_INIT; // This is cleared once the current front buffer has been presented and the back buffer is // ready for rendering. - std::atomic_flag is_rendered = ATOMIC_FLAG_INIT; + std::atomic_flag isRendered = ATOMIC_FLAG_INIT; // Stores whether the map thread has been stopped already. - std::atomic_bool is_stopped; + std::atomic_bool isStopped; View &view; #ifndef NDEBUG - const unsigned long main_thread; - unsigned long map_thread = -1; + const unsigned long mainThread; + unsigned long mapThread = -1; #endif Transform transform; @@ -204,7 +204,7 @@ private: util::ptr<GlyphStore> glyphStore; SpriteAtlas spriteAtlas; util::ptr<Sprite> sprite; - util::ptr<Texturepool> texturepool; + util::ptr<TexturePool> texturePool; Painter painter; diff --git a/include/mbgl/map/raster_tile_data.hpp b/include/mbgl/map/raster_tile_data.hpp index cbbd864aae..42070d9c61 100644 --- a/include/mbgl/map/raster_tile_data.hpp +++ b/include/mbgl/map/raster_tile_data.hpp @@ -10,13 +10,13 @@ namespace mbgl { class Painter; class SourceInfo; class StyleLayer; -class Texturepool; +class TexturePool; class RasterTileData : public TileData { friend class TileParser; public: - RasterTileData(Tile::ID const& id, Texturepool&, const SourceInfo&); + RasterTileData(Tile::ID const& id, TexturePool&, const SourceInfo&); ~RasterTileData(); virtual void parse(); diff --git a/include/mbgl/map/source.hpp b/include/mbgl/map/source.hpp index c36376fd5d..8976f67b05 100644 --- a/include/mbgl/map/source.hpp +++ b/include/mbgl/map/source.hpp @@ -23,7 +23,7 @@ class GlyphStore; class SpriteAtlas; class Sprite; class FileSource; -class Texturepool; +class TexturePool; class Style; class Painter; class StyleLayer; @@ -39,7 +39,7 @@ public: util::ptr<Style>, GlyphAtlas&, GlyphStore&, SpriteAtlas&, util::ptr<Sprite>, - Texturepool&, FileSource&, + TexturePool&, FileSource&, std::function<void ()> callback); void updateMatrices(const mat4 &projMatrix, const TransformState &transform); @@ -63,7 +63,7 @@ private: util::ptr<Style>, GlyphAtlas&, GlyphStore&, SpriteAtlas&, util::ptr<Sprite>, - FileSource&, Texturepool&, + FileSource&, TexturePool&, const Tile::ID&, std::function<void ()> callback); diff --git a/include/mbgl/map/tile_parser.hpp b/include/mbgl/map/tile_parser.hpp index 460225db9f..beae3af831 100644 --- a/include/mbgl/map/tile_parser.hpp +++ b/include/mbgl/map/tile_parser.hpp @@ -13,7 +13,7 @@ namespace mbgl { class Bucket; -class Texturepool; +class TexturePool; class FontStack; class GlyphAtlas; class GlyphStore; @@ -28,7 +28,7 @@ class StyleBucketSymbol; class StyleLayerGroup; class VectorTileData; class Collision; -class Texturepool; +class TexturePool; class TileParser : private util::noncopyable { @@ -39,7 +39,7 @@ public: GlyphStore & glyphStore, SpriteAtlas & spriteAtlas, const util::ptr<Sprite> &sprite, - Texturepool& texturepool); + TexturePool& texturePool); ~TileParser(); public: @@ -51,7 +51,7 @@ private: std::unique_ptr<Bucket> createBucket(util::ptr<StyleBucket> bucket_desc); std::unique_ptr<Bucket> createFillBucket(const VectorTileLayer& layer, const FilterExpression &filter, const StyleBucketFill &fill); - std::unique_ptr<Bucket> createRasterBucket(Texturepool& texturepool, const StyleBucketRaster &raster); + std::unique_ptr<Bucket> createRasterBucket(const StyleBucketRaster &raster); std::unique_ptr<Bucket> createLineBucket(const VectorTileLayer& layer, const FilterExpression &filter, const StyleBucketLine &line); std::unique_ptr<Bucket> createSymbolBucket(const VectorTileLayer& layer, const FilterExpression &filter, const StyleBucketSymbol &symbol); @@ -67,7 +67,7 @@ private: GlyphStore & glyphStore; SpriteAtlas & spriteAtlas; util::ptr<Sprite> sprite; - Texturepool& texturePool; + TexturePool& texturePool; std::unique_ptr<Collision> collision; }; diff --git a/include/mbgl/map/vector_tile_data.hpp b/include/mbgl/map/vector_tile_data.hpp index 0a0569f2ee..b9bf55a1b3 100644 --- a/include/mbgl/map/vector_tile_data.hpp +++ b/include/mbgl/map/vector_tile_data.hpp @@ -24,7 +24,7 @@ class GlyphAtlas; class GlyphStore; class SpriteAtlas; class Sprite; -class Texturepool; +class TexturePool; class Style; class VectorTileData : public TileData { @@ -35,7 +35,7 @@ public: float mapMaxZoom, util::ptr<Style>, GlyphAtlas&, GlyphStore&, SpriteAtlas&, util::ptr<Sprite>, - Texturepool&, + TexturePool&, const SourceInfo&); ~VectorTileData(); @@ -62,7 +62,7 @@ protected: GlyphStore& glyphStore; SpriteAtlas& spriteAtlas; util::ptr<Sprite> sprite; - Texturepool& texturepool; + TexturePool& texturePool; util::ptr<Style> style; public: diff --git a/include/mbgl/renderer/raster_bucket.hpp b/include/mbgl/renderer/raster_bucket.hpp index 8c5d9839a5..0a7651d7cc 100644 --- a/include/mbgl/renderer/raster_bucket.hpp +++ b/include/mbgl/renderer/raster_bucket.hpp @@ -16,7 +16,7 @@ class VertexArrayObject; class RasterBucket : public Bucket { public: - RasterBucket(Texturepool&, const StyleBucketRaster&); + RasterBucket(TexturePool&, const StyleBucketRaster&); virtual void render(Painter& painter, util::ptr<StyleLayer> layer_desc, const Tile::ID& id, const mat4 &matrix); virtual bool hasData() const; diff --git a/include/mbgl/util/raster.hpp b/include/mbgl/util/raster.hpp index d74c78f714..ff27f509f4 100644 --- a/include/mbgl/util/raster.hpp +++ b/include/mbgl/util/raster.hpp @@ -2,7 +2,7 @@ #define MBGL_UTIL_RASTER #include <mbgl/util/transition.hpp> -#include <mbgl/util/texturepool.hpp> +#include <mbgl/util/texture_pool.hpp> #include <mbgl/util/image.hpp> #include <mbgl/util/ptr.hpp> #include <mbgl/renderer/prerendered_texture.hpp> @@ -17,7 +17,7 @@ namespace mbgl { class Raster : public std::enable_shared_from_this<Raster> { public: - Raster(Texturepool&); + Raster(TexturePool&); ~Raster(); // load image data @@ -57,7 +57,7 @@ private: bool loaded = false; // shared texture pool - Texturepool& texturepool; + TexturePool& texturePool; // min/mag filter uint32_t filter = 0; diff --git a/include/mbgl/util/texturepool.hpp b/include/mbgl/util/texture_pool.hpp index 566d8c1750..95d918c237 100644 --- a/include/mbgl/util/texturepool.hpp +++ b/include/mbgl/util/texture_pool.hpp @@ -9,7 +9,7 @@ namespace mbgl { -class Texturepool : private util::noncopyable { +class TexturePool : private util::noncopyable { public: GLuint getTextureID(); diff --git a/include/mbgl/util/uv_detail.hpp b/include/mbgl/util/uv_detail.hpp index 8f39f699b9..f1f9491b25 100644 --- a/include/mbgl/util/uv_detail.hpp +++ b/include/mbgl/util/uv_detail.hpp @@ -20,10 +20,26 @@ void close(T* handle) { class thread : public mbgl::util::noncopyable { public: - inline operator uv_thread_t *() { return &t; } + inline thread(std::function<void ()> fn_) + : fn(fn_) { + if (uv_thread_create(&t, thread_cb, this) != 0) { + throw std::runtime_error("failed to initialize thread"); + } + } + + void join() { + if (uv_thread_join(&t) != 0) { + throw std::runtime_error("failed to join thred"); + } + } private: + static void thread_cb(void* data) { + reinterpret_cast<thread*>(data)->fn(); + } + uv_thread_t t; + std::function<void ()> fn; }; class loop : public mbgl::util::noncopyable { |