src/video/SDL_video.c
changeset 1924 69217fdd2c0a
parent 1923 d4572b97b08f
child 1926 307355678142
     1.1 --- a/src/video/SDL_video.c	Sat Jul 22 19:51:48 2006 +0000
     1.2 +++ b/src/video/SDL_video.c	Sat Jul 22 21:02:57 2006 +0000
     1.3 @@ -833,6 +833,20 @@
     1.4      return window.id;
     1.5  }
     1.6  
     1.7 +int
     1.8 +SDL_RecreateWindow(SDL_Window * window)
     1.9 +{
    1.10 +    if ((window->flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
    1.11 +        window->flags &= ~SDL_WINDOW_OPENGL;
    1.12 +        SDL_SetError("No OpenGL support in video driver");
    1.13 +        return -1;
    1.14 +    }
    1.15 +    if (_this->DestroyWindow) {
    1.16 +        _this->DestroyWindow(_this, window);
    1.17 +    }
    1.18 +    return _this->CreateWindow(_this, window);
    1.19 +}
    1.20 +
    1.21  SDL_Window *
    1.22  SDL_GetWindowFromID(SDL_WindowID windowID)
    1.23  {
    1.24 @@ -1259,6 +1273,7 @@
    1.25              if (window->title) {
    1.26                  SDL_free(window->title);
    1.27              }
    1.28 +            SDL_free(window);
    1.29              if (j != display->num_windows - 1) {
    1.30                  SDL_memcpy(&display->windows[i],
    1.31                             &display->windows[i + 1],
    1.32 @@ -1421,6 +1436,9 @@
    1.33      texture->renderer = renderer;
    1.34  
    1.35      if (renderer->CreateTexture(renderer, texture) < 0) {
    1.36 +        if (renderer->DestroyTexture) {
    1.37 +            renderer->DestroyTexture(renderer, texture);
    1.38 +        }
    1.39          SDL_free(texture);
    1.40          return 0;
    1.41      }