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 3493

Summary: SDL_RenderCopyEx rotation center not well-defined (please support float)
Product: SDL Reporter: xyzdragon
Component: videoAssignee: Sam Lantinga <slouken>
Status: ASSIGNED --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: xyzdragon
Version: 2.0.1   
Hardware: x86_64   
OS: Linux   
Attachments: A simple test to determine how the rotation center is interpreted
Rendering of the test on my system

Description xyzdragon 2016-11-15 21:26:29 UTC
Created attachment 2631 [details]
A simple test to determine how the rotation center is interpreted

I find the rotation center very ambiguous, because it only accepts integer coordinates. But what do they mean? top left corner of a pixel cell, or the center of a pixel cell?

The latter makes more sense when talking about integer coordinates, but the top left corners makes more sense in a float context.

Therefore it seems to me, that the backend used by SDL actually allows float coordinates, but SDL artificially restricts this to integer.

This leads to unexpected behavior. E.g. rotating a 1x1 texture around itself (rotation center = NULL, i.e. same as texture coordinates) and rendering that 1px texture with 0,90,180,270 degrees rotation will lead to 4 pixels being drawn, because the pixel is not rotated around it's center, but it's top left corner.

See attachment for a simple test.

The tests only behave as expected for textures with even width and height.
Comment 1 xyzdragon 2016-11-15 21:27:38 UTC
Created attachment 2632 [details]
Rendering of the test on my system