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 7024 72cb3e205571
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
--- a/include/SDL_pixels.h	Sun Mar 24 09:51:01 2013 -0700
+++ b/include/SDL_pixels.h	Sun Mar 24 09:56:45 2013 -0700
@@ -256,7 +256,7 @@
     Uint8 r;
     Uint8 g;
     Uint8 b;
-    Uint8 unused;
+    Uint8 a;
 } SDL_Color;
 #define SDL_Colour SDL_Color
 
--- a/src/video/SDL_bmp.c	Sun Mar 24 09:51:01 2013 -0700
+++ b/src/video/SDL_bmp.c	Sun Mar 24 09:56:45 2013 -0700
@@ -252,14 +252,14 @@
                 SDL_RWread(src, &palette->colors[i].b, 1, 1);
                 SDL_RWread(src, &palette->colors[i].g, 1, 1);
                 SDL_RWread(src, &palette->colors[i].r, 1, 1);
-                palette->colors[i].unused = SDL_ALPHA_OPAQUE;
+                palette->colors[i].a = SDL_ALPHA_OPAQUE;
             }
         } else {
             for (i = 0; i < (int) biClrUsed; ++i) {
                 SDL_RWread(src, &palette->colors[i].b, 1, 1);
                 SDL_RWread(src, &palette->colors[i].g, 1, 1);
                 SDL_RWread(src, &palette->colors[i].r, 1, 1);
-                SDL_RWread(src, &palette->colors[i].unused, 1, 1);
+                SDL_RWread(src, &palette->colors[i].a, 1, 1);
             }
         }
     }
@@ -510,7 +510,7 @@
                 SDL_RWwrite(dst, &colors[i].b, 1, 1);
                 SDL_RWwrite(dst, &colors[i].g, 1, 1);
                 SDL_RWwrite(dst, &colors[i].r, 1, 1);
-                SDL_RWwrite(dst, &colors[i].unused, 1, 1);
+                SDL_RWwrite(dst, &colors[i].a, 1, 1);
             }
         }
 
--- a/src/video/SDL_pixels.c	Sun Mar 24 09:51:01 2013 -0700
+++ b/src/video/SDL_pixels.c	Sun Mar 24 09:56:45 2013 -0700
@@ -730,7 +730,7 @@
         b |= b << 2;
         b |= b << 4;
         colors[i].b = b;
-        colors[i].unused = SDL_ALPHA_OPAQUE;
+        colors[i].a = SDL_ALPHA_OPAQUE;
     }
 }
 
@@ -776,7 +776,7 @@
         rd = pal->colors[i].r - r;
         gd = pal->colors[i].g - g;
         bd = pal->colors[i].b - b;
-        ad = pal->colors[i].unused - a;
+        ad = pal->colors[i].a - a;
         distance = (rd * rd) + (gd * gd) + (bd * bd) + (ad * ad);
         if (distance < smallest) {
             pixel = i;
@@ -859,7 +859,7 @@
             *r = format->palette->colors[pixel].r;
             *g = format->palette->colors[pixel].g;
             *b = format->palette->colors[pixel].b;
-            *a = format->palette->colors[pixel].unused;
+            *a = format->palette->colors[pixel].a;
         } else {
             *r = *g = *b = *a = 0;
         }
@@ -895,7 +895,7 @@
     for (i = 0; i < src->ncolors; ++i) {
         map[i] = SDL_FindColor(dst,
                                src->colors[i].r, src->colors[i].g,
-                               src->colors[i].b, src->colors[i].unused);
+                               src->colors[i].b, src->colors[i].a);
     }
     return (map);
 }
@@ -922,7 +922,7 @@
         Uint8 R = (Uint8) ((pal->colors[i].r * Rmod) / 255);
         Uint8 G = (Uint8) ((pal->colors[i].g * Gmod) / 255);
         Uint8 B = (Uint8) ((pal->colors[i].b * Bmod) / 255);
-        Uint8 A = (Uint8) ((pal->colors[i].unused * Amod) / 255);
+        Uint8 A = (Uint8) ((pal->colors[i].a * Amod) / 255);
         ASSEMBLE_RGBA(&map[i * bpp], dst->BytesPerPixel, dst, R, G, B, A);
     }
     return (map);
--- a/src/video/SDL_surface.c	Sun Mar 24 09:51:01 2013 -0700
+++ b/src/video/SDL_surface.c	Sun Mar 24 09:56:45 2013 -0700
@@ -188,11 +188,11 @@
         surface->map->info.flags |= SDL_COPY_COLORKEY;
         surface->map->info.colorkey = key;
         if (surface->format->palette) {
-            surface->format->palette->colors[surface->map->info.colorkey].unused = SDL_ALPHA_TRANSPARENT;
+            surface->format->palette->colors[surface->map->info.colorkey].a = SDL_ALPHA_TRANSPARENT;
         }
     } else {
         if (surface->format->palette) {
-            surface->format->palette->colors[surface->map->info.colorkey].unused = SDL_ALPHA_OPAQUE;
+            surface->format->palette->colors[surface->map->info.colorkey].a = SDL_ALPHA_OPAQUE;
         }
         surface->map->info.flags &= ~SDL_COPY_COLORKEY;
     }