mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-18 18:58:27 +00:00
Save the native texture parent and return that in SDL_GetRenderTarget()
Fixes https://github.com/libsdl-org/SDL/issues/9176
This commit is contained in:
parent
86d36a2dc2
commit
74f4614289
1 changed files with 4 additions and 1 deletions
|
@ -44,6 +44,7 @@ this should probably be removed at some point in the future. --ryan. */
|
|||
#endif
|
||||
|
||||
#define SDL_PROP_WINDOW_RENDERER_POINTER "SDL.internal.window.renderer"
|
||||
#define SDL_PROP_TEXTURE_PARENT_POINTER "SDL.internal.texture.parent"
|
||||
|
||||
#define CHECK_RENDERER_MAGIC(renderer, retval) \
|
||||
if (!(renderer) || (renderer)->magic != &SDL_renderer_magic) { \
|
||||
|
@ -1333,6 +1334,8 @@ SDL_Texture *SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_Propert
|
|||
return NULL;
|
||||
}
|
||||
|
||||
SDL_SetProperty(SDL_GetTextureProperties(texture->native), SDL_PROP_TEXTURE_PARENT_POINTER, texture);
|
||||
|
||||
/* Swap textures to have texture before texture->native in the list */
|
||||
texture->native->next = texture->next;
|
||||
if (texture->native->next) {
|
||||
|
@ -2356,7 +2359,7 @@ SDL_Texture *SDL_GetRenderTarget(SDL_Renderer *renderer)
|
|||
if (renderer->target == renderer->logical_target) {
|
||||
return NULL;
|
||||
} else {
|
||||
return renderer->target;
|
||||
return SDL_GetProperty(SDL_GetTextureProperties(renderer->target), SDL_PROP_TEXTURE_PARENT_POINTER, renderer->target);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue