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 - SDL_RenderCopyEx rotation center not well-defined (please support float)
Summary: SDL_RenderCopyEx rotation center not well-defined (please support float)
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.1
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-15 21:26 UTC by xyzdragon
Modified: 2017-08-11 20:21 UTC (History)
1 user (show)

See Also:


Attachments
A simple test to determine how the rotation center is interpreted (2.59 KB, text/x-c++src)
2016-11-15 21:26 UTC, xyzdragon
Details
Rendering of the test on my system (8.60 KB, image/png)
2016-11-15 21:27 UTC, xyzdragon
Details

Note You need to log in before you can comment on or make changes to this bug.
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