1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00

Everywhere: Add -Wdouble-promotion warning

This warning informs of float-to-double conversions. The best solution
seems to be to do math *either* in 32-bit *or* in 64-bit, and only to
cross over when absolutely necessary.
This commit is contained in:
Nicholas-Baron 2021-04-15 00:36:14 -07:00 committed by Andreas Kling
parent 6606d70826
commit 73dd293ec4
26 changed files with 105 additions and 98 deletions

View file

@ -380,9 +380,10 @@ void ImageEditor::scale_centered_on_position(const Gfx::IntPoint& position, floa
if (m_scale > 100.0f)
m_scale = 100.0f;
auto focus_point = Gfx::FloatPoint(
m_pan_origin.x() - ((float)position.x() - (float)width() / 2.0) / old_scale,
m_pan_origin.y() - ((float)position.y() - (float)height() / 2.0) / old_scale);
Gfx::FloatPoint focus_point {
m_pan_origin.x() - (position.x() - width() / 2.0f) / old_scale,
m_pan_origin.y() - (position.y() - height() / 2.0f) / old_scale
};
m_pan_origin = Gfx::FloatPoint(
focus_point.x() - m_scale / old_scale * (focus_point.x() - m_pan_origin.x()),