It's not the last pixel, it's the rightmost pixel, or if they're both the same x coordinate, the bottommost pixel.
authorSam Lantinga <slouken@libsdl.org>
Sat, 21 Nov 2009 06:19:34 +0000
changeset 3470 419f459f2f38
parent 3469 8c5fb2a3b11d
child 3471 da53c4046c65
It's not the last pixel, it's the rightmost pixel, or if they're both the same x coordinate, the bottommost pixel.
src/video/SDL_renderer_gl.c
--- a/src/video/SDL_renderer_gl.c	Sat Nov 21 06:17:50 2009 +0000
+++ b/src/video/SDL_renderer_gl.c	Sat Nov 21 06:19:34 2009 +0000
@@ -1155,9 +1155,17 @@
     data->glVertex2f(0.5f + x2, 0.5f + y2);
     data->glEnd();
 
-    /* For some reason the second endpoint is skipped */
+    /* For some reason the rightmost or lowest endpoint is skipped */
     data->glBegin(GL_POINTS);
-    data->glVertex2f(0.5f + x2, 0.5f + y2);
+    if (x1 > x2) {
+        data->glVertex2f(0.5f + x1, 0.5f + y1);
+    } else if (x2 > x1) {
+        data->glVertex2f(0.5f + x2, 0.5f + y2);
+    } else if (y1 > y2) {
+        data->glVertex2f(0.5f + x1, 0.5f + y1);
+    } else if (y2 > y1) {
+        data->glVertex2f(0.5f + x2, 0.5f + y2);
+    }
     data->glEnd();
 
     return 0;