Skip to content

Commit

Permalink
Some renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Dec 12, 2023
1 parent 76c7540 commit d2e10a0
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Common/Render/ManagedTexture.cpp
Expand Up @@ -179,7 +179,7 @@ bool ManagedTexture::LoadFromFile(const std::string &filename, ImageFileType typ
return retval;
}

std::unique_ptr<ManagedTexture> CreateTextureFromFile(Draw::DrawContext *draw, const char *filename, ImageFileType type, bool generateMips) {
std::unique_ptr<ManagedTexture> CreateManagedTextureFromFile(Draw::DrawContext *draw, const char *filename, ImageFileType type, bool generateMips) {
if (!draw)
return std::unique_ptr<ManagedTexture>();
// TODO: Load the texture on a background thread.
Expand Down Expand Up @@ -225,7 +225,7 @@ Draw::Texture *ManagedTexture::GetTexture() {
}

// TODO: Remove the code duplication between this and LoadFromFileData
std::unique_ptr<ManagedTexture> CreateTextureFromFileData(Draw::DrawContext *draw, const uint8_t *data, int size, ImageFileType type, bool generateMips, const char *name) {
std::unique_ptr<ManagedTexture> CreateManagedTextureFromFileData(Draw::DrawContext *draw, const uint8_t *data, int size, ImageFileType type, bool generateMips, const char *name) {
if (!draw)
return std::unique_ptr<ManagedTexture>();
ManagedTexture *mtex = new ManagedTexture(draw);
Expand Down
4 changes: 2 additions & 2 deletions Common/Render/ManagedTexture.h
Expand Up @@ -40,6 +40,6 @@ class ManagedTexture {
bool loadPending_ = false;
};

std::unique_ptr<ManagedTexture> CreateTextureFromFile(Draw::DrawContext *draw, const char *filename, ImageFileType fileType, bool generateMips);
std::unique_ptr<ManagedTexture> CreateTextureFromFileData(Draw::DrawContext *draw, const uint8_t *data, int size, ImageFileType fileType, bool generateMips, const char *name);
std::unique_ptr<ManagedTexture> CreateManagedTextureFromFile(Draw::DrawContext *draw, const char *filename, ImageFileType fileType, bool generateMips);
std::unique_ptr<ManagedTexture> CreateManagedTextureFromFileData(Draw::DrawContext *draw, const uint8_t *data, int size, ImageFileType fileType, bool generateMips, const char *name);

2 changes: 1 addition & 1 deletion Common/UI/AsyncImageFileView.cpp
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions Common/UI/Context.cpp
Expand Up @@ -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");
}
Expand Down
2 changes: 1 addition & 1 deletion UI/GameInfoCache.cpp
Expand Up @@ -816,7 +816,7 @@ void GameInfoCache::SetupTexture(std::shared_ptr<GameInfo> &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 {
Expand Down
2 changes: 1 addition & 1 deletion UI/MiscScreens.cpp
Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion UI/Store.cpp
Expand Up @@ -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();
Expand Down

0 comments on commit d2e10a0

Please sign in to comment.