Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
grorp committed May 30, 2024
1 parent 9fb6dee commit 8d4b393
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/gui/guiTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,10 @@ void GUITable::setTable(const TableOptions &options,

row->content_width = 0;
if (image) {
// Fit into row
s32 max_height = std::clamp(m_rowheight - 2 * vpadding, 1, m_rowheight);
row->image_scale = (f32)max_height / (f32)image->getOriginalSize().Height;
f32 max_image_scale = (f32)max_height / (f32)image->getOriginalSize().Height;
// Scale with display density, but make sure it fits into the row
row->image_scale = std::min(density, max_image_scale);
// When upscaling, only allow integer multiples
if (row->image_scale > 1.0f)
row->image_scale = std::floor(row->image_scale);
Expand Down

0 comments on commit 8d4b393

Please sign in to comment.