diff --git a/Common/Render/ManagedTexture.cpp b/Common/Render/ManagedTexture.cpp index d9997b33f3..90de360d79 100644 --- a/Common/Render/ManagedTexture.cpp +++ b/Common/Render/ManagedTexture.cpp @@ -23,8 +23,8 @@ // TODO: It really feels like we should be able to simplify this. class TextureLoadTask : public Task { public: - TextureLoadTask(std::string_view filename, ImageFileType type, bool generateMips, TempImage *tempImage, ManagedTexture::LoadState *state, LimitedWaitable *waitable) - : filename_(filename), type_(type), generateMips_(generateMips), tempImage_(tempImage), state_(state), waitable_(waitable) {} + TextureLoadTask(std::string_view filename, ImageFileType type, TempImage *tempImage, ManagedTexture::LoadState *state, LimitedWaitable *waitable) + : filename_(filename), type_(type), tempImage_(tempImage), state_(state), waitable_(waitable) {} TaskType Type() const override { return TaskType::IO_BLOCKING; } TaskPriority Priority() const override { return TaskPriority::NORMAL; } @@ -55,7 +55,6 @@ private: std::string filename_; TempImage *tempImage_; ImageFileType type_; - bool generateMips_; // not yet used ManagedTexture::LoadState *state_; }; @@ -211,8 +210,8 @@ Draw::Texture *ManagedTexture::GetTexture() { return texture_; } -ManagedTexture::ManagedTexture(Draw::DrawContext *draw, std::string_view filename, ImageFileType type, bool generateMips) - : draw_(draw), filename_(filename), type_(type), generateMips_(generateMips) +ManagedTexture::ManagedTexture(Draw::DrawContext *draw, std::string_view filename, ImageFileType type) + : draw_(draw), filename_(filename), type_(type) { StartLoadTask(); } @@ -230,7 +229,7 @@ ManagedTexture::~ManagedTexture() { void ManagedTexture::StartLoadTask() { _dbg_assert_(!taskWaitable_); taskWaitable_ = new LimitedWaitable(); - g_threadManager.EnqueueTask(new TextureLoadTask(filename_, type_, generateMips_, &pendingImage_, &state_, taskWaitable_)); + g_threadManager.EnqueueTask(new TextureLoadTask(filename_, type_, &pendingImage_, &state_, taskWaitable_)); } void ManagedTexture::DeviceLost() { diff --git a/Common/Render/ManagedTexture.h b/Common/Render/ManagedTexture.h index 49bc6ced60..0ac6211796 100644 --- a/Common/Render/ManagedTexture.h +++ b/Common/Render/ManagedTexture.h @@ -44,7 +44,7 @@ struct TempImage { // Managed (will auto-reload from file) and async. For use in UI. class ManagedTexture { public: - ManagedTexture(Draw::DrawContext *draw, std::string_view filename, ImageFileType type = ImageFileType::DETECT, bool generateMips = false); + ManagedTexture(Draw::DrawContext *draw, std::string_view filename, ImageFileType type = ImageFileType::DETECT); ~ManagedTexture(); Draw::Texture *GetTexture(); // For immediate use, don't store. int Width() const { return texture_->Width(); } diff --git a/Common/UI/AsyncImageFileView.cpp b/Common/UI/AsyncImageFileView.cpp index 01c7f063c3..1b29a422bc 100644 --- a/Common/UI/AsyncImageFileView.cpp +++ b/Common/UI/AsyncImageFileView.cpp @@ -79,7 +79,7 @@ void AsyncImageFileView::DeviceRestored(Draw::DrawContext *draw) { void AsyncImageFileView::Draw(UIContext &dc) { using namespace Draw; if (!texture_ && !textureFailed_ && !filename_.empty()) { - texture_ = std::make_unique(dc.GetDrawContext(), filename_.c_str(), ImageFileType::DETECT, true); + texture_ = std::make_unique(dc.GetDrawContext(), filename_.c_str(), ImageFileType::DETECT); if (!texture_.get()) textureFailed_ = true; } diff --git a/Common/UI/View.cpp b/Common/UI/View.cpp index d2d7f30ae7..889e8fa6d2 100644 --- a/Common/UI/View.cpp +++ b/Common/UI/View.cpp @@ -1027,8 +1027,8 @@ void RadioButton::Draw(UIContext &dc) { } } -ImageView::ImageView(ImageID atlasImage, const std::string &text, ImageSizeMode sizeMode, LayoutParams *layoutParams) - : InertView(layoutParams), text_(text), atlasImage_(atlasImage), sizeMode_(sizeMode) {} +ImageView::ImageView(ImageID atlasImage, const std::string &text, LayoutParams *layoutParams) + : InertView(layoutParams), text_(text), atlasImage_(atlasImage) {} void ImageView::GetContentDimensions(const UIContext &dc, float &w, float &h) const { dc.Draw()->GetAtlas()->measureImage(atlasImage_, &w, &h); diff --git a/Common/UI/View.h b/Common/UI/View.h index 8c1576964b..80f37563f7 100644 --- a/Common/UI/View.h +++ b/Common/UI/View.h @@ -53,6 +53,12 @@ enum DrawableType { DRAW_STRETCH_IMAGE, }; +enum ImageSizeMode { + IS_DEFAULT, + IS_FIXED, + IS_KEEP_ASPECT, +}; + enum Visibility { V_VISIBLE, V_INVISIBLE, // Keeps position, not drawn or interacted with @@ -1116,15 +1122,9 @@ private: // TODO: Selections }; -enum ImageSizeMode { - IS_DEFAULT, - IS_FIXED, - IS_KEEP_ASPECT, -}; - class ImageView : public InertView { public: - ImageView(ImageID atlasImage, const std::string &text, ImageSizeMode sizeMode, LayoutParams *layoutParams = nullptr); + ImageView(ImageID atlasImage, const std::string &text, LayoutParams *layoutParams = nullptr); void GetContentDimensions(const UIContext &dc, float &w, float &h) const override; void Draw(UIContext &dc) override; std::string DescribeText() const override { return text_; } @@ -1133,7 +1133,6 @@ public: private: std::string text_; ImageID atlasImage_; - ImageSizeMode sizeMode_; // TODO: Not actually used yet. float scale_ = 1.0f; }; diff --git a/UI/MiscViews.cpp b/UI/MiscViews.cpp index b36068d173..5703a7c083 100644 --- a/UI/MiscViews.cpp +++ b/UI/MiscViews.cpp @@ -21,7 +21,7 @@ TextWithImage::TextWithImage(ImageID imageID, std::string_view text, UI::LinearL layoutParams_->height = ITEM_HEIGHT; } if (imageID.isValid()) { - Add(new ImageView(imageID, "", UI::IS_DEFAULT, new LinearLayoutParams(0.0f, UI::Gravity::G_VCENTER))); + Add(new ImageView(imageID, "", new LinearLayoutParams(0.0f, UI::Gravity::G_VCENTER))); } Add(new TextView(text, new LinearLayoutParams(1.0f, UI::Gravity::G_VCENTER))); } @@ -34,7 +34,7 @@ CopyableText::CopyableText(ImageID imageID, std::string_view text, UI::LinearLay layoutParams_->height = ITEM_HEIGHT; } if (imageID.isValid()) { - Add(new ImageView(imageID, "", UI::IS_DEFAULT, new LinearLayoutParams(0.0f, UI::Gravity::G_VCENTER))); + Add(new ImageView(imageID, "", new LinearLayoutParams(0.0f, UI::Gravity::G_VCENTER))); } Add(new TextView(text, new LinearLayoutParams(1.0f, UI::Gravity::G_VCENTER)))->SetBig(true); @@ -44,7 +44,7 @@ CopyableText::CopyableText(ImageID imageID, std::string_view text, UI::LinearLay }); } -TopBar::TopBar(const UIContext &ctx, TopBarFlags flags, std::string_view title, UI::LayoutParams *layoutParams) : UI::LinearLayout(ORIENT_HORIZONTAL, layoutParams), flags_(flags) { +TopBar::TopBar(const UIContext &ctx, TopBarFlags flags, std::string_view title, UI::LayoutParams *layoutParams) : UI::LinearLayout(ORIENT_HORIZONTAL, layoutParams) { using namespace UI; SetSpacing(10.0f); if (!layoutParams) { diff --git a/UI/MiscViews.h b/UI/MiscViews.h index 79b31df944..7f233fb45e 100644 --- a/UI/MiscViews.h +++ b/UI/MiscViews.h @@ -37,12 +37,11 @@ public: private: UI::Choice *backButton_ = nullptr; UI::Choice *contextMenuButton_ = nullptr; - TopBarFlags flags_ = TopBarFlags::Default; }; class ShinyIcon : public UI::ImageView { public: - ShinyIcon(ImageID atlasImage, UI::LayoutParams *layoutParams = 0) : UI::ImageView(atlasImage, "", UI::IS_DEFAULT, layoutParams) {} + ShinyIcon(ImageID atlasImage, UI::LayoutParams *layoutParams = 0) : UI::ImageView(atlasImage, "", layoutParams) {} void Draw(UIContext &dc) override; void SetAnimated(bool anim) { animated_ = anim; } private: