diff --git a/Common/Render/ManagedTexture.cpp b/Common/Render/ManagedTexture.cpp index 5bda26d3f7..1790c05e18 100644 --- a/Common/Render/ManagedTexture.cpp +++ b/Common/Render/ManagedTexture.cpp @@ -179,7 +179,7 @@ bool ManagedTexture::LoadFromFile(const std::string &filename, ImageFileType typ return retval; } -std::unique_ptr CreateTextureFromFile(Draw::DrawContext *draw, const char *filename, ImageFileType type, bool generateMips) { +std::unique_ptr CreateManagedTextureFromFile(Draw::DrawContext *draw, const char *filename, ImageFileType type, bool generateMips) { if (!draw) return std::unique_ptr(); // TODO: Load the texture on a background thread. @@ -225,7 +225,7 @@ Draw::Texture *ManagedTexture::GetTexture() { } // TODO: Remove the code duplication between this and LoadFromFileData -std::unique_ptr CreateTextureFromFileData(Draw::DrawContext *draw, const uint8_t *data, int size, ImageFileType type, bool generateMips, const char *name) { +std::unique_ptr CreateManagedTextureFromFileData(Draw::DrawContext *draw, const uint8_t *data, int size, ImageFileType type, bool generateMips, const char *name) { if (!draw) return std::unique_ptr(); ManagedTexture *mtex = new ManagedTexture(draw); diff --git a/Common/Render/ManagedTexture.h b/Common/Render/ManagedTexture.h index ed6e9918f6..6d67d4db60 100644 --- a/Common/Render/ManagedTexture.h +++ b/Common/Render/ManagedTexture.h @@ -40,6 +40,6 @@ private: bool loadPending_ = false; }; -std::unique_ptr CreateTextureFromFile(Draw::DrawContext *draw, const char *filename, ImageFileType fileType, bool generateMips); -std::unique_ptr CreateTextureFromFileData(Draw::DrawContext *draw, const uint8_t *data, int size, ImageFileType fileType, bool generateMips, const char *name); +std::unique_ptr CreateManagedTextureFromFile(Draw::DrawContext *draw, const char *filename, ImageFileType fileType, bool generateMips); +std::unique_ptr CreateManagedTextureFromFileData(Draw::DrawContext *draw, const uint8_t *data, int size, ImageFileType fileType, bool generateMips, const char *name); diff --git a/Common/UI/AsyncImageFileView.cpp b/Common/UI/AsyncImageFileView.cpp index 925d1c9337..a29941a64e 100644 --- a/Common/UI/AsyncImageFileView.cpp +++ b/Common/UI/AsyncImageFileView.cpp @@ -78,7 +78,7 @@ void AsyncImageFileView::DeviceRestored(Draw::DrawContext *draw) { void AsyncImageFileView::Draw(UIContext &dc) { using namespace Draw; if (!texture_ && !textureFailed_ && !filename_.empty()) { - texture_ = CreateTextureFromFile(dc.GetDrawContext(), filename_.c_str(), DETECT, true); + texture_ = CreateManagedTextureFromFile(dc.GetDrawContext(), filename_.c_str(), DETECT, true); if (!texture_.get()) textureFailed_ = true; } diff --git a/Common/UI/Context.cpp b/Common/UI/Context.cpp index da46f9d004..025af18a39 100644 --- a/Common/UI/Context.cpp +++ b/Common/UI/Context.cpp @@ -41,17 +41,17 @@ void UIContext::setUIAtlas(const std::string &name) { void UIContext::BeginFrame() { if (!uitexture_ || UIAtlas_ != lastUIAtlas_) { - uitexture_ = CreateTextureFromFile(draw_, UIAtlas_.c_str(), ImageFileType::ZIM, false); + uitexture_ = CreateManagedTextureFromFile(draw_, UIAtlas_.c_str(), ImageFileType::ZIM, false); lastUIAtlas_ = UIAtlas_; if (!fontTexture_) { #if PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(ANDROID) // Don't bother with loading font_atlas.zim #else - fontTexture_ = CreateTextureFromFile(draw_, "font_atlas.zim", ImageFileType::ZIM, false); + fontTexture_ = CreateManagedTextureFromFile(draw_, "font_atlas.zim", ImageFileType::ZIM, false); #endif if (!fontTexture_) { // Load the smaller ascii font only, like on Android. For debug ui etc. - fontTexture_ = CreateTextureFromFile(draw_, "asciifont_atlas.zim", ImageFileType::ZIM, false); + fontTexture_ = CreateManagedTextureFromFile(draw_, "asciifont_atlas.zim", ImageFileType::ZIM, false); if (!fontTexture_) { WARN_LOG(SYSTEM, "Failed to load font_atlas.zim or asciifont_atlas.zim"); } diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index fcca47a348..04bd9d4c8e 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -816,7 +816,7 @@ void GameInfoCache::SetupTexture(std::shared_ptr &info, Draw::DrawCont using namespace Draw; if (tex.data.size()) { if (!tex.texture) { - tex.texture = CreateTextureFromFileData(thin3d, (const uint8_t *)tex.data.data(), (int)tex.data.size(), ImageFileType::DETECT, false, info->GetTitle().c_str()); + tex.texture = CreateManagedTextureFromFileData(thin3d, (const uint8_t *)tex.data.data(), (int)tex.data.size(), ImageFileType::DETECT, false, info->GetTitle().c_str()); if (tex.texture) { tex.timeLoaded = time_now_d(); } else { diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index a5dce8b793..89dc438d65 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -294,7 +294,7 @@ void UIBackgroundInit(UIContext &dc) { const Path bgJpg = GetSysDirectory(DIRECTORY_SYSTEM) / "background.jpg"; if (File::Exists(bgPng) || File::Exists(bgJpg)) { const Path &bgFile = File::Exists(bgPng) ? bgPng : bgJpg; - bgTexture = CreateTextureFromFile(dc.GetDrawContext(), bgFile.c_str(), DETECT, true); + bgTexture = CreateManagedTextureFromFile(dc.GetDrawContext(), bgFile.c_str(), DETECT, true); } } diff --git a/UI/Store.cpp b/UI/Store.cpp index baacc3de9a..14773af044 100644 --- a/UI/Store.cpp +++ b/UI/Store.cpp @@ -181,7 +181,7 @@ void HttpImageFileView::Draw(UIContext &dc) { } if (!textureData_.empty()) { - texture_ = CreateTextureFromFileData(dc.GetDrawContext(), (const uint8_t *)(textureData_.data()), (int)textureData_.size(), DETECT, false, "store_icon"); + texture_ = CreateManagedTextureFromFileData(dc.GetDrawContext(), (const uint8_t *)(textureData_.data()), (int)textureData_.size(), DETECT, false, "store_icon"); if (!texture_) textureFailed_ = true; textureData_.clear();