diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index 6953447bad..49350d2e63 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -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.