From 5b402dd6e5e4d98fafed908685a777c02503f5b8 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 12 Jun 2016 07:15:45 -0700 Subject: [PATCH] Generate mipmap levels for screenshot views. --- UI/PauseScreen.cpp | 2 ++ UI/PauseScreen.h | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index cab3c55de1..e7ce2c46a5 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -80,6 +80,8 @@ void AsyncImageFileView::Draw(UIContext &dc) { texture_ = dc.GetThin3DContext()->CreateTextureFromFile(filename_.c_str(), DETECT); if (!texture_) textureFailed_ = true; + else if (textureAutoGen_) + texture_->AutoGenMipmaps(); } if (HasFocus()) { diff --git a/UI/PauseScreen.h b/UI/PauseScreen.h index c730f16816..0057b778f3 100644 --- a/UI/PauseScreen.h +++ b/UI/PauseScreen.h @@ -68,7 +68,7 @@ class PrioritizedWorkQueue; class AsyncImageFileView : public UI::Clickable { public: AsyncImageFileView(const std::string &filename, UI::ImageSizeMode sizeMode, PrioritizedWorkQueue *wq, UI::LayoutParams *layoutParams = 0) - : UI::Clickable(layoutParams), canFocus_(true), filename_(filename), color_(0xFFFFFFFF), sizeMode_(sizeMode), texture_(NULL), textureFailed_(false), fixedSizeW_(0.0f), fixedSizeH_(0.0f) {} + : UI::Clickable(layoutParams), canFocus_(true), filename_(filename), color_(0xFFFFFFFF), sizeMode_(sizeMode), texture_(NULL), textureFailed_(false), textureAutoGen_(true), fixedSizeW_(0.0f), fixedSizeH_(0.0f) {} ~AsyncImageFileView() { delete texture_; } @@ -81,6 +81,7 @@ public: void SetOverlayText(std::string text) { text_ = text; } void SetFixedSize(float fixW, float fixH) { fixedSizeW_ = fixW; fixedSizeH_ = fixH; } void SetCanBeFocused(bool can) { canFocus_ = can; } + void SetAutoGenMipmaps(bool a) { textureAutoGen_ = a; } bool CanBeFocused() const override { return canFocus_; } @@ -95,6 +96,7 @@ private: Thin3DTexture *texture_; bool textureFailed_; + bool textureAutoGen_; float fixedSizeW_; float fixedSizeH_; };