[core] TileData::isReady() => TileData::isRenderable()

This commit is contained in:
Konstantin Käfer
2016-05-25 19:40:17 +02:00
parent e2bcea90fc
commit c60fd0604a
6 changed files with 11 additions and 15 deletions

View File

@@ -17,7 +17,7 @@ bool tryTile(const UnwrappedTileID& renderTileID,
Renderables& renderables) {
if (renderables.find(renderTileID) == renderables.end()) {
const auto it = dataTiles.find(dataTileID);
if (it == dataTiles.end() || !it->second->isReady()) {
if (it == dataTiles.end() || !it->second->isRenderable()) {
return false;
}

View File

@@ -288,7 +288,7 @@ RenderData Style::getRenderData() const {
for (auto& pair : source->getTiles()) {
auto& tile = pair.second;
if (!tile.data.isReady()) {
if (!tile.data.isRenderable()) {
continue;
}

View File

@@ -18,7 +18,7 @@ void TileCache::setSize(size_t size_) {
}
void TileCache::add(const OverscaledTileID& key, std::unique_ptr<TileData> data) {
if (!data->isReady() || !size) {
if (!data->isRenderable() || !size) {
return;
}
@@ -48,7 +48,7 @@ std::unique_ptr<TileData> TileCache::get(const OverscaledTileID& key) {
data = std::move(it->second);
tiles.erase(it);
orderedKeys.remove(key);
assert(data->isReady());
assert(data->isRenderable());
}
return data;

View File

@@ -66,13 +66,6 @@ public:
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.
inline static bool isReadyState(const State& state) {
return state == State::partial || state == State::parsed;
}
TileData(const OverscaledTileID&);
virtual ~TileData();
@@ -91,8 +84,11 @@ public:
const TransformState&,
const optional<std::vector<std::string>>& layerIDs);
bool isReady() const {
return isReadyState(state);
// Tile data considered "Renderable" 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.
bool isRenderable() const {
return state == State::partial || state == State::parsed;
}
// Returns true when there's at least some data that we can render.

View File

@@ -53,7 +53,7 @@ VectorTileData::VectorTileData(const OverscaledTileID& id_,
if (state == State::loading) {
state = State::loaded;
} else if (isReady()) {
} else if (isRenderable()) {
state = State::partial;
}

View File

@@ -44,7 +44,7 @@ struct MockBucket {};
struct MockTileData {
bool isReady() {
bool isRenderable() {
return ready;
}