mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-31 14:29:14 +08:00
offscreen: Don't ever use this backend unless explicitly requested.
Reference PR #10202.
This commit is contained in:
@@ -51,14 +51,29 @@ static void OFFSCREEN_DeleteDevice(SDL_VideoDevice *device)
|
|||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static SDL_bool OFFSCREEN_Available(const char *enable_hint)
|
||||||
|
{
|
||||||
|
const char *hint = SDL_GetHint(SDL_HINT_VIDEO_DRIVER);
|
||||||
|
if (hint) {
|
||||||
|
if (SDL_strcmp(hint, enable_hint) == 0) {
|
||||||
|
return SDL_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return SDL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static SDL_VideoDevice *OFFSCREEN_CreateDevice(void)
|
static SDL_VideoDevice *OFFSCREEN_CreateDevice(void)
|
||||||
{
|
{
|
||||||
SDL_VideoDevice *device;
|
SDL_VideoDevice *device;
|
||||||
|
|
||||||
|
if (!OFFSCREEN_Available(OFFSCREENVID_DRIVER_NAME)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize all variables that we clean on shutdown */
|
/* Initialize all variables that we clean on shutdown */
|
||||||
device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice));
|
device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice));
|
||||||
if (!device) {
|
if (!device) {
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* General video */
|
/* General video */
|
||||||
|
|||||||
Reference in New Issue
Block a user