src/video/SDL_video.c
changeset 3435 9f62f47d989b
parent 3427 36cf454ba065
child 3448 bc27e1fdd3a7
     1.1 --- a/src/video/SDL_video.c	Sun Nov 15 09:21:46 2009 +0000
     1.2 +++ b/src/video/SDL_video.c	Mon Nov 16 07:13:07 2009 +0000
     1.3 @@ -2487,7 +2487,8 @@
     1.4  }
     1.5  
     1.6  int
     1.7 -SDL_RenderReadPixels(const SDL_Rect * rect, void * pixels, int pitch)
     1.8 +SDL_RenderReadPixels(const SDL_Rect * rect, Uint32 format,
     1.9 +                     void * pixels, int pitch)
    1.10  {
    1.11      SDL_Renderer *renderer;
    1.12      SDL_Window *window;
    1.13 @@ -2503,6 +2504,10 @@
    1.14      }
    1.15      window = SDL_GetWindowFromID(renderer->window);
    1.16  
    1.17 +    if (!format) {
    1.18 +        format = SDL_GetDisplayFromWindow(window)->current_mode.format;
    1.19 +    }
    1.20 +
    1.21      real_rect.x = 0;
    1.22      real_rect.y = 0;
    1.23      real_rect.w = window->w;
    1.24 @@ -2521,11 +2526,13 @@
    1.25          }
    1.26      }
    1.27  
    1.28 -    return renderer->RenderReadPixels(renderer, &real_rect, pixels, pitch);
    1.29 +    return renderer->RenderReadPixels(renderer, &real_rect,
    1.30 +                                      format, pixels, pitch);
    1.31  }
    1.32  
    1.33  int
    1.34 -SDL_RenderWritePixels(const SDL_Rect * rect, const void * pixels, int pitch)
    1.35 +SDL_RenderWritePixels(const SDL_Rect * rect, Uint32 format,
    1.36 +                      const void * pixels, int pitch)
    1.37  {
    1.38      SDL_Renderer *renderer;
    1.39      SDL_Window *window;
    1.40 @@ -2541,6 +2548,10 @@
    1.41      }
    1.42      window = SDL_GetWindowFromID(renderer->window);
    1.43  
    1.44 +    if (!format) {
    1.45 +        format = SDL_GetDisplayFromWindow(window)->current_mode.format;
    1.46 +    }
    1.47 +
    1.48      real_rect.x = 0;
    1.49      real_rect.y = 0;
    1.50      real_rect.w = window->w;
    1.51 @@ -2559,7 +2570,8 @@
    1.52          }
    1.53      }
    1.54  
    1.55 -    return renderer->RenderWritePixels(renderer, &real_rect, pixels, pitch);
    1.56 +    return renderer->RenderWritePixels(renderer, &real_rect,
    1.57 +                                       format, pixels, pitch);
    1.58  }
    1.59  
    1.60  void