src/video/SDL_surface.c
changeset 2257 340942cfda48
parent 2253 6d99edd791bf
child 2260 202ddfd1cfb1
     1.1 --- a/src/video/SDL_surface.c	Thu Aug 16 22:56:18 2007 +0000
     1.2 +++ b/src/video/SDL_surface.c	Fri Aug 17 00:54:53 2007 +0000
     1.3 @@ -231,7 +231,7 @@
     1.4  
     1.5      /* Optimize away operations that don't change anything */
     1.6      if ((flag == (surface->flags & (SDL_SRCCOLORKEY | SDL_RLEACCELOK))) &&
     1.7 -        (key == surface->format->colorkey)) {
     1.8 +        (key == surface->map->ckey)) {
     1.9          return (0);
    1.10      }
    1.11  
    1.12 @@ -242,7 +242,7 @@
    1.13  
    1.14      if (flag) {
    1.15          surface->flags |= SDL_SRCCOLORKEY;
    1.16 -        surface->format->colorkey = key;
    1.17 +        surface->map->ckey = key;
    1.18          if (flag & SDL_RLEACCELOK) {
    1.19              surface->flags |= SDL_RLEACCELOK;
    1.20          } else {
    1.21 @@ -250,7 +250,7 @@
    1.22          }
    1.23      } else {
    1.24          surface->flags &= ~(SDL_SRCCOLORKEY | SDL_RLEACCELOK);
    1.25 -        surface->format->colorkey = 0;
    1.26 +        surface->map->ckey = 0;
    1.27      }
    1.28      SDL_InvalidateMap(surface->map);
    1.29      return (0);
    1.30 @@ -261,7 +261,7 @@
    1.31  SDL_SetAlpha(SDL_Surface * surface, Uint32 flag, Uint8 value)
    1.32  {
    1.33      Uint32 oldflags = surface->flags;
    1.34 -    Uint32 oldalpha = surface->format->alpha;
    1.35 +    Uint32 oldalpha = (surface->map->cmod >> 24);
    1.36  
    1.37      /* Sanity check the flag as it gets passed in */
    1.38      if (flag & SDL_SRCALPHA) {
    1.39 @@ -285,7 +285,8 @@
    1.40  
    1.41      if (flag) {
    1.42          surface->flags |= SDL_SRCALPHA;
    1.43 -        surface->format->alpha = value;
    1.44 +        surface->map->cmod &= 0x00FFFFFF;
    1.45 +        surface->map->cmod |= ((Uint32)value << 24);
    1.46          if (flag & SDL_RLEACCELOK) {
    1.47              surface->flags |= SDL_RLEACCELOK;
    1.48          } else {
    1.49 @@ -293,7 +294,7 @@
    1.50          }
    1.51      } else {
    1.52          surface->flags &= ~SDL_SRCALPHA;
    1.53 -        surface->format->alpha = SDL_ALPHA_OPAQUE;
    1.54 +        surface->map->cmod |= 0xFF000000;
    1.55      }
    1.56      /*
    1.57       * The representation for software surfaces is independent of
    1.58 @@ -412,7 +413,7 @@
    1.59              return (-1);
    1.60          }
    1.61      }
    1.62 -    return (src->map->sw_blit(src, srcrect, dst, dstrect));
    1.63 +    return (src->map->blit(src, srcrect, dst, dstrect));
    1.64  }
    1.65  
    1.66  
    1.67 @@ -601,7 +602,7 @@
    1.68          if ((flags & SDL_SRCCOLORKEY) != SDL_SRCCOLORKEY && format->Amask) {
    1.69              surface_flags &= ~SDL_SRCCOLORKEY;
    1.70          } else {
    1.71 -            colorkey = surface->format->colorkey;
    1.72 +            colorkey = surface->map->ckey;
    1.73              SDL_SetColorKey(surface, 0, 0);
    1.74          }
    1.75      }
    1.76 @@ -610,7 +611,7 @@
    1.77          if (format->Amask) {
    1.78              surface->flags &= ~SDL_SRCALPHA;
    1.79          } else {
    1.80 -            alpha = surface->format->alpha;
    1.81 +            alpha = (Uint8)(surface->map->cmod >> 24);
    1.82              SDL_SetAlpha(surface, 0, 0);
    1.83          }
    1.84      }