src/video/SDL_video.c
changeset 1923 d4572b97b08f
parent 1920 8a162bfdc838
child 1924 69217fdd2c0a
equal deleted inserted replaced
1922:4905cac7a4bd 1923:d4572b97b08f
  1364 
  1364 
  1365     /* Create a new renderer instance */
  1365     /* Create a new renderer instance */
  1366     window->renderer =
  1366     window->renderer =
  1367         SDL_CurrentDisplay.render_drivers[index].CreateRenderer(window,
  1367         SDL_CurrentDisplay.render_drivers[index].CreateRenderer(window,
  1368                                                                 flags);
  1368                                                                 flags);
  1369     if (!window->renderer) {
  1369     SDL_SelectRenderer(window->id);
  1370         return -1;
       
  1371     }
       
  1372     SDL_CurrentDisplay.current_renderer = window->renderer;
       
  1373 
  1370 
  1374     return 0;
  1371     return 0;
  1375 }
  1372 }
  1376 
  1373 
  1377 int
  1374 int
  1378 SDL_SelectRenderer(SDL_WindowID windowID)
  1375 SDL_SelectRenderer(SDL_WindowID windowID)
  1379 {
  1376 {
  1380     SDL_Window *window = SDL_GetWindowFromID(windowID);
  1377     SDL_Window *window = SDL_GetWindowFromID(windowID);
       
  1378     SDL_Renderer *renderer;
  1381 
  1379 
  1382     if (!window || !window->renderer) {
  1380     if (!window || !window->renderer) {
  1383         return -1;
  1381         return -1;
  1384     }
  1382     }
  1385     SDL_CurrentDisplay.current_renderer = window->renderer;
  1383     renderer = window->renderer;
       
  1384     if (renderer && renderer->ActivateRenderer) {
       
  1385         if (renderer->ActivateRenderer(renderer) < 0) {
       
  1386             return -1;
       
  1387         }
       
  1388     }
       
  1389     SDL_CurrentDisplay.current_renderer = renderer;
  1386     return 0;
  1390     return 0;
  1387 }
  1391 }
  1388 
  1392 
  1389 SDL_TextureID
  1393 SDL_TextureID
  1390 SDL_CreateTexture(Uint32 format, int access, int w, int h)
  1394 SDL_CreateTexture(Uint32 format, int access, int w, int h)