Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Allow SDL_HINT_FRAMEBUFFER_ACCELERATION to specify the renderer to use.

  • Loading branch information
slouken committed Feb 5, 2011
1 parent d581f8e commit 790c85115d479a348fc6670462006081de3d7326
Showing with 21 additions and 7 deletions.
  1. +21 −7 src/video/SDL_video.c
@@ -203,17 +203,31 @@ SDL_CreateWindowTexture(_THIS, SDL_Window * window, Uint32 * format, void ** pix
if (!renderer) {
SDL_RendererInfo info;
int i;

/* We need to make sure we don't get a software renderer */
for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
SDL_GetRenderDriverInfo(i, &info);
if (SDL_strcmp(info.name, "software") != 0) {
renderer = SDL_CreateRenderer(window, i, 0);
if (renderer) {
const char *hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION);

/* Check to see if there's a specific driver requested */
if (hint && *hint != '0' && *hint != '1' &&
SDL_strcasecmp(hint, "software") != 0) {
for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
SDL_GetRenderDriverInfo(i, &info);
if (SDL_strcasecmp(info.name, hint) == 0) {
renderer = SDL_CreateRenderer(window, i, 0);
break;
}
}
}

if (!renderer) {
for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
SDL_GetRenderDriverInfo(i, &info);
if (SDL_strcmp(info.name, "software") != 0) {
renderer = SDL_CreateRenderer(window, i, 0);
if (renderer) {
break;
}
}
}
}
if (!renderer) {
return -1;
}

0 comments on commit 790c851

Please sign in to comment.