mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-29 04:47:24 +02:00
Simplified SDL_SetProperty() and added SDL_SetPropertyWithCleanup()
Most of the time people won't need to set a cleanup callback, so we can simplify the more commonly used API.
This commit is contained in:
@@ -280,7 +280,7 @@ static int SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, U
|
||||
SDL_DestroyRenderer(renderer);
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
SDL_SetProperty(props, SDL_WINDOWTEXTUREDATA, data, SDL_CleanupWindowTextureData, NULL);
|
||||
SDL_SetPropertyWithCleanup(props, SDL_WINDOWTEXTUREDATA, data, SDL_CleanupWindowTextureData, NULL);
|
||||
|
||||
data->renderer = renderer;
|
||||
} else {
|
||||
|
||||
@@ -48,7 +48,7 @@ int SDL_DUMMY_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window
|
||||
}
|
||||
|
||||
/* Save the info and return! */
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), DUMMY_SURFACE, surface, CleanupSurface, NULL);
|
||||
SDL_SetPropertyWithCleanup(SDL_GetWindowProperties(window), DUMMY_SURFACE, surface, CleanupSurface, NULL);
|
||||
*format = surface_format;
|
||||
*pixels = surface->pixels;
|
||||
*pitch = surface->pitch;
|
||||
|
||||
@@ -57,7 +57,7 @@ int SDL_N3DS_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window,
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), N3DS_SURFACE, framebuffer, CleanupSurface, NULL);
|
||||
SDL_SetPropertyWithCleanup(SDL_GetWindowProperties(window), N3DS_SURFACE, framebuffer, CleanupSurface, NULL);
|
||||
*format = FRAMEBUFFER_FORMAT;
|
||||
*pixels = framebuffer->pixels;
|
||||
*pitch = framebuffer->pitch;
|
||||
|
||||
@@ -48,7 +48,7 @@ int SDL_OFFSCREEN_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *wi
|
||||
}
|
||||
|
||||
/* Save the info and return! */
|
||||
SDL_SetProperty(SDL_GetWindowProperties(window), OFFSCREEN_SURFACE, surface, CleanupSurface, NULL);
|
||||
SDL_SetPropertyWithCleanup(SDL_GetWindowProperties(window), OFFSCREEN_SURFACE, surface, CleanupSurface, NULL);
|
||||
*format = surface_format;
|
||||
*pixels = surface->pixels;
|
||||
*pitch = surface->pitch;
|
||||
|
||||
Reference in New Issue
Block a user