mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-05 22:30:29 +00:00
surface: patched to compile.
This commit is contained in:
parent
2f6c37ce13
commit
9ba2af2d34
1 changed files with 12 additions and 12 deletions
|
|
@ -51,22 +51,22 @@ static bool SDL_create_surface_malloc_hint = false; // tracks "SDL_SURFACE_MALL
|
|||
|
||||
static void SDLCALL SDL_CreateSurfaceZeroedChanged(void *userdata, const char *name, const char *oldValue, const char *newValue)
|
||||
{
|
||||
create_surface_zeroed_hint = SDL_GetStringBoolean(newValue, true);
|
||||
SDL_create_surface_zeroed_hint = SDL_GetStringBoolean(newValue, true);
|
||||
}
|
||||
|
||||
static void SDLCALL SDL_SurfaceMallocChanged(void *userdata, const char *name, const char *oldValue, const char *newValue)
|
||||
{
|
||||
create_surface_malloc_hint = SDL_GetStringBoolean(newValue, false);
|
||||
SDL_create_surface_malloc_hint = SDL_GetStringBoolean(newValue, false);
|
||||
}
|
||||
|
||||
// Public routines
|
||||
|
||||
void SDL_QuitSurfaceHints(void)
|
||||
{
|
||||
if (SDL_ShouldQuit(&create_surface_hints_init)) {
|
||||
SDL_RemoveHintCallback(SDL_HINT_CREATE_SURFACE_ZEROED, SDL_SurfaceClearHintWatcher, NULL);
|
||||
SDL_RemoveHintCallback("SDL_SURFACE_MALLOC", SDL_SurfaceMallocHintWatcher, NULL);
|
||||
SDL_SetInitialized(&create_surface_hints_init, false);
|
||||
if (SDL_ShouldQuit(&SDL_create_surface_hints_init)) {
|
||||
SDL_RemoveHintCallback(SDL_HINT_CREATE_SURFACE_ZEROED, SDL_CreateSurfaceZeroedChanged, NULL);
|
||||
SDL_RemoveHintCallback("SDL_SURFACE_MALLOC", SDL_SurfaceMallocChanged, NULL);
|
||||
SDL_SetInitialized(&SDL_create_surface_hints_init, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -255,15 +255,15 @@ SDL_Surface *SDL_CreateSurface(int width, int height, SDL_PixelFormat format)
|
|||
}
|
||||
|
||||
if (surface->w && surface->h && format != SDL_PIXELFORMAT_MJPG) {
|
||||
if (SDL_ShouldInit(&create_surface_hints_init)) {
|
||||
SDL_AddHintCallback(SDL_HINT_CREATE_SURFACE_ZEROED, SDL_SurfaceClearHintWatcher, NULL);
|
||||
SDL_AddHintCallback("SDL_SURFACE_MALLOC", SDL_SurfaceMallocHintWatcher, NULL);
|
||||
SDL_SetInitialized(&create_surface_hints_init, true);
|
||||
if (SDL_ShouldInit(&SDL_create_surface_hints_init)) {
|
||||
SDL_AddHintCallback(SDL_HINT_CREATE_SURFACE_ZEROED, SDL_CreateSurfaceZeroedChanged, NULL);
|
||||
SDL_AddHintCallback("SDL_SURFACE_MALLOC", SDL_SurfaceMallocChanged, NULL);
|
||||
SDL_SetInitialized(&SDL_create_surface_hints_init, true);
|
||||
}
|
||||
|
||||
bool clear_surface = create_surface_zeroed_hint; // SDL_HINT_CREATE_SURFACE_ZEROED, tracked by callback.
|
||||
bool clear_surface = SDL_create_surface_zeroed_hint; // SDL_HINT_CREATE_SURFACE_ZEROED, tracked by callback.
|
||||
surface->flags &= ~SDL_SURFACE_PREALLOCATED;
|
||||
if (create_surface_malloc_hint) { // "SDL_SURFACE_MALLOC" hint, tracked by callback.
|
||||
if (SDL_create_surface_malloc_hint) { // "SDL_SURFACE_MALLOC" hint, tracked by callback.
|
||||
if (clear_surface) {
|
||||
surface->pixels = SDL_calloc(1, size);
|
||||
clear_surface = false; // SDL_calloc already did it, don't memset again, below.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue