[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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user