mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-25 09:17:12 +01:00
Add an "error" label in SDL_CreateRenderer (no op)
This commit is contained in:
parent
aa45af7fcb
commit
cfed0b7738
@ -839,12 +839,12 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags)
|
|||||||
|
|
||||||
if (!window) {
|
if (!window) {
|
||||||
SDL_SetError("Invalid window");
|
SDL_SetError("Invalid window");
|
||||||
return NULL;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_GetRenderer(window)) {
|
if (SDL_GetRenderer(window)) {
|
||||||
SDL_SetError("Renderer already associated with window");
|
SDL_SetError("Renderer already associated with window");
|
||||||
return NULL;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_GetHint(SDL_HINT_RENDER_VSYNC)) {
|
if (SDL_GetHint(SDL_HINT_RENDER_VSYNC)) {
|
||||||
@ -888,20 +888,23 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags)
|
|||||||
}
|
}
|
||||||
if (index == n) {
|
if (index == n) {
|
||||||
SDL_SetError("Couldn't find matching render driver");
|
SDL_SetError("Couldn't find matching render driver");
|
||||||
return NULL;
|
goto error;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (index >= SDL_GetNumRenderDrivers()) {
|
if (index >= SDL_GetNumRenderDrivers()) {
|
||||||
SDL_SetError("index must be -1 or in the range of 0 - %d",
|
SDL_SetError("index must be -1 or in the range of 0 - %d",
|
||||||
SDL_GetNumRenderDrivers() - 1);
|
SDL_GetNumRenderDrivers() - 1);
|
||||||
return NULL;
|
goto error;
|
||||||
}
|
}
|
||||||
/* Create a new renderer instance */
|
/* Create a new renderer instance */
|
||||||
renderer = render_drivers[index]->CreateRenderer(window, flags);
|
renderer = render_drivers[index]->CreateRenderer(window, flags);
|
||||||
batching = SDL_FALSE;
|
batching = SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (renderer) {
|
if (!renderer) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
VerifyDrawQueueFunctions(renderer);
|
VerifyDrawQueueFunctions(renderer);
|
||||||
|
|
||||||
/* let app/user override batching decisions. */
|
/* let app/user override batching decisions. */
|
||||||
@ -947,8 +950,12 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags)
|
|||||||
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_RENDER,
|
SDL_LogInfo(SDL_LOG_CATEGORY_RENDER,
|
||||||
"Created renderer: %s", renderer->info.name);
|
"Created renderer: %s", renderer->info.name);
|
||||||
}
|
|
||||||
return renderer;
|
return renderer;
|
||||||
|
|
||||||
|
error:
|
||||||
|
return NULL;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
SDL_SetError("SDL not built with rendering support");
|
SDL_SetError("SDL not built with rendering support");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user