Skip to content

SDL_FRect for renderer clip rectangle #14654

Description

@danpla

Since all SDL_Render drawing functions use floating-point coordinates, it's possible to position graphics at sup-pixel precision even if you're using a large scale. For example, if I set SDL_SetRenderScale(100, 100) for 100 px window, there will be only one virtual pixel, but thanks to floating-point coordinates I can still position graphics at any physical pixel of the window.

The problem here is that SDL_SetRenderClipRect still uses the integer SDL_Rect and is therefore always snapped to virtual pixels. In the 100-px window example above, it's impossible to put the clip rectangle on the same position as the drawn graphics because its coordinates will always be either at 0th or 100th physical pixel due to the 100x scale. The integer clip rectangle is pretty useless when drawing at sub-pixel positions.

Is it possible to add an SDL_SetRenderClipRect variant that accepts an SDL_FRect?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions