Generate mipmap levels for screenshot views.

This commit is contained in:
Unknown W. Brackets 2016-06-12 07:15:45 -07:00
parent 6151f8ef9f
commit 5b402dd6e5
2 changed files with 5 additions and 1 deletions

View file

@ -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()) {

View file

@ -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_;
};