Clear image cache when tabbing out of canvas
This commit is contained in:
parent
c7024578af
commit
1f80107005
9 changed files with 32 additions and 0 deletions
|
|
@ -287,6 +287,20 @@ ResourceDisplay::Type ImageResourceDisplay::get_type() const {
|
|||
return ResourceDisplay::Type::IMAGE;
|
||||
}
|
||||
|
||||
void ImageResourceDisplay::clear_cache() {
|
||||
if(loadThread) {
|
||||
shutdownLoadThread = true;
|
||||
loadThread->join();
|
||||
loadThread = nullptr;
|
||||
}
|
||||
for(auto& frame : frames) {
|
||||
for(auto& mipmap : frame.mipmapLevels)
|
||||
mipmap = nullptr;
|
||||
}
|
||||
for(auto& mipmapStatus : mipmapLevelsStatus)
|
||||
mipmapStatus = MipmapLevelStatus::UNALLOCATED;
|
||||
}
|
||||
|
||||
ImageResourceDisplay::~ImageResourceDisplay() {
|
||||
if(loadThread) {
|
||||
shutdownLoadThread = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue