SDL: render: Clip bresenham lines against a real viewport thing.

From 42a8139fd662cefd32f851af95cc44f546c5834a Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Sat, 25 Nov 2023 01:51:35 -0500
Subject: [PATCH] render: Clip bresenham lines against a real viewport thing.

You can't just use renderer->view->viewport, because it might be (0,0), -1x-1.

I _think_ this is more right?

Fixes #8609.
---
 src/render/SDL_render.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 847e14d68097..a9cd2105ad26 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -2755,11 +2755,13 @@ static int RenderLineBresenham(SDL_Renderer *renderer, int x1, int y1, int x2, i
     int retval;
     SDL_bool isstack;
     SDL_FPoint *points;
+    SDL_Rect viewport;
 
     /* the backend might clip this further to the clipping rect, but we
        just want a basic safety against generating millions of points for
        massive lines. */
-    if (!SDL_GetRectAndLineIntersection(&renderer->view->viewport, &x1, &y1, &x2, &y2)) {
+    GetRenderViewportInPixels(renderer, &viewport);
+    if (!SDL_GetRectAndLineIntersection(&viewport, &x1, &y1, &x2, &y2)) {
         return 0;
     }