mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-19 21:52:45 +00:00
Don't use ManagedTexture in GameInfoCache, not needed.
This commit is contained in:
parent
82bdc9ec50
commit
75e96df448
@ -924,7 +924,7 @@ public:
|
||||
|
||||
// PIC1 is the loading image, so let's only draw if it's available.
|
||||
if (ginfo && ginfo->pic1.texture) {
|
||||
Draw::Texture *texture = ginfo->pic1.texture->GetTexture();
|
||||
Draw::Texture *texture = ginfo->pic1.texture;
|
||||
if (texture) {
|
||||
dc.GetDrawContext()->BindTexture(0, texture);
|
||||
|
||||
|
@ -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 = CreateManagedTextureFromFileData(thin3d, (const uint8_t *)tex.data.data(), (int)tex.data.size(), ImageFileType::DETECT, false, info->GetTitle().c_str());
|
||||
tex.texture = CreateTextureFromFileData(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 {
|
||||
|
@ -64,18 +64,22 @@ enum class IdentifiedFileType;
|
||||
|
||||
struct GameInfoTex {
|
||||
std::string data;
|
||||
std::unique_ptr<ManagedTexture> texture;
|
||||
Draw::Texture *texture = nullptr;
|
||||
// The time at which the Icon and the BG were loaded.
|
||||
// Can be useful to fade them in smoothly once they appear.
|
||||
double timeLoaded = 0.0;
|
||||
std::atomic<bool> dataLoaded{};
|
||||
|
||||
// Can ONLY be called from the main thread!
|
||||
void Clear() {
|
||||
if (!data.empty()) {
|
||||
data.clear();
|
||||
dataLoaded = false;
|
||||
}
|
||||
texture.reset(nullptr);
|
||||
if (texture) {
|
||||
texture->Release();
|
||||
texture = nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -231,7 +231,7 @@ void GameButton::Draw(UIContext &dc) {
|
||||
using namespace UI;
|
||||
|
||||
if (ginfo->icon.texture) {
|
||||
texture = ginfo->icon.texture->GetTexture();
|
||||
texture = ginfo->icon.texture;
|
||||
}
|
||||
|
||||
int x = bounds_.x;
|
||||
@ -1425,7 +1425,7 @@ bool MainScreen::DrawBackgroundFor(UIContext &dc, const Path &gamePath, float pr
|
||||
}
|
||||
|
||||
auto pic = ginfo->GetBGPic();
|
||||
Draw::Texture *texture = pic ? pic->texture->GetTexture() : nullptr;
|
||||
Draw::Texture *texture = pic ? pic->texture : nullptr;
|
||||
|
||||
uint32_t color = whiteAlpha(ease(progress)) & 0xFFc0c0c0;
|
||||
if (texture) {
|
||||
|
@ -269,7 +269,7 @@ private:
|
||||
if (!pic)
|
||||
return;
|
||||
|
||||
dc.GetDrawContext()->BindTexture(0, pic->texture->GetTexture());
|
||||
dc.GetDrawContext()->BindTexture(0, pic->texture);
|
||||
uint32_t color = whiteAlpha(amount) & 0xFFc0c0c0;
|
||||
dc.Draw()->DrawTexRect(dc.GetBounds(), 0, 0, 1, 1, color);
|
||||
dc.Flush();
|
||||
@ -379,7 +379,7 @@ void DrawGameBackground(UIContext &dc, const Path &gamePath, float x, float y, f
|
||||
|
||||
GameInfoTex *pic = ginfo ? ginfo->GetBGPic() : nullptr;
|
||||
if (pic) {
|
||||
dc.GetDrawContext()->BindTexture(0, pic->texture->GetTexture());
|
||||
dc.GetDrawContext()->BindTexture(0, pic->texture);
|
||||
uint32_t color = whiteAlpha(ease((time_now_d() - pic->timeLoaded) * 3)) & 0xFFc0c0c0;
|
||||
dc.Draw()->DrawTexRect(dc.GetBounds(), 0,0,1,1, color);
|
||||
dc.Flush();
|
||||
|
@ -300,7 +300,7 @@ void SavedataButton::Draw(UIContext &dc) {
|
||||
using namespace UI;
|
||||
|
||||
if (ginfo->icon.texture) {
|
||||
texture = ginfo->icon.texture->GetTexture();
|
||||
texture = ginfo->icon.texture;
|
||||
}
|
||||
|
||||
int x = bounds_.x;
|
||||
@ -736,7 +736,7 @@ void GameIconView::Draw(UIContext &dc) {
|
||||
float nw = std::min(bounds_.h * textureWidth_ / textureHeight_, (float)bounds_.w);
|
||||
|
||||
dc.Flush();
|
||||
dc.GetDrawContext()->BindTexture(0, info->icon.texture->GetTexture());
|
||||
dc.GetDrawContext()->BindTexture(0, info->icon.texture);
|
||||
dc.Draw()->Rect(bounds_.x, bounds_.y, nw, bounds_.h, color);
|
||||
dc.Flush();
|
||||
dc.RebindTexture();
|
||||
|
Loading…
x
Reference in New Issue
Block a user