diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-10-20 12:19:11 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-10-26 15:54:27 +0100 |
commit | c0c554e36fd43bfe57ef13fe60f9cd50b5c018fd (patch) | |
tree | b2c2cbbac1af0a6afbc9de51b90179ec3edaf32f /src/mbgl/map/tile_data.hpp | |
parent | 5173bf1bb8d21054b0dd6251d23eb37323d6c525 (diff) | |
download | qtlocation-mapboxgl-c0c554e36fd43bfe57ef13fe60f9cd50b5c018fd.tar.gz |
[core] reparse tiles when new data arrives
We're now reparsing tiles when they expire. We're also swapping out buckets atomically to avoid flickering data; i.e. we're displaying the old data as long as we don't have a new parsed bucket for that layer yet. The parsed buckets now live in the *TileData objects rather than in the TileWorker; only partially parsed == pending buckets will remain in the TileWorker. Once they're parsed, they're moved to the *TileData object.
Diffstat (limited to 'src/mbgl/map/tile_data.hpp')
-rw-r--r-- | src/mbgl/map/tile_data.hpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/mbgl/map/tile_data.hpp b/src/mbgl/map/tile_data.hpp index fcbf25fb62..44f0304c8d 100644 --- a/src/mbgl/map/tile_data.hpp +++ b/src/mbgl/map/tile_data.hpp @@ -3,17 +3,18 @@ #include <mbgl/util/noncopyable.hpp> #include <mbgl/map/tile_id.hpp> -#include <mbgl/renderer/debug_bucket.hpp> -#include <mbgl/geometry/debug_font_buffer.hpp> +#include <mbgl/renderer/bucket.hpp> #include <atomic> #include <string> +#include <memory> #include <functional> namespace mbgl { class StyleLayer; class Worker; +class DebugBucket; class TileData : private util::noncopyable { public: @@ -57,6 +58,8 @@ public: obsolete }; + static const char* StateToString(State); + // Tile data considered "Ready" can be used for rendering. Data in // partial state is still waiting for network resources but can also // be rendered, although layers will be missing. @@ -65,14 +68,14 @@ public: } TileData(const TileID&); - virtual ~TileData() = default; + virtual ~TileData(); // Mark this tile as no longer needed and cancel any pending work. virtual void cancel() = 0; virtual Bucket* getBucket(const StyleLayer&) = 0; - virtual bool reparse(std::function<void ()>) { return true; } + virtual bool parsePending(std::function<void ()>) { return true; } virtual void redoPlacement(float, float, bool) {} bool isReady() const { @@ -90,14 +93,13 @@ public: const TileID id; // Contains the tile ID string for painting debug information. - DebugBucket debugBucket; - DebugFontBuffer debugFontBuffer; + std::unique_ptr<DebugBucket> debugBucket; protected: std::atomic<State> state; std::string error; }; -} +} // namespace mbgl #endif |