From b99543b68212f7509bf71b5586cf79103829d1dc Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 11 Jan 2021 20:40:11 -0500 Subject: [PATCH] opengl: More work on making line drawing match software renderer. --- src/render/opengl/SDL_render_gl.c | 4 ++-- src/render/opengles/SDL_render_gles.c | 4 ++-- src/render/opengles2/SDL_render_gles2.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index eb9d7900d..514ca27e5 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -914,9 +914,9 @@ GL_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_FPo const GLfloat yend = verts[3]; if (ystart == yend) { /* horizontal line */ - verts[2] += (xend > xstart) ? 1.0f : -1.0f; + verts[(xend > xstart) ? 2 : 0] += 1.0f; } else if (xstart == xend) { /* vertical line */ - verts[3] += (yend > ystart) ? 1.0f : -1.0f; + verts[(yend > ystart) ? 3 : 1] += 1.0f; } else { /* bump a pixel in the direction we are moving in. */ const GLfloat deltax = xend - xstart; const GLfloat deltay = yend - ystart; diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c index e6350f0cc..49878c869 100644 --- a/src/render/opengles/SDL_render_gles.c +++ b/src/render/opengles/SDL_render_gles.c @@ -587,9 +587,9 @@ GLES_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_F const GLfloat yend = verts[3]; if (ystart == yend) { /* horizontal line */ - verts[2] += (xend > xstart) ? 1.0f : -1.0f; + verts[(xend > xstart) ? 2 : 0] += 1.0f; } else if (xstart == xend) { /* vertical line */ - verts[3] += (yend > ystart) ? 1.0f : -1.0f; + verts[(yend > ystart) ? 3 : 1] += 1.0f; } else { /* bump a pixel in the direction we are moving in. */ const GLfloat deltax = xend - xstart; const GLfloat deltay = yend - ystart; diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index f0801ab59..20743fe01 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -811,9 +811,9 @@ GLES2_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand *cmd, const SDL_ const GLfloat yend = verts[3]; if (ystart == yend) { /* horizontal line */ - verts[2] += (xend > xstart) ? 1.0f : -1.0f; + verts[(xend > xstart) ? 2 : 0] += 1.0f; } else if (xstart == xend) { /* vertical line */ - verts[3] += (yend > ystart) ? 1.0f : -1.0f; + verts[(yend > ystart) ? 3 : 1] += 1.0f; } else { /* bump a pixel in the direction we are moving in. */ const GLfloat deltax = xend - xstart; const GLfloat deltay = yend - ystart;