mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-06-01 17:37:39 +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:
parent
8d9c7d8ebe
commit
6a00ae7e58
2 changed files with 50 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue