From 439617cf6f27dd3a9ee8be3429c3309bea707bb6 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Sun, 6 Mar 2022 19:04:36 +0100 Subject: [PATCH] LibSoftGPU: Use `lroundf` instead of `roundf` in rasterization rect Casting a `float` to `int` might still inadvertently floor the value, while `lroundf` will return a properly rounded `long`. --- Userland/Libraries/LibSoftGPU/Device.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibSoftGPU/Device.cpp b/Userland/Libraries/LibSoftGPU/Device.cpp index 8be4824957..bc38e37ead 100644 --- a/Userland/Libraries/LibSoftGPU/Device.cpp +++ b/Userland/Libraries/LibSoftGPU/Device.cpp @@ -1316,8 +1316,8 @@ Gfx::IntRect Device::get_rasterization_rect_of_size(Gfx::IntSize size) // "Any fragments whose centers lie inside of this rectangle (or on its bottom or left // boundaries) are produced in correspondence with this particular group of elements." return { - static_cast(roundf(m_raster_position.window_coordinates.x())), - static_cast(roundf(m_raster_position.window_coordinates.y())), + static_cast(lroundf(m_raster_position.window_coordinates.x())), + static_cast(lroundf(m_raster_position.window_coordinates.y())), size.width(), size.height(), };