From e2e1c677cb634458b248480b301aa39d21d0c327 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 30 Nov 2020 13:55:38 +0100 Subject: [PATCH] GameInfoCache: Don't expose the workqueue. Was unused anyway. --- UI/EmuScreen.cpp | 2 +- UI/GameInfoCache.h | 2 -- UI/PauseScreen.cpp | 7 +++---- UI/PauseScreen.h | 4 +--- UI/ReportScreen.cpp | 2 +- UI/SavedataScreen.cpp | 5 ++--- 6 files changed, 8 insertions(+), 14 deletions(-) diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 572f068ea3..b1cfcd2b58 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -1078,7 +1078,7 @@ void EmuScreen::CreateViews() { chatButton_ = nullptr; } - saveStatePreview_ = new AsyncImageFileView("", IS_FIXED, nullptr, new AnchorLayoutParams(bounds.centerX(), 100, NONE, NONE, true)); + saveStatePreview_ = new AsyncImageFileView("", IS_FIXED, new AnchorLayoutParams(bounds.centerX(), 100, NONE, NONE, true)); saveStatePreview_->SetFixedSize(160, 90); saveStatePreview_->SetColor(0x90FFFFFF); saveStatePreview_->SetVisibility(V_GONE); diff --git a/UI/GameInfoCache.h b/UI/GameInfoCache.h index db7423ba2c..4f49443e08 100644 --- a/UI/GameInfoCache.h +++ b/UI/GameInfoCache.h @@ -170,8 +170,6 @@ public: std::shared_ptr GetInfo(Draw::DrawContext *draw, const std::string &gamePath, int wantFlags); void FlushBGs(); // Gets rid of all BG textures. Also gets rid of bg sounds. - PrioritizedWorkQueue *WorkQueue() { return gameInfoWQ_; } - void CancelAll(); void WaitUntilDone(std::shared_ptr &info); diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index f94559acb3..a2155d116e 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -48,7 +48,7 @@ #include "UI/OnScreenDisplay.h" #include "UI/GameInfoCache.h" -AsyncImageFileView::AsyncImageFileView(const std::string &filename, UI::ImageSizeMode sizeMode, PrioritizedWorkQueue *wq, UI::LayoutParams *layoutParams) +AsyncImageFileView::AsyncImageFileView(const std::string &filename, UI::ImageSizeMode sizeMode, UI::LayoutParams *layoutParams) : UI::Clickable(layoutParams), canFocus_(true), filename_(filename), color_(0xFFFFFFFF), sizeMode_(sizeMode), textureFailed_(false), fixedSizeW_(0.0f), fixedSizeH_(0.0f) {} AsyncImageFileView::~AsyncImageFileView() {} @@ -179,7 +179,7 @@ protected: UI::LinearLayout *content = new UI::LinearLayout(UI::ORIENT_VERTICAL); parent->Add(content); UI::Margins contentMargins(10, 0); - content->Add(new AsyncImageFileView(filename_, UI::IS_KEEP_ASPECT, nullptr, new UI::LinearLayoutParams(480, 272, contentMargins)))->SetCanBeFocused(false); + content->Add(new AsyncImageFileView(filename_, UI::IS_KEEP_ASPECT, new UI::LinearLayoutParams(480, 272, contentMargins)))->SetCanBeFocused(false); } private: @@ -230,10 +230,9 @@ SaveSlotView::SaveSlotView(const std::string &gameFilename, int slot, UI::Layout using namespace UI; screenshotFilename_ = SaveState::GenerateSaveSlotFilename(gamePath_, slot, SaveState::SCREENSHOT_EXTENSION); - PrioritizedWorkQueue *wq = g_gameInfoCache->WorkQueue(); Add(new Spacer(5)); - AsyncImageFileView *fv = Add(new AsyncImageFileView(screenshotFilename_, IS_DEFAULT, wq, new UI::LayoutParams(82 * 2, 47 * 2))); + AsyncImageFileView *fv = Add(new AsyncImageFileView(screenshotFilename_, IS_DEFAULT, new UI::LayoutParams(82 * 2, 47 * 2))); fv->SetOverlayText(StringFromFormat("%d", slot_ + 1)); auto pa = GetI18NCategory("Pause"); diff --git a/UI/PauseScreen.h b/UI/PauseScreen.h index 926302c141..6214744243 100644 --- a/UI/PauseScreen.h +++ b/UI/PauseScreen.h @@ -58,13 +58,11 @@ private: std::string gamePath_; }; -class PrioritizedWorkQueue; - // AsyncImageFileView loads a texture from a file, and reloads it as necessary. // TODO: Actually make async, doh. class AsyncImageFileView : public UI::Clickable { public: - AsyncImageFileView(const std::string &filename, UI::ImageSizeMode sizeMode, PrioritizedWorkQueue *wq, UI::LayoutParams *layoutParams = 0); + AsyncImageFileView(const std::string &filename, UI::ImageSizeMode sizeMode, UI::LayoutParams *layoutParams = 0); ~AsyncImageFileView(); void GetContentDimensionsBySpec(const UIContext &dc, UI::MeasureSpec horiz, UI::MeasureSpec vert, float &w, float &h) const override; diff --git a/UI/ReportScreen.cpp b/UI/ReportScreen.cpp index a5cf54e098..d922f44173 100644 --- a/UI/ReportScreen.cpp +++ b/UI/ReportScreen.cpp @@ -285,7 +285,7 @@ void ReportScreen::CreateViews() { if (tookScreenshot_ && !screenshotFilename_.empty()) { leftColumnItems->Add(new CheckBox(&includeScreenshot_, rp->T("FeedbackIncludeScreen", "Include a screenshot")))->SetEnabledPtr(&enableReporting_); - screenshot_ = leftColumnItems->Add(new AsyncImageFileView(screenshotFilename_, IS_KEEP_ASPECT, nullptr, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, Margins(12, 0)))); + screenshot_ = leftColumnItems->Add(new AsyncImageFileView(screenshotFilename_, IS_KEEP_ASPECT, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, Margins(12, 0)))); } else { if (tookScreenshot_) { includeScreenshot_ = false; diff --git a/UI/SavedataScreen.cpp b/UI/SavedataScreen.cpp index 54c1618aff..c4c1811371 100644 --- a/UI/SavedataScreen.cpp +++ b/UI/SavedataScreen.cpp @@ -25,7 +25,7 @@ #include "Common/Math/curves.h" #include "Common/System/NativeApp.h" #include "Common/System/System.h" -#include "Common/Thread/PrioritizedWorkQueue.h" +#include "Common/Data/Encoding/Utf8.h" #include "Common/UI/Context.h" #include "Common/UI/View.h" #include "Common/UI/ViewGroup.h" @@ -114,8 +114,7 @@ public: } else { std::string image_path = ReplaceAll(savePath_, ".ppst", ".jpg"); if (File::Exists(image_path)) { - PrioritizedWorkQueue *wq = g_gameInfoCache->WorkQueue(); - toprow->Add(new AsyncImageFileView(image_path, IS_KEEP_ASPECT, wq, new LinearLayoutParams(480, 272, Margins(10, 0)))); + toprow->Add(new AsyncImageFileView(image_path, IS_KEEP_ASPECT, new LinearLayoutParams(480, 272, Margins(10, 0)))); } else { toprow->Add(new TextView(sa->T("No screenshot"), new LinearLayoutParams(Margins(10, 5))))->SetTextColor(textStyle.fgColor); }