From d866637074e5879b690338bc8e22c7778d85c5f1 Mon Sep 17 00:00:00 2001 From: Hendiadyoin1 Date: Fri, 15 Apr 2022 19:49:24 +0200 Subject: [PATCH] LibSoftGPU: Use round_to in Device::get_rasterization_rect_of_size --- Userland/Libraries/LibSoftGPU/Device.cpp | 6 +++--- Userland/Libraries/LibSoftGPU/Device.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibSoftGPU/Device.cpp b/Userland/Libraries/LibSoftGPU/Device.cpp index 45d90a61a1..90ffcc8a84 100644 --- a/Userland/Libraries/LibSoftGPU/Device.cpp +++ b/Userland/Libraries/LibSoftGPU/Device.cpp @@ -1299,14 +1299,14 @@ void Device::set_raster_position(FloatVector4 const& position, FloatMatrix4x4 co m_raster_position.eye_coordinate_distance = eye_coordinates.length(); } -Gfx::IntRect Device::get_rasterization_rect_of_size(Gfx::IntSize size) +Gfx::IntRect Device::get_rasterization_rect_of_size(Gfx::IntSize size) const { // Round the X and Y floating point coordinates to the nearest integer; OpenGL 1.5 spec: // "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(lroundf(m_raster_position.window_coordinates.x())), - static_cast(lroundf(m_raster_position.window_coordinates.y())), + round_to(m_raster_position.window_coordinates.x()), + round_to(m_raster_position.window_coordinates.y()), size.width(), size.height(), }; diff --git a/Userland/Libraries/LibSoftGPU/Device.h b/Userland/Libraries/LibSoftGPU/Device.h index e1b438deab..4e82e958e4 100644 --- a/Userland/Libraries/LibSoftGPU/Device.h +++ b/Userland/Libraries/LibSoftGPU/Device.h @@ -75,7 +75,7 @@ public: private: void draw_statistics_overlay(Gfx::Bitmap&); - Gfx::IntRect get_rasterization_rect_of_size(Gfx::IntSize size); + Gfx::IntRect get_rasterization_rect_of_size(Gfx::IntSize size) const; void rasterize_triangle(Triangle const&); void setup_blend_factors();