We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4958 - SDL_RenderDrawLine draws last point at 0,0
Summary: SDL_RenderDrawLine draws last point at 0,0
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: 2.0.10
Hardware: x86 Windows 10
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.12
Depends on:
Blocks:
 
Reported: 2020-01-24 10:47 UTC by Richard Russell
Modified: 2020-01-25 20:05 UTC (History)
0 users

See Also:


Attachments
Shows incorrect behavior in SDL 2.0.10 (Windows) (8.55 KB, image/png)
2020-01-24 10:47 UTC, Richard Russell
Details
Shows incorect behavior in SDL 2.0.10 (MacOS) (8.47 KB, image/png)
2020-01-24 10:48 UTC, Richard Russell
Details
Shows correct behavior in SDL 2.0.9 (Windows) (8.51 KB, image/png)
2020-01-24 10:49 UTC, Richard Russell
Details
Beginning and end points swapped (2.0.10) (8.56 KB, image/png)
2020-01-24 17:26 UTC, Richard Russell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Russell 2020-01-24 10:47:31 UTC
Created attachment 4173 [details]
Shows incorrect behavior in SDL 2.0.10 (Windows)

SDL_RenderDrawLine draws the final point at coordinates (0,0) rather than in the correct place.  Superficially it appears that the line is shorter than it should be (the docs state "SDL_RenderDrawLine() draws the line to include both end points") but in fact the last pixel is drawn, just in the wrong place!

This is a regression in SDL 2.0.10, so I don't think it is a duplicate of any of the other SDL_RenderDrawLine bugs.  I have attached images showing what happens, enlarged for clarity, in 2.0.9 and 2.0.10 on Windows and in 2.0.10 on MacOS.
Comment 1 Richard Russell 2020-01-24 10:48:50 UTC
Created attachment 4174 [details]
Shows incorect behavior in SDL 2.0.10 (MacOS)
Comment 2 Richard Russell 2020-01-24 10:49:55 UTC
Created attachment 4175 [details]
Shows correct behavior in SDL 2.0.9 (Windows)
Comment 3 Richard Russell 2020-01-24 17:26:14 UTC
Created attachment 4176 [details]
Beginning and end points swapped (2.0.10)

This is what happens if you swap the beginning and end of the line, confirming that it's the last point (here 3,3) that gets plotted incorrectly at 0,0.
Comment 4 Sam Lantinga 2020-01-25 02:50:24 UTC
Ryan, can you look at this? This code seems suspicious...
data->glVertex2f(verts[(count-1)*2], verts[(count*2)-1]);
Comment 5 Richard Russell 2020-01-25 10:14:26 UTC
(In reply to Sam Lantinga from comment #4)
> This code seems suspicious...
> data->glVertex2f(verts[(count-1)*2], verts[(count*2)-1]);

Sorry to interject, but it could be right when you consider it's equivalent to:

 data->glVertex2f(verts[(count*2)-2], verts[(count*2)-1]);
Comment 6 Richard Russell 2020-01-25 15:34:35 UTC
Somebody kindly sent me a DLL of SDL 2.0.11 to try (see the related thread at the forum) and the issue seems to be fixed there.  So although a search of Bugzilla didn't find any reference to this specific bug, it seems that it has been addressed.
Comment 7 Sam Lantinga 2020-01-25 20:05:15 UTC
Okay, thanks for letting us know!