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 2483

Summary: SDL_RenderDrawLine: Non-axis-aligned lines are not scaled
Product: SDL Reporter: graspee
Component: renderAssignee: Sam Lantinga <slouken>
Status: RESOLVED WONTFIX QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: graspee
Version: 2.0.3   
Hardware: x86   
OS: Windows 7   

Description graspee 2014-04-08 05:32:22 UTC
Create a scaled window, e.g. here I'm creating a logical window of 640x400 but then opening a physical window that is twice that size.
/////////////////////////////////////////////////////////////
window = SDL_CreateWindow("name",
 SDL_WINDOWPOS_UNDEFINED,
 SDL_WINDOWPOS_UNDEFINED,
 640*2, 400*2,
 0);
	
renderer = SDL_CreateRenderer(window, -1,0);
	
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
SDL_RenderSetLogicalSize(renderer, 640, 400);
/////////////////////////////////////////////////////////////


Now, using SDL_RenderDrawLine to draw axis-aligned lines, (i.e. perfectly horizontal or vertical ones), the lines will be 2 pixels thick as expected. Drawing non-axis-aligned lines however, the lines will be only 1 pixel thick which is not the expected behaviour, and I would be so bold as to say is a bug.
Comment 1 graspee 2014-04-08 05:44:50 UTC
If you draw the screen at 3x the logical screen size then the axis-aligned lines vary between 3 pixels thick (expected) and 2 pixels thick (bug), while the non-aligned lines are still 1 pixel (bug).

I'm getting vague memories of this being somehow related to a bug in opengl though and it being mentioned somewhere before where someone said not to bother drawing lines in opengl because it had problems (this was outside of sdl I think).
Comment 2 graspee 2014-04-08 19:26:59 UTC
This bug is happening in directx mode. Despite using environmental variable and sdl hints I am unable to get my application to use opengl or software renderer to test them.
Comment 3 Sam Lantinga 2014-04-18 05:04:59 UTC
This is a general limitation of the way logical size was implemented. We're considering moving to a render target implementation that would take care of this, but it's still under discussion.

If this behavior is a problem for your application, the recommended solution is to render to a render target, and then copy the render target to the screen before the present.