render: Added SDL_GetTextureRenderer().

This commit is contained in:
Ryan C. Gordon 2024-01-08 10:17:38 -05:00
parent 7eae08cfc4
commit 9bc7cfc755
No known key found for this signature in database
GPG key ID: FA148B892AB48044
5 changed files with 26 additions and 0 deletions

View file

@ -702,6 +702,23 @@ extern DECLSPEC SDL_Texture *SDLCALL SDL_CreateTextureWithProperties(SDL_Rendere
*/ */
extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetTextureProperties(SDL_Texture *texture); extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetTextureProperties(SDL_Texture *texture);
/**
* Get the renderer that created an SDL_Texture.
*
* \param texture the texture to query
* \returns a pointer to the SDL_Renderer that created the texture, or NULL
* on failure; call SDL_GetError() for more information.
*
* \threadsafety It is safe to call this function from any thread.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_CreateTexture
* \sa SDL_CreateTextureFromSurface
* \sa SDL_CreateTextureWithProperties
*/
extern DECLSPEC SDL_Renderer *SDLCALL SDL_GetTextureRenderer(SDL_Texture *texture);
/** /**
* Query the attributes of a texture. * Query the attributes of a texture.
* *

View file

@ -961,6 +961,7 @@ SDL3_0.0.0 {
SDL_wcsnstr; SDL_wcsnstr;
SDL_SyncWindow; SDL_SyncWindow;
SDL_GetGamepadSteamHandle; SDL_GetGamepadSteamHandle;
SDL_GetTextureRenderer;
# extra symbols go here (don't modify this line) # extra symbols go here (don't modify this line)
local: *; local: *;
}; };

View file

@ -986,3 +986,4 @@
#define SDL_wcsnstr SDL_wcsnstr_REAL #define SDL_wcsnstr SDL_wcsnstr_REAL
#define SDL_SyncWindow SDL_SyncWindow_REAL #define SDL_SyncWindow SDL_SyncWindow_REAL
#define SDL_GetGamepadSteamHandle SDL_GetGamepadSteamHandle_REAL #define SDL_GetGamepadSteamHandle SDL_GetGamepadSteamHandle_REAL
#define SDL_GetTextureRenderer SDL_GetTextureRenderer_REAL

View file

@ -1011,3 +1011,4 @@ SDL_DYNAPI_PROC(char*,SDL_strnstr,(const char *a, const char *b, size_t c),(a,b,
SDL_DYNAPI_PROC(wchar_t*,SDL_wcsnstr,(const wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return) SDL_DYNAPI_PROC(wchar_t*,SDL_wcsnstr,(const wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_SyncWindow,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SyncWindow,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(Uint64,SDL_GetGamepadSteamHandle,(SDL_Gamepad *a),(a),return) SDL_DYNAPI_PROC(Uint64,SDL_GetGamepadSteamHandle,(SDL_Gamepad *a),(a),return)
SDL_DYNAPI_PROC(SDL_Renderer*,SDL_GetTextureRenderer,(SDL_Texture *a),(a),return)

View file

@ -1396,6 +1396,12 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
return texture; return texture;
} }
SDL_Renderer *SDL_GetTextureRenderer(SDL_Texture *texture)
{
CHECK_TEXTURE_MAGIC(texture, NULL);
return texture->renderer;
}
SDL_PropertiesID SDL_GetTextureProperties(SDL_Texture *texture) SDL_PropertiesID SDL_GetTextureProperties(SDL_Texture *texture)
{ {
CHECK_TEXTURE_MAGIC(texture, 0); CHECK_TEXTURE_MAGIC(texture, 0);