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
main
Sam Lantinga 2022-08-23 07:42:48 -07:00
parent b6a3d76225
commit 50c5d23f7d
1 changed files with 2 additions and 2 deletions

View File

@ -2981,8 +2981,8 @@ RenderDrawLinesWithRectsF(SDL_Renderer * renderer,
frect->x += scale_x; frect->x += scale_x;
} }
} else { } else {
retval += RenderDrawLineBresenham(renderer, (int)points[i].x, (int)points[i].y, retval += RenderDrawLineBresenham(renderer, (int)SDL_roundf(points[i].x), (int)SDL_roundf(points[i].y),
(int)points[i+1].x, (int)points[i+1].y, draw_last); (int)SDL_roundf(points[i+1].x), (int)SDL_roundf(points[i+1].y), draw_last);
} }
drew_line = SDL_TRUE; drew_line = SDL_TRUE;
} }