src/video/SDL_video.c
branchSDL-1.3
changeset 1684 c4aa1a2f48f1
parent 1683 396a35389351
child 1706 1577404809f0
     1.1 --- a/src/video/SDL_video.c	Sat Jun 17 06:45:14 2006 +0000
     1.2 +++ b/src/video/SDL_video.c	Sun Jun 18 06:35:41 2006 +0000
     1.3 @@ -567,7 +567,7 @@
     1.4          ncolors = 0;
     1.5      }
     1.6      if ((!ncolors && display->palette) || (ncolors && !display->palette)
     1.7 -        || (ncolors != display->palette->ncolors)) {
     1.8 +        || (ncolors && ncolors != display->palette->ncolors)) {
     1.9          if (display->palette) {
    1.10              SDL_FreePalette(display->palette);
    1.11              display->palette = NULL;
    1.12 @@ -1434,6 +1434,7 @@
    1.13  {
    1.14      SDL_Texture *texture = SDL_GetTextureFromID(textureID);
    1.15      SDL_Renderer *renderer;
    1.16 +    SDL_Rect full_rect;
    1.17  
    1.18      if (!texture) {
    1.19          return -1;
    1.20 @@ -1443,6 +1444,15 @@
    1.21      if (!renderer->UpdateTexture) {
    1.22          return -1;
    1.23      }
    1.24 +
    1.25 +    if (!rect) {
    1.26 +        full_rect.x = 0;
    1.27 +        full_rect.y = 0;
    1.28 +        full_rect.w = texture->w;
    1.29 +        full_rect.h = texture->h;
    1.30 +        rect = &full_rect;
    1.31 +    }
    1.32 +
    1.33      return renderer->UpdateTexture(renderer, texture, rect, pixels, pitch);
    1.34  }
    1.35  
    1.36 @@ -1452,6 +1462,7 @@
    1.37  {
    1.38      SDL_Texture *texture = SDL_GetTextureFromID(textureID);
    1.39      SDL_Renderer *renderer;
    1.40 +    SDL_Rect full_rect;
    1.41  
    1.42      if (!texture) {
    1.43          return -1;
    1.44 @@ -1461,6 +1472,15 @@
    1.45      if (!renderer->LockTexture) {
    1.46          return -1;
    1.47      }
    1.48 +
    1.49 +    if (!rect) {
    1.50 +        full_rect.x = 0;
    1.51 +        full_rect.y = 0;
    1.52 +        full_rect.w = texture->w;
    1.53 +        full_rect.h = texture->h;
    1.54 +        rect = &full_rect;
    1.55 +    }
    1.56 +
    1.57      return renderer->LockTexture(renderer, texture, rect, markDirty, pixels,
    1.58                                   pitch);
    1.59  }
    1.60 @@ -1520,6 +1540,7 @@
    1.61  SDL_RenderFill(const SDL_Rect * rect, Uint32 color)
    1.62  {
    1.63      SDL_Renderer *renderer;
    1.64 +    SDL_Rect full_rect;
    1.65  
    1.66      if (!_this) {
    1.67          return -1;
    1.68 @@ -1530,6 +1551,14 @@
    1.69          return -1;
    1.70      }
    1.71  
    1.72 +    if (!rect) {
    1.73 +        full_rect.x = 0;
    1.74 +        full_rect.y = 0;
    1.75 +        full_rect.w = renderer->window->w;
    1.76 +        full_rect.h = renderer->window->h;
    1.77 +        rect = &full_rect;
    1.78 +    }
    1.79 +
    1.80      renderer->RenderFill(renderer, rect, color);
    1.81  }
    1.82  
    1.83 @@ -1539,6 +1568,8 @@
    1.84  {
    1.85      SDL_Texture *texture = SDL_GetTextureFromID(textureID);
    1.86      SDL_Renderer *renderer;
    1.87 +    SDL_Rect full_srcrect;
    1.88 +    SDL_Rect full_dstrect;
    1.89  
    1.90      if (!texture || texture->renderer != SDL_CurrentDisplay.current_renderer) {
    1.91          return;
    1.92 @@ -1549,6 +1580,21 @@
    1.93          return -1;
    1.94      }
    1.95  
    1.96 +    if (!srcrect) {
    1.97 +        full_srcrect.x = 0;
    1.98 +        full_srcrect.y = 0;
    1.99 +        full_srcrect.w = texture->w;
   1.100 +        full_srcrect.h = texture->h;
   1.101 +        srcrect = &full_srcrect;
   1.102 +    }
   1.103 +    if (!dstrect) {
   1.104 +        full_dstrect.x = 0;
   1.105 +        full_dstrect.y = 0;
   1.106 +        full_dstrect.w = renderer->window->w;
   1.107 +        full_dstrect.h = renderer->window->h;
   1.108 +        dstrect = &full_dstrect;
   1.109 +    }
   1.110 +
   1.111      return renderer->RenderCopy(renderer, texture, srcrect, dstrect,
   1.112                                  blendMode, scaleMode);
   1.113  }
   1.114 @@ -1557,6 +1603,7 @@
   1.115  SDL_RenderReadPixels(const SDL_Rect * rect, void *pixels, int pitch)
   1.116  {
   1.117      SDL_Renderer *renderer;
   1.118 +    SDL_Rect full_rect;
   1.119  
   1.120      if (!_this) {
   1.121          return -1;
   1.122 @@ -1567,6 +1614,14 @@
   1.123          return -1;
   1.124      }
   1.125  
   1.126 +    if (!rect) {
   1.127 +        full_rect.x = 0;
   1.128 +        full_rect.y = 0;
   1.129 +        full_rect.w = renderer->window->w;
   1.130 +        full_rect.h = renderer->window->h;
   1.131 +        rect = &full_rect;
   1.132 +    }
   1.133 +
   1.134      return renderer->RenderReadPixels(renderer, rect, pixels, pitch);
   1.135  }
   1.136  
   1.137 @@ -1574,6 +1629,7 @@
   1.138  SDL_RenderWritePixels(const SDL_Rect * rect, const void *pixels, int pitch)
   1.139  {
   1.140      SDL_Renderer *renderer;
   1.141 +    SDL_Rect full_rect;
   1.142  
   1.143      if (!_this) {
   1.144          return -1;
   1.145 @@ -1584,6 +1640,14 @@
   1.146          return -1;
   1.147      }
   1.148  
   1.149 +    if (!rect) {
   1.150 +        full_rect.x = 0;
   1.151 +        full_rect.y = 0;
   1.152 +        full_rect.w = renderer->window->w;
   1.153 +        full_rect.h = renderer->window->h;
   1.154 +        rect = &full_rect;
   1.155 +    }
   1.156 +
   1.157      return renderer->RenderWritePixels(renderer, rect, pixels, pitch);
   1.158  }
   1.159