Use floating point values for viewport, clip rectangle, and texture sizes

These are integer values internally, but the API has been changed to make it easier to mix other render code with querying those values.

Fixes https://github.com/libsdl-org/SDL/issues/7519
This commit is contained in:
Sam Lantinga
2024-06-12 09:21:02 -07:00
parent 463984ec20
commit 9fb5a9ccac
29 changed files with 624 additions and 585 deletions

View File

@@ -1153,7 +1153,9 @@ SDL_CreateRenderer()'s flags parameter has been removed. See specific flags belo
SDL_CreateWindowAndRenderer() now takes the window title as the first parameter.
SDL_GetRendererInfo() has been removed, the name of a renderer can be retrieved using SDL_GetRendererName(), and the other information is available as properties on the renderer.
SDL_GetRendererInfo() has been removed. The name of a renderer can be retrieved using SDL_GetRendererName(), and the other information is available as properties on the renderer.
SDL_QueryTexture() has been removed. The properties of the texture can be queried using SDL_PROP_TEXTURE_FORMAT_NUMBER, SDL_PROP_TEXTURE_ACCESS_NUMBER, SDL_PROP_TEXTURE_WIDTH_NUMBER, and SDL_PROP_TEXTURE_HEIGHT_NUMBER. A function SDL_GetTextureSize() has been added to get the size of the texture as floating point values.
Mouse and touch events are no longer filtered to change their coordinates, instead you
can call SDL_ConvertEventToRenderCoordinates() to explicitly map event coordinates into
@@ -1163,6 +1165,15 @@ SDL_RenderWindowToLogical() and SDL_RenderLogicalToWindow() have been renamed SD
The viewport, clipping state, and scale for render targets are now persistent and will remain set whenever they are active.
The following functions have been changed to take floating point values to make them easier to use with the rest of the rendering API:
* SDL_GetCurrentRenderOutputSize()
* SDL_GetRenderClipRect()
* SDL_GetRenderLogicalPresentation()
* SDL_GetRenderOutputSize()
* SDL_GetRenderViewport()
* SDL_SetRenderLogicalPresentation()
* SDL_SetRenderViewport()
SDL_Vertex has been changed to use floating point colors, in the range of [0..1] for SDR content.
SDL_RenderReadPixels() returns a surface instead of filling in preallocated memory.