1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:37:35 +00:00

LibWeb: Add CSSPixels::nearest_value_for(FloatingPoint)

This is intended to annotate conversions from unknown floating-point
values to CSSPixels, and make it more obvious the fp value will be
rounded to the nearest fixed-point value.
This commit is contained in:
MacDue 2023-08-26 15:57:31 +01:00 committed by Alexander Kalenik
parent 360c0eb509
commit 71baa8c31a
28 changed files with 120 additions and 112 deletions

View file

@ -96,7 +96,7 @@ DevicePixelSize PaintContext::rounded_device_size(CSSPixelSize size) const
CSSPixels PaintContext::scale_to_css_pixels(DevicePixels device_pixels) const
{
return CSSPixels(device_pixels.value() / m_device_pixels_per_css_pixel);
return CSSPixels::nearest_value_for(device_pixels.value() / m_device_pixels_per_css_pixel);
}
CSSPixelPoint PaintContext::scale_to_css_point(DevicePixelPoint point) const