comparison src/video/SDL_video.c @ 3318:f085091f74cd

Fixed bug #766 Mason Wheeler 2009-07-06 14:29:47 PDT This adds some missing error reporting for SDL_SelectRenderer, and cleans up the logic a little bit.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 26 Sep 2009 10:22:35 +0000
parents 9cf18687b761
children b334b4f7dfa0
comparison
equal deleted inserted replaced
3317:b29eb7ce5352 3318:f085091f74cd
1499 SDL_SelectRenderer(SDL_WindowID windowID) 1499 SDL_SelectRenderer(SDL_WindowID windowID)
1500 { 1500 {
1501 SDL_Window *window = SDL_GetWindowFromID(windowID); 1501 SDL_Window *window = SDL_GetWindowFromID(windowID);
1502 SDL_Renderer *renderer; 1502 SDL_Renderer *renderer;
1503 1503
1504 if (!window || !window->renderer) { 1504 if (!window) {
1505 SDL_SetError("Invalid window ID");
1505 return -1; 1506 return -1;
1506 } 1507 }
1507 renderer = window->renderer; 1508 renderer = window->renderer;
1508 if (renderer && renderer->ActivateRenderer) { 1509 if (!renderer) {
1510 SDL_SetError("Renderer hasn't been created yet");
1511 return -1;
1512 }
1513 if (renderer->ActivateRenderer) {
1509 if (renderer->ActivateRenderer(renderer) < 0) { 1514 if (renderer->ActivateRenderer(renderer) < 0) {
1510 return -1; 1515 return -1;
1511 } 1516 }
1512 } 1517 }
1513 SDL_CurrentDisplay.current_renderer = renderer; 1518 SDL_CurrentDisplay.current_renderer = renderer;