Skip to content

Commit

Permalink
fix(color): don't enlarge image in the file preview window (EdgeTX#4943)
Browse files Browse the repository at this point in the history
  • Loading branch information
philmoz authored Apr 30, 2024
1 parent 4f0610c commit 7968867
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions radio/src/gui/colorlcd/file_preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ FilePreview::FilePreview(Window *parent, const rect_t &rect) :
StaticImage(parent, rect)
{
hide();
dontEnlarge = true;
}

void FilePreview::setFile(const char *filename)
Expand Down
4 changes: 3 additions & 1 deletion radio/src/thirdparty/libopenui/src/static.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ void StaticImage::setZoom()
if (img && img->w && img->h) {
uint16_t zw = (width() * 256) / img->w;
uint16_t zh = (height() * 256) / img->h;
lv_img_set_zoom(image, min(zw, zh));
uint16_t z = min(zw, zh);
if (dontEnlarge) z = min(z, (uint16_t)256);
lv_img_set_zoom(image, z);
}
}

Expand Down
1 change: 1 addition & 0 deletions radio/src/thirdparty/libopenui/src/static.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class StaticImage : public Window
bool hasImage() const;

protected:
bool dontEnlarge = false;
lv_obj_t *image = nullptr;
};

Expand Down

0 comments on commit 7968867

Please sign in to comment.