mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-15 01:08:26 +00:00
render: Restore previous policy for converting window/render coordinates.
Before this commit, it would adjust for the logical presentation settings. Now, it works as it did before the logical presentation render target was removed: it takes current viewport and scale into account, as well. Fixes #10978.
This commit is contained in:
parent
3246df8bd3
commit
191f3ecbbc
2 changed files with 32 additions and 0 deletions
|
@ -1441,6 +1441,13 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderLogicalPresentationRect(SDL_Render
|
|||
/**
|
||||
* Get a point in render coordinates when given a point in window coordinates.
|
||||
*
|
||||
* This takes into account several states:
|
||||
*
|
||||
* - The window dimensions.
|
||||
* - The logical presentation settings (SDL_SetRenderLogicalPresentation)
|
||||
* - The scale (SDL_SetRenderScale)
|
||||
* - The viewport (SDL_SetRenderViewport)
|
||||
*
|
||||
* \param renderer the rendering context.
|
||||
* \param window_x the x coordinate in window coordinates.
|
||||
* \param window_y the y coordinate in window coordinates.
|
||||
|
@ -1461,6 +1468,13 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Renderer *r
|
|||
/**
|
||||
* Get a point in window coordinates when given a point in render coordinates.
|
||||
*
|
||||
* This takes into account several states:
|
||||
*
|
||||
* - The window dimensions.
|
||||
* - The logical presentation settings (SDL_SetRenderLogicalPresentation)
|
||||
* - The scale (SDL_SetRenderScale)
|
||||
* - The viewport (SDL_SetRenderViewport)
|
||||
*
|
||||
* \param renderer the rendering context.
|
||||
* \param x the x coordinate in render coordinates.
|
||||
* \param y the y coordinate in render coordinates.
|
||||
|
@ -1477,12 +1491,20 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Renderer *r
|
|||
*
|
||||
* \sa SDL_SetRenderLogicalPresentation
|
||||
* \sa SDL_SetRenderScale
|
||||
* \sa SDL_SetRenderViewport
|
||||
*/
|
||||
extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y);
|
||||
|
||||
/**
|
||||
* Convert the coordinates in an event to render coordinates.
|
||||
*
|
||||
* This takes into account several states:
|
||||
*
|
||||
* - The window dimensions.
|
||||
* - The logical presentation settings (SDL_SetRenderLogicalPresentation)
|
||||
* - The scale (SDL_SetRenderScale)
|
||||
* - The viewport (SDL_SetRenderViewport)
|
||||
*
|
||||
* Touch coordinates are converted from normalized coordinates in the window
|
||||
* to non-normalized rendering coordinates.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue