mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:07:35 +00:00
PixelPaint: Floor effective viewport size to whole integers
We don't have fractional pixels available, so don't attempt to use them.
This commit is contained in:
parent
a436f0c668
commit
7f962cd9d3
1 changed files with 3 additions and 3 deletions
|
@ -616,9 +616,9 @@ void ImageEditor::fit_image_to_view()
|
|||
|
||||
const float border_ratio = 0.95f;
|
||||
auto image_size = image().size();
|
||||
auto height_ratio = viewport_rect.height() / (float)image_size.height();
|
||||
auto width_ratio = viewport_rect.width() / (float)image_size.width();
|
||||
m_scale = border_ratio * min(height_ratio, width_ratio);
|
||||
auto height_ratio = floorf(border_ratio * viewport_rect.height()) / (float)image_size.height();
|
||||
auto width_ratio = floorf(border_ratio * viewport_rect.width()) / (float)image_size.width();
|
||||
m_scale = min(height_ratio, width_ratio);
|
||||
|
||||
float offset = m_show_rulers ? -m_ruler_thickness / (m_scale * 2.0f) : 0.0f;
|
||||
m_pan_origin = Gfx::FloatPoint(offset, offset);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue