Mercurial > sdl-ios-xcode
comparison src/video/SDL_video.c @ 1969:5d3724f64f2b
Clarified the difference between render drivers and render contexts
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 06 Aug 2006 00:09:04 +0000 |
parents | 01e29c3e9a29 |
children | db3ba6c0d0df |
comparison
equal
deleted
inserted
replaced
1968:9f589a1f74a5 | 1969:5d3724f64f2b |
---|---|
1360 display->num_render_drivers++; | 1360 display->num_render_drivers++; |
1361 } | 1361 } |
1362 } | 1362 } |
1363 | 1363 |
1364 int | 1364 int |
1365 SDL_GetNumRenderers(void) | 1365 SDL_GetNumRenderDrivers(void) |
1366 { | 1366 { |
1367 if (_this) { | 1367 if (_this) { |
1368 return SDL_CurrentDisplay.num_render_drivers; | 1368 return SDL_CurrentDisplay.num_render_drivers; |
1369 } | 1369 } |
1370 return 0; | 1370 return 0; |
1371 } | 1371 } |
1372 | 1372 |
1373 int | 1373 int |
1374 SDL_GetRendererInfo(int index, SDL_RendererInfo * info) | 1374 SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info) |
1375 { | 1375 { |
1376 if (!_this) { | 1376 if (!_this) { |
1377 SDL_UninitializedVideo(); | 1377 SDL_UninitializedVideo(); |
1378 return -1; | 1378 return -1; |
1379 } | 1379 } |
1380 | 1380 |
1381 if (index >= SDL_GetNumRenderers()) { | 1381 if (index < 0 || index >= SDL_GetNumRenderDrivers()) { |
1382 SDL_SetError("index must be in the range of 0 - %d", | 1382 SDL_SetError("index must be in the range of 0 - %d", |
1383 SDL_GetNumRenderers() - 1); | 1383 SDL_GetNumRenderDrivers() - 1); |
1384 return -1; | 1384 return -1; |
1385 } | 1385 } |
1386 if (index < 0) { | 1386 *info = SDL_CurrentDisplay.render_drivers[index].info; |
1387 if (!SDL_CurrentDisplay.current_renderer) { | |
1388 SDL_SetError("There is no current renderer"); | |
1389 return -1; | |
1390 } | |
1391 *info = SDL_CurrentDisplay.current_renderer->info; | |
1392 } else { | |
1393 *info = SDL_CurrentDisplay.render_drivers[index].info; | |
1394 } | |
1395 return 0; | 1387 return 0; |
1396 } | 1388 } |
1397 | 1389 |
1398 int | 1390 int |
1399 SDL_CreateRenderer(SDL_WindowID windowID, int index, Uint32 flags) | 1391 SDL_CreateRenderer(SDL_WindowID windowID, int index, Uint32 flags) |
1404 return 0; | 1396 return 0; |
1405 } | 1397 } |
1406 | 1398 |
1407 if (index < 0) { | 1399 if (index < 0) { |
1408 const char *override = SDL_getenv("SDL_VIDEO_RENDERER"); | 1400 const char *override = SDL_getenv("SDL_VIDEO_RENDERER"); |
1409 int n = SDL_GetNumRenderers(); | 1401 int n = SDL_GetNumRenderDrivers(); |
1410 for (index = 0; index < n; ++index) { | 1402 for (index = 0; index < n; ++index) { |
1411 SDL_RenderDriver *driver = | 1403 SDL_RenderDriver *driver = |
1412 &SDL_CurrentDisplay.render_drivers[index]; | 1404 &SDL_CurrentDisplay.render_drivers[index]; |
1413 | 1405 |
1414 if (override) { | 1406 if (override) { |
1425 SDL_SetError("Couldn't find matching render driver"); | 1417 SDL_SetError("Couldn't find matching render driver"); |
1426 return -1; | 1418 return -1; |
1427 } | 1419 } |
1428 } | 1420 } |
1429 | 1421 |
1430 if (index >= SDL_GetNumRenderers()) { | 1422 if (index >= SDL_GetNumRenderDrivers()) { |
1431 SDL_SetError("index must be -1 or in the range of 0 - %d", | 1423 SDL_SetError("index must be -1 or in the range of 0 - %d", |
1432 SDL_GetNumRenderers() - 1); | 1424 SDL_GetNumRenderDrivers() - 1); |
1433 return -1; | 1425 return -1; |
1434 } | 1426 } |
1435 | 1427 |
1436 /* Free any existing renderer */ | 1428 /* Free any existing renderer */ |
1437 SDL_DestroyRenderer(windowID); | 1429 SDL_DestroyRenderer(windowID); |
1459 if (renderer->ActivateRenderer(renderer) < 0) { | 1451 if (renderer->ActivateRenderer(renderer) < 0) { |
1460 return -1; | 1452 return -1; |
1461 } | 1453 } |
1462 } | 1454 } |
1463 SDL_CurrentDisplay.current_renderer = renderer; | 1455 SDL_CurrentDisplay.current_renderer = renderer; |
1456 return 0; | |
1457 } | |
1458 | |
1459 int | |
1460 SDL_GetRendererInfo(SDL_RendererInfo * info) | |
1461 { | |
1462 if (!_this) { | |
1463 SDL_UninitializedVideo(); | |
1464 return -1; | |
1465 } | |
1466 | |
1467 if (!SDL_CurrentDisplay.current_renderer) { | |
1468 SDL_SetError("There is no current renderer"); | |
1469 return -1; | |
1470 } | |
1471 *info = SDL_CurrentDisplay.current_renderer->info; | |
1464 return 0; | 1472 return 0; |
1465 } | 1473 } |
1466 | 1474 |
1467 SDL_TextureID | 1475 SDL_TextureID |
1468 SDL_CreateTexture(Uint32 format, int access, int w, int h) | 1476 SDL_CreateTexture(Uint32 format, int access, int w, int h) |