[core] Load sources only if there is at least one visible layer

This commit is contained in:
Bruno de Oliveira Abinader
2015-12-15 16:06:34 -08:00
parent 5a63ce5576
commit 93725e062a
8 changed files with 27 additions and 15 deletions

View File

@@ -39,9 +39,7 @@ Source::Source() {}
Source::~Source() = default;
bool Source::isLoaded() const {
if (!loaded) {
return false;
}
if (!loaded) return false;
for (const auto& tile : tiles) {
if (tile.second->data->getState() != TileData::State::parsed) {
@@ -52,6 +50,10 @@ bool Source::isLoaded() const {
return true;
}
bool Source::isLoading() const {
return !loaded && req.operator bool();
}
// Note: This is a separate function that must be called exactly once after creation
// The reason this isn't part of the constructor is that calling shared_from_this() in
// the constructor fails.