comparison src/video/SDL_video.c @ 5194:93052810ceb5

Allow SDL_HINT_FRAMEBUFFER_ACCELERATION to specify the renderer to use.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 05 Feb 2011 10:11:27 -0800
parents 82a48f4d65f6
children ef5a61ea3202
comparison
equal deleted inserted replaced
5193:82a48f4d65f6 5194:93052810ceb5
201 201
202 renderer = data->renderer; 202 renderer = data->renderer;
203 if (!renderer) { 203 if (!renderer) {
204 SDL_RendererInfo info; 204 SDL_RendererInfo info;
205 int i; 205 int i;
206 206 const char *hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION);
207 /* We need to make sure we don't get a software renderer */ 207
208 for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) { 208 /* Check to see if there's a specific driver requested */
209 SDL_GetRenderDriverInfo(i, &info); 209 if (hint && *hint != '0' && *hint != '1' &&
210 if (SDL_strcmp(info.name, "software") != 0) { 210 SDL_strcasecmp(hint, "software") != 0) {
211 renderer = SDL_CreateRenderer(window, i, 0); 211 for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
212 if (renderer) { 212 SDL_GetRenderDriverInfo(i, &info);
213 if (SDL_strcasecmp(info.name, hint) == 0) {
214 renderer = SDL_CreateRenderer(window, i, 0);
213 break; 215 break;
216 }
217 }
218 }
219
220 if (!renderer) {
221 for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) {
222 SDL_GetRenderDriverInfo(i, &info);
223 if (SDL_strcmp(info.name, "software") != 0) {
224 renderer = SDL_CreateRenderer(window, i, 0);
225 if (renderer) {
226 break;
227 }
214 } 228 }
215 } 229 }
216 } 230 }
217 if (!renderer) { 231 if (!renderer) {
218 return -1; 232 return -1;