src/video/SDL_video.c
branchSDL-1.3
changeset 1680 9488fca10677
parent 1679 153477a6cc31
child 1681 80a5e6a4e1e2
     1.1 --- a/src/video/SDL_video.c	Wed Jun 14 06:26:35 2006 +0000
     1.2 +++ b/src/video/SDL_video.c	Wed Jun 14 08:41:13 2006 +0000
     1.3 @@ -1029,8 +1029,15 @@
     1.4      if (index < 0) {
     1.5          int n = SDL_GetNumRenderers();
     1.6          for (index = 0; index < n; ++index) {
     1.7 -            if ((SDL_CurrentDisplay.render_drivers[index].info.
     1.8 -                 flags & flags) == flags) {
     1.9 +            SDL_RenderDriver *driver =
    1.10 +                &SDL_CurrentDisplay.render_drivers[index];
    1.11 +
    1.12 +            /* Skip minimal drivers in automatic scans */
    1.13 +            if (!(flags & SDL_Renderer_Minimal)
    1.14 +                && (driver->info.flags & SDL_Renderer_Minimal)) {
    1.15 +                continue;
    1.16 +            }
    1.17 +            if ((driver->info.flags & flags) == flags) {
    1.18                  break;
    1.19              }
    1.20          }
    1.21 @@ -1076,6 +1083,7 @@
    1.22  SDL_TextureID
    1.23  SDL_CreateTexture(Uint32 format, int access, int w, int h)
    1.24  {
    1.25 +    int hash;
    1.26      SDL_Renderer *renderer;
    1.27      SDL_Texture *texture;
    1.28  
    1.29 @@ -1106,6 +1114,12 @@
    1.30          SDL_free(texture);
    1.31          return 0;
    1.32      }
    1.33 +
    1.34 +    hash = (texture->id % SDL_arraysize(SDL_CurrentDisplay.textures));
    1.35 +    texture->next = SDL_CurrentDisplay.textures[hash];
    1.36 +    SDL_CurrentDisplay.textures[hash] = texture;
    1.37 +
    1.38 +    return texture->id;
    1.39  }
    1.40  
    1.41  SDL_TextureID
    1.42 @@ -1303,6 +1317,25 @@
    1.43  }
    1.44  
    1.45  int
    1.46 +SDL_SetTexturePalette(SDL_TextureID textureID, SDL_Color * colors,
    1.47 +                      int firstcolor, int ncolors)
    1.48 +{
    1.49 +    SDL_Texture *texture = SDL_GetTextureFromID(textureID);
    1.50 +    SDL_Renderer *renderer;
    1.51 +
    1.52 +    if (!texture) {
    1.53 +        return -1;
    1.54 +    }
    1.55 +
    1.56 +    renderer = texture->renderer;
    1.57 +    if (!renderer->SetTexturePalette) {
    1.58 +        return -1;
    1.59 +    }
    1.60 +    return renderer->SetTexturePalette(renderer, texture, colors, firstcolor,
    1.61 +                                       ncolors);
    1.62 +}
    1.63 +
    1.64 +int
    1.65  SDL_UpdateTexture(SDL_TextureID textureID, SDL_Rect * rect,
    1.66                    const void *pixels, int pitch)
    1.67  {