mirror of https://github.com/auygun/kaliber.git
Do not refresh image when texture is not in use
This commit is contained in:
parent
05b86a38c1
commit
325b07d844
|
@ -293,11 +293,13 @@ void Engine::RefreshImage(const std::string& asset_name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto image = it->second.create_image();
|
if (it->second.persistent || it->second.use_count > 0) {
|
||||||
if (image)
|
auto image = it->second.create_image();
|
||||||
it->second.texture->Update(std::move(image));
|
if (image)
|
||||||
else
|
it->second.texture->Update(std::move(image));
|
||||||
it->second.texture->Destroy();
|
else
|
||||||
|
it->second.texture->Destroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture* Engine::AcquireTexture(const std::string& asset_name) {
|
Texture* Engine::AcquireTexture(const std::string& asset_name) {
|
||||||
|
@ -307,9 +309,9 @@ Texture* Engine::AcquireTexture(const std::string& asset_name) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
it->second.use_count++;
|
||||||
if (!it->second.texture->IsValid())
|
if (!it->second.texture->IsValid())
|
||||||
RefreshImage(it->first);
|
RefreshImage(it->first);
|
||||||
it->second.use_count++;
|
|
||||||
return it->second.texture.get();
|
return it->second.texture.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue