diff --git a/Userland/Libraries/LibSoftGPU/Device.cpp b/Userland/Libraries/LibSoftGPU/Device.cpp index 59a8855b0c..2f6835492b 100644 --- a/Userland/Libraries/LibSoftGPU/Device.cpp +++ b/Userland/Libraries/LibSoftGPU/Device.cpp @@ -18,6 +18,7 @@ #include #include #include +#include namespace SoftGPU { @@ -1335,9 +1336,12 @@ void Device::set_raster_position(FloatVector4 const& position, FloatMatrix4x4 co Gfx::IntRect Device::get_rasterization_rect_of_size(Gfx::IntSize size) { + // 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(m_raster_position.window_coordinates.x()), - static_cast(m_raster_position.window_coordinates.y()), + static_cast(roundf(m_raster_position.window_coordinates.x())), + static_cast(roundf(m_raster_position.window_coordinates.y())), size.width(), size.height(), };