Remove ManagedTexture from HttpImageView

This commit is contained in:
Henrik Rydgård committed 2023-12-12 22:44:03 +01:00
1 parent 75e96df448
commit 4c3f82da55
3 files changed
+10 -7

No files matched your search

+6 -4
View File
@@ -112,7 +112,7 @@ private:
std::shared_ptr<http::Request> download_;
std::string textureData_;
std::unique_ptr<ManagedTexture> texture_;
Draw::AutoRef<Draw::Texture> texture_;
bool textureFailed_ = false;
float fixedSizeW_ = 0.0f;
float fixedSizeH_ = 0.0f;
@@ -154,7 +154,9 @@ void HttpImageFileView::SetFilename(std::string filename) {
if (!useIconCache_ && path_ != filename) {
textureFailed_ = false;
path_ = filename;
texture_.reset(nullptr);
if (texture_) {
texture_.reset(nullptr);
}
}
}
@@ -181,7 +183,7 @@ void HttpImageFileView::Draw(UIContext &dc) {
}
if (!textureData_.empty()) {
texture_ = CreateManagedTextureFromFileData(dc.GetDrawContext(), (const uint8_t *)(textureData_.data()), (int)textureData_.size(), DETECT, false, "store_icon");
texture_ = CreateTextureFromFileData(dc.GetDrawContext(), (const uint8_t *)(textureData_.data()), (int)textureData_.size(), DETECT, false, "store_icon");
if (!texture_)
textureFailed_ = true;
textureData_.clear();
@@ -198,7 +200,7 @@ void HttpImageFileView::Draw(UIContext &dc) {
if (useIconCache_) {
texture = g_iconCache.BindIconTexture(&dc, path_);
} else {
texture = texture_->GetTexture();
texture = texture_;
}
if (texture) {