From 50c5d23f7d1b5b15e5ecc3dce72fa6a35b68f960 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 23 Aug 2022 07:42:48 -0700 Subject: [PATCH] Round coordinates so very small floating point values don't turn into 0x80000000 e.g. SDL_RenderDrawLineF(renderer, -1e20, -1e20, 10, 10); Fixes https://github.com/libsdl-org/SDL/issues/6116 --- src/render/SDL_render.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index 58931012a..42cafee93 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -2981,8 +2981,8 @@ RenderDrawLinesWithRectsF(SDL_Renderer * renderer, frect->x += scale_x; } } else { - retval += RenderDrawLineBresenham(renderer, (int)points[i].x, (int)points[i].y, - (int)points[i+1].x, (int)points[i+1].y, draw_last); + retval += RenderDrawLineBresenham(renderer, (int)SDL_roundf(points[i].x), (int)SDL_roundf(points[i].y), + (int)SDL_roundf(points[i+1].x), (int)SDL_roundf(points[i+1].y), draw_last); } drew_line = SDL_TRUE; }