We're using the alpha component of the palette entries, let's name it appropriately.
authorSam Lantinga <slouken@libsdl.org>
Sun, 24 Mar 2013 09:56:45 -0700
changeset 702472cb3e205571
parent 7023 1d49dc7b5ce9
child 7025 4eb8ac58642c
We're using the alpha component of the palette entries, let's name it appropriately.
include/SDL_pixels.h
src/video/SDL_bmp.c
src/video/SDL_pixels.c
src/video/SDL_surface.c
     1.1 --- a/include/SDL_pixels.h	Sun Mar 24 09:51:01 2013 -0700
     1.2 +++ b/include/SDL_pixels.h	Sun Mar 24 09:56:45 2013 -0700
     1.3 @@ -256,7 +256,7 @@
     1.4      Uint8 r;
     1.5      Uint8 g;
     1.6      Uint8 b;
     1.7 -    Uint8 unused;
     1.8 +    Uint8 a;
     1.9  } SDL_Color;
    1.10  #define SDL_Colour SDL_Color
    1.11  
     2.1 --- a/src/video/SDL_bmp.c	Sun Mar 24 09:51:01 2013 -0700
     2.2 +++ b/src/video/SDL_bmp.c	Sun Mar 24 09:56:45 2013 -0700
     2.3 @@ -252,14 +252,14 @@
     2.4                  SDL_RWread(src, &palette->colors[i].b, 1, 1);
     2.5                  SDL_RWread(src, &palette->colors[i].g, 1, 1);
     2.6                  SDL_RWread(src, &palette->colors[i].r, 1, 1);
     2.7 -                palette->colors[i].unused = SDL_ALPHA_OPAQUE;
     2.8 +                palette->colors[i].a = SDL_ALPHA_OPAQUE;
     2.9              }
    2.10          } else {
    2.11              for (i = 0; i < (int) biClrUsed; ++i) {
    2.12                  SDL_RWread(src, &palette->colors[i].b, 1, 1);
    2.13                  SDL_RWread(src, &palette->colors[i].g, 1, 1);
    2.14                  SDL_RWread(src, &palette->colors[i].r, 1, 1);
    2.15 -                SDL_RWread(src, &palette->colors[i].unused, 1, 1);
    2.16 +                SDL_RWread(src, &palette->colors[i].a, 1, 1);
    2.17              }
    2.18          }
    2.19      }
    2.20 @@ -510,7 +510,7 @@
    2.21                  SDL_RWwrite(dst, &colors[i].b, 1, 1);
    2.22                  SDL_RWwrite(dst, &colors[i].g, 1, 1);
    2.23                  SDL_RWwrite(dst, &colors[i].r, 1, 1);
    2.24 -                SDL_RWwrite(dst, &colors[i].unused, 1, 1);
    2.25 +                SDL_RWwrite(dst, &colors[i].a, 1, 1);
    2.26              }
    2.27          }
    2.28  
     3.1 --- a/src/video/SDL_pixels.c	Sun Mar 24 09:51:01 2013 -0700
     3.2 +++ b/src/video/SDL_pixels.c	Sun Mar 24 09:56:45 2013 -0700
     3.3 @@ -730,7 +730,7 @@
     3.4          b |= b << 2;
     3.5          b |= b << 4;
     3.6          colors[i].b = b;
     3.7 -        colors[i].unused = SDL_ALPHA_OPAQUE;
     3.8 +        colors[i].a = SDL_ALPHA_OPAQUE;
     3.9      }
    3.10  }
    3.11  
    3.12 @@ -776,7 +776,7 @@
    3.13          rd = pal->colors[i].r - r;
    3.14          gd = pal->colors[i].g - g;
    3.15          bd = pal->colors[i].b - b;
    3.16 -        ad = pal->colors[i].unused - a;
    3.17 +        ad = pal->colors[i].a - a;
    3.18          distance = (rd * rd) + (gd * gd) + (bd * bd) + (ad * ad);
    3.19          if (distance < smallest) {
    3.20              pixel = i;
    3.21 @@ -859,7 +859,7 @@
    3.22              *r = format->palette->colors[pixel].r;
    3.23              *g = format->palette->colors[pixel].g;
    3.24              *b = format->palette->colors[pixel].b;
    3.25 -            *a = format->palette->colors[pixel].unused;
    3.26 +            *a = format->palette->colors[pixel].a;
    3.27          } else {
    3.28              *r = *g = *b = *a = 0;
    3.29          }
    3.30 @@ -895,7 +895,7 @@
    3.31      for (i = 0; i < src->ncolors; ++i) {
    3.32          map[i] = SDL_FindColor(dst,
    3.33                                 src->colors[i].r, src->colors[i].g,
    3.34 -                               src->colors[i].b, src->colors[i].unused);
    3.35 +                               src->colors[i].b, src->colors[i].a);
    3.36      }
    3.37      return (map);
    3.38  }
    3.39 @@ -922,7 +922,7 @@
    3.40          Uint8 R = (Uint8) ((pal->colors[i].r * Rmod) / 255);
    3.41          Uint8 G = (Uint8) ((pal->colors[i].g * Gmod) / 255);
    3.42          Uint8 B = (Uint8) ((pal->colors[i].b * Bmod) / 255);
    3.43 -        Uint8 A = (Uint8) ((pal->colors[i].unused * Amod) / 255);
    3.44 +        Uint8 A = (Uint8) ((pal->colors[i].a * Amod) / 255);
    3.45          ASSEMBLE_RGBA(&map[i * bpp], dst->BytesPerPixel, dst, R, G, B, A);
    3.46      }
    3.47      return (map);
     4.1 --- a/src/video/SDL_surface.c	Sun Mar 24 09:51:01 2013 -0700
     4.2 +++ b/src/video/SDL_surface.c	Sun Mar 24 09:56:45 2013 -0700
     4.3 @@ -188,11 +188,11 @@
     4.4          surface->map->info.flags |= SDL_COPY_COLORKEY;
     4.5          surface->map->info.colorkey = key;
     4.6          if (surface->format->palette) {
     4.7 -            surface->format->palette->colors[surface->map->info.colorkey].unused = SDL_ALPHA_TRANSPARENT;
     4.8 +            surface->format->palette->colors[surface->map->info.colorkey].a = SDL_ALPHA_TRANSPARENT;
     4.9          }
    4.10      } else {
    4.11          if (surface->format->palette) {
    4.12 -            surface->format->palette->colors[surface->map->info.colorkey].unused = SDL_ALPHA_OPAQUE;
    4.13 +            surface->format->palette->colors[surface->map->info.colorkey].a = SDL_ALPHA_OPAQUE;
    4.14          }
    4.15          surface->map->info.flags &= ~SDL_COPY_COLORKEY;
    4.16      }