Erase cached mipmap levels after a long time of not being used

This commit is contained in:
Yousef Khadadeh 2026-02-17 14:41:08 +03:00
parent 462443ed0a
commit a69d9e3c6c
2 changed files with 18 additions and 4 deletions

View file

@ -16,10 +16,14 @@ class ImageResourceDisplay : public ResourceDisplay {
virtual Type get_type() const override;
virtual ~ImageResourceDisplay() override;
private:
struct MipmapLevelData {
sk_sp<SkImage> imageData;
std::chrono::steady_clock::time_point timeLastUsed;
};
struct FrameData {
sk_sp<SkImage> data;
float duration;
std::unordered_map<unsigned, sk_sp<SkImage>> mipmapLevels;
std::unordered_map<unsigned, MipmapLevelData> mipmapLevels;
};
std::vector<FrameData> frames;