mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-08-28 17:41:38 +00:00
Fixed rendering diagonal lines within a viewport
The drawing uses the origin of the viewport as the coordinate origin, so we only need to clip against the size of the viewport. Also added a unit test to catch this case in the future
This commit is contained in:
@@ -2776,6 +2776,8 @@ static int RenderLineBresenham(SDL_Renderer *renderer, int x1, int y1, int x2, i
|
||||
just want a basic safety against generating millions of points for
|
||||
massive lines. */
|
||||
GetRenderViewportInPixels(renderer, &viewport);
|
||||
viewport.x = 0;
|
||||
viewport.y = 0;
|
||||
if (!SDL_GetRectAndLineIntersection(&viewport, &x1, &y1, &x2, &y2)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user