src/SDL_compat.c
changeset 1907 06c27a737b7a
parent 1897 c2a27da60b18
child 1912 8d384b647307
     1.1 --- a/src/SDL_compat.c	Fri Jul 14 08:24:43 2006 +0000
     1.2 +++ b/src/SDL_compat.c	Sat Jul 15 09:46:36 2006 +0000
     1.3 @@ -31,6 +31,7 @@
     1.4  
     1.5  
     1.6  static SDL_WindowID SDL_VideoWindow;
     1.7 +static SDL_RendererInfo SDL_VideoRendererInfo;
     1.8  static SDL_TextureID SDL_VideoTexture;
     1.9  static SDL_Surface *SDL_VideoSurface;
    1.10  static SDL_Surface *SDL_ShadowSurface;
    1.11 @@ -442,10 +443,12 @@
    1.12      }
    1.13  
    1.14      /* Create a renderer for the window */
    1.15 -    if (SDL_CreateRenderer(SDL_VideoWindow, -1, SDL_Renderer_SingleBuffer) <
    1.16 -        0) {
    1.17 +    if (SDL_CreateRenderer
    1.18 +        (SDL_VideoWindow, -1,
    1.19 +         SDL_Renderer_SingleBuffer | SDL_Renderer_PresentDiscard) < 0) {
    1.20          return NULL;
    1.21      }
    1.22 +    SDL_GetRendererInfo(-1, &SDL_VideoRendererInfo);
    1.23  
    1.24      /* Create a texture for the screen surface */
    1.25      SDL_VideoTexture =
    1.26 @@ -642,8 +645,19 @@
    1.27          screen = SDL_VideoSurface;
    1.28      }
    1.29      if (screen == SDL_VideoSurface) {
    1.30 -        for (i = 0; i < numrects; ++i) {
    1.31 -            SDL_RenderCopy(SDL_VideoTexture, &rects[i], &rects[i],
    1.32 +        if (SDL_VideoRendererInfo.flags & SDL_Renderer_PresentCopy) {
    1.33 +            for (i = 0; i < numrects; ++i) {
    1.34 +                SDL_RenderCopy(SDL_VideoTexture, &rects[i], &rects[i],
    1.35 +                               SDL_TextureBlendMode_None,
    1.36 +                               SDL_TextureScaleMode_None);
    1.37 +            }
    1.38 +        } else {
    1.39 +            SDL_Rect rect;
    1.40 +            rect.x = 0;
    1.41 +            rect.y = 0;
    1.42 +            rect.w = screen->w;
    1.43 +            rect.h = screen->h;
    1.44 +            SDL_RenderCopy(SDL_VideoTexture, &rect, &rect,
    1.45                             SDL_TextureBlendMode_None,
    1.46                             SDL_TextureScaleMode_None);
    1.47          }