Okay, still some bugs, but everything builds again...
authorSam Lantinga <slouken@libsdl.org>
Sat, 18 Aug 2007 05:39:09 +0000
changeset 2267c785543d1843
parent 2266 e61ad15a205f
child 2268 4baee598306d
Okay, still some bugs, but everything builds again...
include/SDL_compat.h
include/SDL_video.h
src/SDL_compat.c
src/video/SDL_RLEaccel.c
src/video/SDL_blit.c
src/video/SDL_blit.h
src/video/SDL_blit_0.c
src/video/SDL_blit_1.c
src/video/SDL_blit_A.c
src/video/SDL_blit_N.c
src/video/SDL_blit_auto.c
src/video/SDL_blit_copy.c
src/video/SDL_pixels.c
src/video/SDL_renderer_sw.c
src/video/SDL_surface.c
src/video/SDL_video.c
src/video/dummy/SDL_nullrender.c
src/video/sdlgenblit.pl
test/testalpha.c
test/testblitspeed.c
test/testgl.c
test/testoverlay.c
test/testoverlay2.c
     1.1 --- a/include/SDL_compat.h	Sat Aug 18 01:44:21 2007 +0000
     1.2 +++ b/include/SDL_compat.h	Sat Aug 18 05:39:09 2007 +0000
     1.3 @@ -37,8 +37,8 @@
     1.4  #endif
     1.5  
     1.6  #define SDL_SWSURFACE       0x00000000  /* Not used */
     1.7 -//#define SDL_SRCALPHA        0x00010000
     1.8 -//#define SDL_SRCCOLORKEY     0x00020000
     1.9 +#define SDL_SRCALPHA        0x00010000
    1.10 +#define SDL_SRCCOLORKEY     0x00020000
    1.11  #define SDL_ANYFORMAT       0x00100000
    1.12  #define SDL_HWPALETTE       0x00200000
    1.13  #define SDL_DOUBLEBUF       0x00400000
    1.14 @@ -48,6 +48,7 @@
    1.15  #define SDL_OPENGL          0x04000000
    1.16  #define SDL_HWSURFACE       0x08000001  /* Not used */
    1.17  #define SDL_ASYNCBLIT       0x08000000  /* Not used */
    1.18 +#define SDL_RLEACCELOK      0x08000000  /* Not used */
    1.19  #define SDL_HWACCEL         0x08000000  /* Not used */
    1.20  
    1.21  #define SDL_APPMOUSEFOCUS	0x01
     2.1 --- a/include/SDL_video.h	Sat Aug 18 01:44:21 2007 +0000
     2.2 +++ b/include/SDL_video.h	Sat Aug 18 05:39:09 2007 +0000
     2.3 @@ -265,7 +265,7 @@
     2.4  /* These are the currently supported flags for the SDL_surface */
     2.5  /* Used internally (read-only) */
     2.6  #define SDL_PREALLOC        0x00000001  /* Surface uses preallocated memory */
     2.7 -#define SDL_RLEACCEL        0x00000001  /* Surface is RLE encoded */
     2.8 +#define SDL_RLEACCEL        0x00000002  /* Surface is RLE encoded */
     2.9  
    2.10  /* Evaluates to true if the surface needs to be locked before access */
    2.11  #define SDL_MUSTLOCK(S)	(((S)->flags & SDL_RLEACCEL) != 0)
    2.12 @@ -1407,7 +1407,8 @@
    2.13   * \note If RLE is enabled, colorkey and alpha blending blits are much faster,
    2.14   *       but the surface must be locked before directly accessing the pixels.
    2.15   */
    2.16 -extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface *surface, int flag);
    2.17 +extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
    2.18 +                                              int flag);
    2.19  
    2.20  /*
    2.21   * \fn int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key)
    2.22 @@ -1420,7 +1421,8 @@
    2.23   *
    2.24   * \return 0 on success, or -1 if the surface is not valid
    2.25   */
    2.26 -extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key);
    2.27 +extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
    2.28 +                                            Uint32 flag, Uint32 key);
    2.29  
    2.30  /**
    2.31   * \fn int SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)
    2.32 @@ -1436,7 +1438,7 @@
    2.33   *
    2.34   * \sa SDL_GetSurfaceColorMod()
    2.35   */
    2.36 -extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface *surface,
    2.37 +extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
    2.38                                                     Uint8 r, Uint8 g, Uint8 b);
    2.39  
    2.40  
    2.41 @@ -1454,7 +1456,7 @@
    2.42   *
    2.43   * \sa SDL_SetSurfaceColorMod()
    2.44   */
    2.45 -extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface *surface,
    2.46 +extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
    2.47                                                     Uint8 * r, Uint8 * g,
    2.48                                                     Uint8 * b);
    2.49  
    2.50 @@ -1470,7 +1472,7 @@
    2.51   *
    2.52   * \sa SDL_GetSurfaceAlphaMod()
    2.53   */
    2.54 -extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface *surface,
    2.55 +extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
    2.56                                                     Uint8 alpha);
    2.57  
    2.58  /**
    2.59 @@ -1485,7 +1487,7 @@
    2.60   *
    2.61   * \sa SDL_SetSurfaceAlphaMod()
    2.62   */
    2.63 -extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface *surface,
    2.64 +extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
    2.65                                                     Uint8 * alpha);
    2.66  
    2.67  /**
    2.68 @@ -1500,7 +1502,7 @@
    2.69   *
    2.70   * \sa SDL_GetSurfaceBlendMode()
    2.71   */
    2.72 -extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface *surface,
    2.73 +extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
    2.74                                                      int blendMode);
    2.75  
    2.76  /**
    2.77 @@ -1515,7 +1517,7 @@
    2.78   *
    2.79   * \sa SDL_SetSurfaceBlendMode()
    2.80   */
    2.81 -extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface *surface,
    2.82 +extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
    2.83                                                      int *blendMode);
    2.84  
    2.85  /**
    2.86 @@ -1532,7 +1534,7 @@
    2.87   *
    2.88   * \sa SDL_GetSurfaceScaleMode()
    2.89   */
    2.90 -extern DECLSPEC int SDLCALL SDL_SetSurfaceScaleMode(SDL_Surface *surface,
    2.91 +extern DECLSPEC int SDLCALL SDL_SetSurfaceScaleMode(SDL_Surface * surface,
    2.92                                                      int scaleMode);
    2.93  
    2.94  /**
    2.95 @@ -1547,7 +1549,7 @@
    2.96   *
    2.97   * \sa SDL_SetSurfaceScaleMode()
    2.98   */
    2.99 -extern DECLSPEC int SDLCALL SDL_GetSurfaceScaleMode(SDL_Surface *surface,
   2.100 +extern DECLSPEC int SDLCALL SDL_GetSurfaceScaleMode(SDL_Surface * surface,
   2.101                                                      int *scaleMode);
   2.102  
   2.103  /*
     3.1 --- a/src/SDL_compat.c	Sat Aug 18 01:44:21 2007 +0000
     3.2 +++ b/src/SDL_compat.c	Sat Aug 18 05:39:09 2007 +0000
     3.3 @@ -608,7 +608,7 @@
     3.4  SDL_Surface *
     3.5  SDL_DisplayFormat(SDL_Surface * surface)
     3.6  {
     3.7 -    Uint32 flags;
     3.8 +    SDL_Surface *converted;
     3.9  
    3.10      if (!SDL_PublicSurface) {
    3.11          SDL_SetError("No video mode has been set");
    3.12 @@ -616,7 +616,9 @@
    3.13      }
    3.14  
    3.15      /* Set the flags appropriate for copying to display surface */
    3.16 -    return SDL_ConvertSurface(surface, SDL_PublicSurface->format, SDL_RLEACCELOK);
    3.17 +    converted = SDL_ConvertSurface(surface, SDL_PublicSurface->format, 0);
    3.18 +    SDL_SetSurfaceRLE(converted, 1);
    3.19 +    return converted;
    3.20  }
    3.21  
    3.22  SDL_Surface *
    3.23 @@ -625,7 +627,6 @@
    3.24      SDL_PixelFormat *vf;
    3.25      SDL_PixelFormat *format;
    3.26      SDL_Surface *converted;
    3.27 -    Uint32 flags;
    3.28      /* default to ARGB8888 */
    3.29      Uint32 amask = 0xff000000;
    3.30      Uint32 rmask = 0x00ff0000;
    3.31 @@ -666,7 +667,8 @@
    3.32          break;
    3.33      }
    3.34      format = SDL_AllocFormat(32, rmask, gmask, bmask, amask);
    3.35 -    converted = SDL_ConvertSurface(surface, format, SDL_RLEACCELOK);
    3.36 +    converted = SDL_ConvertSurface(surface, format, 0);
    3.37 +    SDL_SetSurfaceRLE(converted, 1);
    3.38      SDL_FreeFormat(format);
    3.39      return converted;
    3.40  }
     4.1 --- a/src/video/SDL_RLEaccel.c	Sat Aug 18 01:44:21 2007 +0000
     4.2 +++ b/src/video/SDL_RLEaccel.c	Sat Aug 18 05:39:09 2007 +0000
     4.3 @@ -1821,13 +1821,13 @@
     4.4  
     4.5      /* If we don't have colorkey or blending, nothing to do... */
     4.6      flags = surface->map->info.flags;
     4.7 -    if(!(flags & (SDL_COPY_COLORKEY|SDL_COPY_BLEND))) {
     4.8 +    if (!(flags & (SDL_COPY_COLORKEY | SDL_COPY_BLEND))) {
     4.9          return -1;
    4.10      }
    4.11  
    4.12      /* Pass on combinations not supported */
    4.13      if ((flags & SDL_COPY_MODULATE_COLOR) ||
    4.14 -        (flags & (SDL_COPY_ADD|SDL_COPY_MOD)) ||
    4.15 +        (flags & (SDL_COPY_ADD | SDL_COPY_MOD)) ||
    4.16          (flags & SDL_COPY_NEAREST)) {
    4.17          return -1;
    4.18      }
    4.19 @@ -1971,7 +1971,8 @@
    4.20                  }
    4.21              }
    4.22          }
    4.23 -        surface->map->info.flags &= (SDL_COPY_RLE_COLORKEY|SDL_COPY_RLE_ALPHAKEY);
    4.24 +        surface->map->info.flags &=
    4.25 +            (SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY);
    4.26  
    4.27          if (surface->map->data) {
    4.28              SDL_free(surface->map->data);
     5.1 --- a/src/video/SDL_blit.c	Sat Aug 18 01:44:21 2007 +0000
     5.2 +++ b/src/video/SDL_blit.c	Sat Aug 18 05:39:09 2007 +0000
     5.3 @@ -71,11 +71,15 @@
     5.4              (Uint16) srcrect->x * info->src_fmt->BytesPerPixel;
     5.5          info->src_w = srcrect->w;
     5.6          info->src_h = srcrect->h;
     5.7 -        info->dst = (Uint8 *) dst->pixels +
     5.8 -            (Uint16) dstrect->y * dst->pitch +
     5.9 +        info->src_skip =
    5.10 +            info->src_pitch - info->src_w * info->src_fmt->BytesPerPixel;
    5.11 +        info->dst =
    5.12 +            (Uint8 *) dst->pixels + (Uint16) dstrect->y * dst->pitch +
    5.13              (Uint16) dstrect->x * info->dst_fmt->BytesPerPixel;
    5.14          info->dst_w = dstrect->w;
    5.15          info->dst_h = dstrect->h;
    5.16 +        info->dst_skip =
    5.17 +            info->dst_pitch - info->dst_w * info->dst_fmt->BytesPerPixel;
    5.18          RunBlit = (SDL_BlitFunc) src->map->data;
    5.19  
    5.20          /* Run the actual software blit */
    5.21 @@ -119,7 +123,8 @@
    5.22  #endif /* __MACOSX__ */
    5.23  
    5.24  static SDL_BlitFunc
    5.25 -SDL_ChooseBlitFunc(Uint32 src_format, Uint32 dst_format, int flags, SDL_BlitFuncEntry * entries)
    5.26 +SDL_ChooseBlitFunc(Uint32 src_format, Uint32 dst_format, int flags,
    5.27 +                   SDL_BlitFuncEntry * entries)
    5.28  {
    5.29      int i, flagcheck;
    5.30      static Uint32 features = 0xffffffff;
    5.31 @@ -166,13 +171,16 @@
    5.32          }
    5.33  
    5.34          /* Check modulation flags */
    5.35 -        flagcheck = (flags & (SDL_COPY_MODULATE_COLOR|SDL_COPY_MODULATE_COLOR));
    5.36 +        flagcheck =
    5.37 +            (flags & (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_COLOR));
    5.38          if ((flagcheck & entries[i].flags) != flagcheck) {
    5.39              continue;
    5.40          }
    5.41  
    5.42          /* Check blend flags */
    5.43 -        flagcheck = (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD));
    5.44 +        flagcheck =
    5.45 +            (flags &
    5.46 +             (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD));
    5.47          if ((flagcheck & entries[i].flags) != flagcheck) {
    5.48              continue;
    5.49          }
    5.50 @@ -208,8 +216,6 @@
    5.51      SDL_BlitFunc blit = NULL;
    5.52      SDL_BlitMap *map = surface->map;
    5.53      SDL_Surface *dst = map->dst;
    5.54 -    Uint32 src_format;
    5.55 -    Uint32 dst_format;
    5.56  
    5.57      /* Clean everything out to start */
    5.58      if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) {
    5.59 @@ -222,16 +228,13 @@
    5.60      map->info.dst_pitch = dst->pitch;
    5.61  
    5.62      /* See if we can do RLE acceleration */
    5.63 -    if (surface->flags & SDL_RLEACCELOK) {
    5.64 +    if (surface->map->info.flags & SDL_COPY_RLE_DESIRED) {
    5.65          if (SDL_RLESurface(surface) == 0) {
    5.66              return 0;
    5.67          }
    5.68      }
    5.69  
    5.70      /* Choose a standard blit function */
    5.71 -    src_format = SDL_MasksToPixelFormatEnum(surface->format->BitsPerPixel, surface->format->Rmask, surface->format->Gmask, surface->format->Bmask, surface->format->Amask);
    5.72 -    dst_format = SDL_MasksToPixelFormatEnum(dst->format->BitsPerPixel, dst->format->Rmask, dst->format->Gmask, dst->format->Bmask, dst->format->Amask);
    5.73 -
    5.74      if (map->identity && !map->info.flags) {
    5.75          /* Handle overlapping blits on the same surface */
    5.76          if (surface == dst) {
    5.77 @@ -240,15 +243,32 @@
    5.78              blit = SDL_BlitCopy;
    5.79          }
    5.80      } else if (surface->format->BitsPerPixel < 8) {
    5.81 -        blit = SDL_ChooseBlitFunc(src_format, dst_format, map->info.flags, SDL_BlitFuncTable0);
    5.82 +        blit = SDL_CalculateBlit0(surface);
    5.83      } else if (surface->format->BytesPerPixel == 1) {
    5.84 -        blit = SDL_ChooseBlitFunc(src_format, dst_format, map->info.flags, SDL_BlitFuncTable1);
    5.85 +        blit = SDL_CalculateBlit1(surface);
    5.86 +    } else if (map->info.flags & SDL_COPY_BLEND) {
    5.87 +        blit = SDL_CalculateBlitA(surface);
    5.88      } else {
    5.89 -        blit = SDL_ChooseBlitFunc(src_format, dst_format, map->info.flags, SDL_BlitFuncTableN);
    5.90 +        blit = SDL_CalculateBlitN(surface);
    5.91      }
    5.92      if (blit == NULL) {
    5.93 -        blit = SDL_ChooseBlitFunc(src_format, dst_format, map->info.flags, SDL_GeneratedBlitFuncTable);
    5.94 +        Uint32 src_format =
    5.95 +            SDL_MasksToPixelFormatEnum(surface->format->BitsPerPixel,
    5.96 +                                       surface->format->Rmask,
    5.97 +                                       surface->format->Gmask,
    5.98 +                                       surface->format->Bmask,
    5.99 +                                       surface->format->Amask);
   5.100 +        Uint32 dst_format =
   5.101 +            SDL_MasksToPixelFormatEnum(dst->format->BitsPerPixel,
   5.102 +                                       dst->format->Rmask, dst->format->Gmask,
   5.103 +                                       dst->format->Bmask,
   5.104 +                                       dst->format->Amask);
   5.105 +
   5.106 +        blit =
   5.107 +            SDL_ChooseBlitFunc(src_format, dst_format, map->info.flags,
   5.108 +                               SDL_GeneratedBlitFuncTable);
   5.109      }
   5.110 +    map->data = blit;
   5.111  
   5.112      /* Make sure we have a blit function */
   5.113      if (blit == NULL) {
     6.1 --- a/src/video/SDL_blit.h	Sat Aug 18 01:44:21 2007 +0000
     6.2 +++ b/src/video/SDL_blit.h	Sat Aug 18 05:39:09 2007 +0000
     6.3 @@ -62,13 +62,16 @@
     6.4  #define SDL_CPU_ALTIVEC_PREFETCH    0x00000010
     6.5  #define SDL_CPU_ALTIVEC_NOPREFETCH  0x00000020
     6.6  
     6.7 -typedef struct {
     6.8 +typedef struct
     6.9 +{
    6.10      Uint8 *src;
    6.11      int src_w, src_h;
    6.12      int src_pitch;
    6.13 +    int src_skip;
    6.14      Uint8 *dst;
    6.15      int dst_w, dst_h;
    6.16      int dst_pitch;
    6.17 +    int dst_skip;
    6.18      SDL_PixelFormat *src_fmt;
    6.19      SDL_PixelFormat *dst_fmt;
    6.20      Uint8 *table;
    6.21 @@ -77,9 +80,10 @@
    6.22      Uint8 r, g, b, a;
    6.23  } SDL_BlitInfo;
    6.24  
    6.25 -typedef void (SDLCALL * SDL_BlitFunc)(SDL_BlitInfo *info);
    6.26 +typedef void (SDLCALL * SDL_BlitFunc) (SDL_BlitInfo * info);
    6.27  
    6.28 -typedef struct {
    6.29 +typedef struct
    6.30 +{
    6.31      Uint32 src_format;
    6.32      Uint32 dst_format;
    6.33      int flags;
    6.34 @@ -104,10 +108,11 @@
    6.35  /* Functions found in SDL_blit.c */
    6.36  extern int SDL_CalculateBlit(SDL_Surface * surface);
    6.37  
    6.38 -/* Blit function tables in SDL_blit_*.c */
    6.39 -extern SDL_BlitFuncEntry SDL_BlitFuncTable0[];
    6.40 -extern SDL_BlitFuncEntry SDL_BlitFuncTable1[];
    6.41 -extern SDL_BlitFuncEntry SDL_BlitFuncTableN[];
    6.42 +/* Functions found in SDL_blit_*.c */
    6.43 +extern SDL_BlitFunc SDL_CalculateBlit0(SDL_Surface * surface);
    6.44 +extern SDL_BlitFunc SDL_CalculateBlit1(SDL_Surface * surface);
    6.45 +extern SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface * surface);
    6.46 +extern SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface * surface);
    6.47  
    6.48  /*
    6.49   * Useful macros for blitting routines
     7.1 --- a/src/video/SDL_blit_0.c	Sat Aug 18 01:44:21 2007 +0000
     7.2 +++ b/src/video/SDL_blit_0.c	Sat Aug 18 05:39:09 2007 +0000
     7.3 @@ -38,9 +38,9 @@
     7.4      width = info->dst_w;
     7.5      height = info->dst_h;
     7.6      src = info->src;
     7.7 -    srcskip = info->s_skip;
     7.8 +    srcskip = info->src_skip;
     7.9      dst = info->dst;
    7.10 -    dstskip = info->dst_pitch;
    7.11 +    dstskip = info->dst_skip;
    7.12      map = info->table;
    7.13      srcskip += width - (width + 7) / 8;
    7.14  
    7.15 @@ -93,9 +93,9 @@
    7.16      width = info->dst_w;
    7.17      height = info->dst_h;
    7.18      src = info->src;
    7.19 -    srcskip = info->s_skip;
    7.20 +    srcskip = info->src_skip;
    7.21      dst = (Uint16 *) info->dst;
    7.22 -    dstskip = info->dst_pitch / 2;
    7.23 +    dstskip = info->dst_skip / 2;
    7.24      map = (Uint16 *) info->table;
    7.25      srcskip += width - (width + 7) / 8;
    7.26  
    7.27 @@ -128,9 +128,9 @@
    7.28      width = info->dst_w;
    7.29      height = info->dst_h;
    7.30      src = info->src;
    7.31 -    srcskip = info->s_skip;
    7.32 +    srcskip = info->src_skip;
    7.33      dst = info->dst;
    7.34 -    dstskip = info->dst_pitch;
    7.35 +    dstskip = info->dst_skip;
    7.36      map = info->table;
    7.37      srcskip += width - (width + 7) / 8;
    7.38  
    7.39 @@ -167,9 +167,9 @@
    7.40      width = info->dst_w;
    7.41      height = info->dst_h;
    7.42      src = info->src;
    7.43 -    srcskip = info->s_skip;
    7.44 +    srcskip = info->src_skip;
    7.45      dst = (Uint32 *) info->dst;
    7.46 -    dstskip = info->dst_pitch / 4;
    7.47 +    dstskip = info->dst_skip / 4;
    7.48      map = (Uint32 *) info->table;
    7.49      srcskip += width - (width + 7) / 8;
    7.50  
    7.51 @@ -198,9 +198,9 @@
    7.52      int height = info->dst_h;
    7.53      Uint8 *src = info->src;
    7.54      Uint8 *dst = info->dst;
    7.55 -    int srcskip = info->s_skip;
    7.56 -    int dstskip = info->dst_pitch;
    7.57 -    Uint32 ckey = info->ckey;
    7.58 +    int srcskip = info->src_skip;
    7.59 +    int dstskip = info->dst_skip;
    7.60 +    Uint32 ckey = info->colorkey;
    7.61      Uint8 *palmap = info->table;
    7.62      int c;
    7.63  
    7.64 @@ -251,9 +251,9 @@
    7.65      int height = info->dst_h;
    7.66      Uint8 *src = info->src;
    7.67      Uint16 *dstp = (Uint16 *) info->dst;
    7.68 -    int srcskip = info->s_skip;
    7.69 -    int dstskip = info->dst_pitch;
    7.70 -    Uint32 ckey = info->ckey;
    7.71 +    int srcskip = info->src_skip;
    7.72 +    int dstskip = info->dst_skip;
    7.73 +    Uint32 ckey = info->colorkey;
    7.74      Uint8 *palmap = info->table;
    7.75      int c;
    7.76  
    7.77 @@ -286,9 +286,9 @@
    7.78      int height = info->dst_h;
    7.79      Uint8 *src = info->src;
    7.80      Uint8 *dst = info->dst;
    7.81 -    int srcskip = info->s_skip;
    7.82 -    int dstskip = info->dst_pitch;
    7.83 -    Uint32 ckey = info->ckey;
    7.84 +    int srcskip = info->src_skip;
    7.85 +    int dstskip = info->dst_skip;
    7.86 +    Uint32 ckey = info->colorkey;
    7.87      Uint8 *palmap = info->table;
    7.88      int c;
    7.89  
    7.90 @@ -320,9 +320,9 @@
    7.91      int height = info->dst_h;
    7.92      Uint8 *src = info->src;
    7.93      Uint32 *dstp = (Uint32 *) info->dst;
    7.94 -    int srcskip = info->s_skip;
    7.95 -    int dstskip = info->dst_pitch;
    7.96 -    Uint32 ckey = info->ckey;
    7.97 +    int srcskip = info->src_skip;
    7.98 +    int dstskip = info->dst_skip;
    7.99 +    Uint32 ckey = info->colorkey;
   7.100      Uint8 *palmap = info->table;
   7.101      int c;
   7.102  
   7.103 @@ -355,13 +355,13 @@
   7.104      int height = info->dst_h;
   7.105      Uint8 *src = info->src;
   7.106      Uint8 *dst = info->dst;
   7.107 -    int srcskip = info->s_skip;
   7.108 -    int dstskip = info->dst_pitch;
   7.109 -    const SDL_Color *srcpal = info->src->palette->colors;
   7.110 -    SDL_PixelFormat *dstfmt = info->dst;
   7.111 +    int srcskip = info->src_skip;
   7.112 +    int dstskip = info->dst_skip;
   7.113 +    const SDL_Color *srcpal = info->src_fmt->palette->colors;
   7.114 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   7.115      int dstbpp;
   7.116      int c;
   7.117 -    const int A = (info->cmod >> 24);
   7.118 +    const int A = info->a;
   7.119  
   7.120      /* Set up some basic variables */
   7.121      dstbpp = dstfmt->BytesPerPixel;
   7.122 @@ -400,15 +400,15 @@
   7.123      int height = info->dst_h;
   7.124      Uint8 *src = info->src;
   7.125      Uint8 *dst = info->dst;
   7.126 -    int srcskip = info->s_skip;
   7.127 -    int dstskip = info->dst_pitch;
   7.128 -    SDL_PixelFormat *srcfmt = info->src;
   7.129 -    SDL_PixelFormat *dstfmt = info->dst;
   7.130 +    int srcskip = info->src_skip;
   7.131 +    int dstskip = info->dst_skip;
   7.132 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   7.133 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   7.134      const SDL_Color *srcpal = srcfmt->palette->colors;
   7.135      int dstbpp;
   7.136      int c;
   7.137 -    const int A = (info->cmod >> 24);
   7.138 -    Uint32 ckey = info->ckey;
   7.139 +    const int A = info->a;
   7.140 +    Uint32 ckey = info->colorkey;
   7.141  
   7.142      /* Set up some basic variables */
   7.143      dstbpp = dstfmt->BytesPerPixel;
   7.144 @@ -440,16 +440,16 @@
   7.145      }
   7.146  }
   7.147  
   7.148 -static SDL_loblit bitmap_blit[] = {
   7.149 +static SDL_BlitFunc bitmap_blit[] = {
   7.150      NULL, BlitBto1, BlitBto2, BlitBto3, BlitBto4
   7.151  };
   7.152  
   7.153 -static SDL_loblit colorkey_blit[] = {
   7.154 +static SDL_BlitFunc colorkey_blit[] = {
   7.155      NULL, BlitBto1Key, BlitBto2Key, BlitBto3Key, BlitBto4Key
   7.156  };
   7.157  
   7.158 -SDL_loblit
   7.159 -SDL_CalculateBlit0(SDL_Surface * surface, int blit_index)
   7.160 +SDL_BlitFunc
   7.161 +SDL_CalculateBlit0(SDL_Surface * surface)
   7.162  {
   7.163      int which;
   7.164  
   7.165 @@ -462,17 +462,17 @@
   7.166      } else {
   7.167          which = surface->map->dst->format->BytesPerPixel;
   7.168      }
   7.169 -    switch (blit_index) {
   7.170 -    case 0:                    /* copy */
   7.171 +    switch (surface->map->info.flags) {
   7.172 +    case 0:
   7.173          return bitmap_blit[which];
   7.174  
   7.175 -    case 1:                    /* colorkey */
   7.176 +    case SDL_COPY_COLORKEY:
   7.177          return colorkey_blit[which];
   7.178  
   7.179 -    case 2:                    /* alpha */
   7.180 +    case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
   7.181          return which >= 2 ? BlitBtoNAlpha : NULL;
   7.182  
   7.183 -    case 4:                    /* alpha + colorkey */
   7.184 +    case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
   7.185          return which >= 2 ? BlitBtoNAlphaKey : NULL;
   7.186      }
   7.187      return NULL;
     8.1 --- a/src/video/SDL_blit_1.c	Sat Aug 18 01:44:21 2007 +0000
     8.2 +++ b/src/video/SDL_blit_1.c	Sat Aug 18 05:39:09 2007 +0000
     8.3 @@ -42,9 +42,9 @@
     8.4      width = info->dst_w;
     8.5      height = info->dst_h;
     8.6      src = info->src;
     8.7 -    srcskip = info->s_skip;
     8.8 +    srcskip = info->src_skip;
     8.9      dst = info->dst;
    8.10 -    dstskip = info->dst_pitch;
    8.11 +    dstskip = info->dst_skip;
    8.12      map = info->table;
    8.13  
    8.14      while (height--) {
    8.15 @@ -93,9 +93,9 @@
    8.16      width = info->dst_w;
    8.17      height = info->dst_h;
    8.18      src = info->src;
    8.19 -    srcskip = info->s_skip;
    8.20 +    srcskip = info->src_skip;
    8.21      dst = info->dst;
    8.22 -    dstskip = info->dst_pitch;
    8.23 +    dstskip = info->dst_skip;
    8.24      map = (Uint16 *) info->table;
    8.25  
    8.26  #ifdef USE_DUFFS_LOOP
    8.27 @@ -199,9 +199,9 @@
    8.28      width = info->dst_w;
    8.29      height = info->dst_h;
    8.30      src = info->src;
    8.31 -    srcskip = info->s_skip;
    8.32 +    srcskip = info->src_skip;
    8.33      dst = info->dst;
    8.34 -    dstskip = info->dst_pitch;
    8.35 +    dstskip = info->dst_skip;
    8.36      map = info->table;
    8.37  
    8.38      while (height--) {
    8.39 @@ -247,9 +247,9 @@
    8.40      width = info->dst_w;
    8.41      height = info->dst_h;
    8.42      src = info->src;
    8.43 -    srcskip = info->s_skip;
    8.44 +    srcskip = info->src_skip;
    8.45      dst = (Uint32 *) info->dst;
    8.46 -    dstskip = info->dst_pitch / 4;
    8.47 +    dstskip = info->dst_skip / 4;
    8.48      map = (Uint32 *) info->table;
    8.49  
    8.50      while (height--) {
    8.51 @@ -286,11 +286,11 @@
    8.52      int width = info->dst_w;
    8.53      int height = info->dst_h;
    8.54      Uint8 *src = info->src;
    8.55 -    int srcskip = info->s_skip;
    8.56 +    int srcskip = info->src_skip;
    8.57      Uint8 *dst = info->dst;
    8.58 -    int dstskip = info->dst_pitch;
    8.59 +    int dstskip = info->dst_skip;
    8.60      Uint8 *palmap = info->table;
    8.61 -    Uint32 ckey = info->ckey;
    8.62 +    Uint32 ckey = info->colorkey;
    8.63  
    8.64      if (palmap) {
    8.65          while (height--) {
    8.66 @@ -333,11 +333,11 @@
    8.67      int width = info->dst_w;
    8.68      int height = info->dst_h;
    8.69      Uint8 *src = info->src;
    8.70 -    int srcskip = info->s_skip;
    8.71 +    int srcskip = info->src_skip;
    8.72      Uint16 *dstp = (Uint16 *) info->dst;
    8.73 -    int dstskip = info->dst_pitch;
    8.74 +    int dstskip = info->dst_skip;
    8.75      Uint16 *palmap = (Uint16 *) info->table;
    8.76 -    Uint32 ckey = info->ckey;
    8.77 +    Uint32 ckey = info->colorkey;
    8.78  
    8.79      /* Set up some basic variables */
    8.80      dstskip /= 2;
    8.81 @@ -365,11 +365,11 @@
    8.82      int width = info->dst_w;
    8.83      int height = info->dst_h;
    8.84      Uint8 *src = info->src;
    8.85 -    int srcskip = info->s_skip;
    8.86 +    int srcskip = info->src_skip;
    8.87      Uint8 *dst = info->dst;
    8.88 -    int dstskip = info->dst_pitch;
    8.89 +    int dstskip = info->dst_skip;
    8.90      Uint8 *palmap = info->table;
    8.91 -    Uint32 ckey = info->ckey;
    8.92 +    Uint32 ckey = info->colorkey;
    8.93      int o;
    8.94  
    8.95      while (height--) {
    8.96 @@ -398,11 +398,11 @@
    8.97      int width = info->dst_w;
    8.98      int height = info->dst_h;
    8.99      Uint8 *src = info->src;
   8.100 -    int srcskip = info->s_skip;
   8.101 +    int srcskip = info->src_skip;
   8.102      Uint32 *dstp = (Uint32 *) info->dst;
   8.103 -    int dstskip = info->dst_pitch;
   8.104 +    int dstskip = info->dst_skip;
   8.105      Uint32 *palmap = (Uint32 *) info->table;
   8.106 -    Uint32 ckey = info->ckey;
   8.107 +    Uint32 ckey = info->colorkey;
   8.108  
   8.109      /* Set up some basic variables */
   8.110      dstskip /= 4;
   8.111 @@ -430,13 +430,13 @@
   8.112      int width = info->dst_w;
   8.113      int height = info->dst_h;
   8.114      Uint8 *src = info->src;
   8.115 -    int srcskip = info->s_skip;
   8.116 +    int srcskip = info->src_skip;
   8.117      Uint8 *dst = info->dst;
   8.118 -    int dstskip = info->dst_pitch;
   8.119 -    SDL_PixelFormat *dstfmt = info->dst;
   8.120 -    const SDL_Color *srcpal = info->src->palette->colors;
   8.121 +    int dstskip = info->dst_skip;
   8.122 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   8.123 +    const SDL_Color *srcpal = info->src_fmt->palette->colors;
   8.124      int dstbpp;
   8.125 -    const int A = (info->cmod >> 24);
   8.126 +    const int A = info->a;
   8.127  
   8.128      /* Set up some basic variables */
   8.129      dstbpp = dstfmt->BytesPerPixel;
   8.130 @@ -471,15 +471,15 @@
   8.131      int width = info->dst_w;
   8.132      int height = info->dst_h;
   8.133      Uint8 *src = info->src;
   8.134 -    int srcskip = info->s_skip;
   8.135 +    int srcskip = info->src_skip;
   8.136      Uint8 *dst = info->dst;
   8.137 -    int dstskip = info->dst_pitch;
   8.138 -    SDL_PixelFormat *srcfmt = info->src;
   8.139 -    SDL_PixelFormat *dstfmt = info->dst;
   8.140 -    const SDL_Color *srcpal = info->src->palette->colors;
   8.141 -    Uint32 ckey = info->ckey;
   8.142 +    int dstskip = info->dst_skip;
   8.143 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   8.144 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   8.145 +    const SDL_Color *srcpal = info->src_fmt->palette->colors;
   8.146 +    Uint32 ckey = info->colorkey;
   8.147      int dstbpp;
   8.148 -    const int A = (info->cmod >> 24);
   8.149 +    const int A = info->a;
   8.150  
   8.151      /* Set up some basic variables */
   8.152      dstbpp = dstfmt->BytesPerPixel;
   8.153 @@ -510,16 +510,16 @@
   8.154      }
   8.155  }
   8.156  
   8.157 -static SDL_loblit one_blit[] = {
   8.158 +static SDL_BlitFunc one_blit[] = {
   8.159      NULL, Blit1to1, Blit1to2, Blit1to3, Blit1to4
   8.160  };
   8.161  
   8.162 -static SDL_loblit one_blitkey[] = {
   8.163 +static SDL_BlitFunc one_blitkey[] = {
   8.164      NULL, Blit1to1Key, Blit1to2Key, Blit1to3Key, Blit1to4Key
   8.165  };
   8.166  
   8.167 -SDL_loblit
   8.168 -SDL_CalculateBlit1(SDL_Surface * surface, int blit_index)
   8.169 +SDL_BlitFunc
   8.170 +SDL_CalculateBlit1(SDL_Surface * surface)
   8.171  {
   8.172      int which;
   8.173      SDL_PixelFormat *dstfmt;
   8.174 @@ -530,22 +530,21 @@
   8.175      } else {
   8.176          which = dstfmt->BytesPerPixel;
   8.177      }
   8.178 -    switch (blit_index) {
   8.179 -    case 0:                    /* copy */
   8.180 +    switch (surface->map->info.flags) {
   8.181 +    case 0:
   8.182          return one_blit[which];
   8.183  
   8.184 -    case 1:                    /* colorkey */
   8.185 +    case SDL_COPY_COLORKEY:
   8.186          return one_blitkey[which];
   8.187  
   8.188 -    case 2:                    /* alpha */
   8.189 +    case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
   8.190          /* Supporting 8bpp->8bpp alpha is doable but requires lots of
   8.191             tables which consume space and takes time to precompute,
   8.192             so is better left to the user */
   8.193          return which >= 2 ? Blit1toNAlpha : NULL;
   8.194  
   8.195 -    case 3:                    /* alpha + colorkey */
   8.196 +    case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
   8.197          return which >= 2 ? Blit1toNAlphaKey : NULL;
   8.198 -
   8.199      }
   8.200      return NULL;
   8.201  }
     9.1 --- a/src/video/SDL_blit_A.c	Sat Aug 18 01:44:21 2007 +0000
     9.2 +++ b/src/video/SDL_blit_A.c	Sat Aug 18 05:39:09 2007 +0000
     9.3 @@ -33,15 +33,15 @@
     9.4      int width = info->dst_w;
     9.5      int height = info->dst_h;
     9.6      Uint8 *src = info->src;
     9.7 -    int srcskip = info->s_skip;
     9.8 +    int srcskip = info->src_skip;
     9.9      Uint8 *dst = info->dst;
    9.10 -    int dstskip = info->dst_pitch;
    9.11 +    int dstskip = info->dst_skip;
    9.12      Uint8 *palmap = info->table;
    9.13 -    SDL_PixelFormat *srcfmt = info->src;
    9.14 -    SDL_PixelFormat *dstfmt = info->dst;
    9.15 +    SDL_PixelFormat *srcfmt = info->src_fmt;
    9.16 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
    9.17      int srcbpp = srcfmt->BytesPerPixel;
    9.18  
    9.19 -    const unsigned A = (info->cmod >> 24);
    9.20 +    const unsigned A = info->a;
    9.21  
    9.22      while (height--) {
    9.23  	    /* *INDENT-OFF* */
    9.24 @@ -89,12 +89,12 @@
    9.25      int width = info->dst_w;
    9.26      int height = info->dst_h;
    9.27      Uint8 *src = info->src;
    9.28 -    int srcskip = info->s_skip;
    9.29 +    int srcskip = info->src_skip;
    9.30      Uint8 *dst = info->dst;
    9.31 -    int dstskip = info->dst_pitch;
    9.32 +    int dstskip = info->dst_skip;
    9.33      Uint8 *palmap = info->table;
    9.34 -    SDL_PixelFormat *srcfmt = info->src;
    9.35 -    SDL_PixelFormat *dstfmt = info->dst;
    9.36 +    SDL_PixelFormat *srcfmt = info->src_fmt;
    9.37 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
    9.38      int srcbpp = srcfmt->BytesPerPixel;
    9.39  
    9.40      /* FIXME: fix alpha bit field expansion here too? */
    9.41 @@ -145,16 +145,16 @@
    9.42      int width = info->dst_w;
    9.43      int height = info->dst_h;
    9.44      Uint8 *src = info->src;
    9.45 -    int srcskip = info->s_skip;
    9.46 +    int srcskip = info->src_skip;
    9.47      Uint8 *dst = info->dst;
    9.48 -    int dstskip = info->dst_pitch;
    9.49 +    int dstskip = info->dst_skip;
    9.50      Uint8 *palmap = info->table;
    9.51 -    SDL_PixelFormat *srcfmt = info->src;
    9.52 -    SDL_PixelFormat *dstfmt = info->dst;
    9.53 +    SDL_PixelFormat *srcfmt = info->src_fmt;
    9.54 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
    9.55      int srcbpp = srcfmt->BytesPerPixel;
    9.56 -    Uint32 ckey = info->ckey;
    9.57 +    Uint32 ckey = info->colorkey;
    9.58  
    9.59 -    const int A = (info->cmod >> 24);
    9.60 +    const int A = info->a;
    9.61  
    9.62      while (height--) {
    9.63  	    /* *INDENT-OFF* */
    9.64 @@ -206,10 +206,10 @@
    9.65      int width = info->dst_w;
    9.66      int height = info->dst_h;
    9.67      Uint32 *srcp = (Uint32 *) info->src;
    9.68 -    int srcskip = info->s_skip >> 2;
    9.69 +    int srcskip = info->src_skip >> 2;
    9.70      Uint32 *dstp = (Uint32 *) info->dst;
    9.71 -    int dstskip = info->dst_pitch >> 2;
    9.72 -    Uint32 dalpha = info->dst->Amask;
    9.73 +    int dstskip = info->dst_skip >> 2;
    9.74 +    Uint32 dalpha = info->dst_fmt->Amask;
    9.75  
    9.76      __m64 src1, src2, dst1, dst2, lmask, hmask, dsta;
    9.77  
    9.78 @@ -259,9 +259,9 @@
    9.79  static void
    9.80  BlitRGBtoRGBSurfaceAlphaMMX(SDL_BlitInfo * info)
    9.81  {
    9.82 -    SDL_PixelFormat *df = info->dst;
    9.83 +    SDL_PixelFormat *df = info->dst_fmt;
    9.84      Uint32 chanmask = df->Rmask | df->Gmask | df->Bmask;
    9.85 -    unsigned alpha = (info->cmod >> 24);
    9.86 +    unsigned alpha = info->a;
    9.87  
    9.88      if (alpha == 128 && (df->Rmask | df->Gmask | df->Bmask) == 0x00FFFFFF) {
    9.89          /* only call a128 version when R,G,B occupy lower bits */
    9.90 @@ -270,9 +270,9 @@
    9.91          int width = info->dst_w;
    9.92          int height = info->dst_h;
    9.93          Uint32 *srcp = (Uint32 *) info->src;
    9.94 -        int srcskip = info->s_skip >> 2;
    9.95 +        int srcskip = info->src_skip >> 2;
    9.96          Uint32 *dstp = (Uint32 *) info->dst;
    9.97 -        int dstskip = info->dst_pitch >> 2;
    9.98 +        int dstskip = info->dst_skip >> 2;
    9.99          Uint32 dalpha = df->Amask;
   9.100          Uint32 amult;
   9.101  
   9.102 @@ -359,10 +359,10 @@
   9.103      int width = info->dst_w;
   9.104      int height = info->dst_h;
   9.105      Uint32 *srcp = (Uint32 *) info->src;
   9.106 -    int srcskip = info->s_skip >> 2;
   9.107 +    int srcskip = info->src_skip >> 2;
   9.108      Uint32 *dstp = (Uint32 *) info->dst;
   9.109 -    int dstskip = info->dst_pitch >> 2;
   9.110 -    SDL_PixelFormat *sf = info->src;
   9.111 +    int dstskip = info->dst_skip >> 2;
   9.112 +    SDL_PixelFormat *sf = info->src_fmt;
   9.113      Uint32 chanmask = sf->Rmask | sf->Gmask | sf->Bmask;
   9.114      Uint32 amask = sf->Amask;
   9.115      Uint32 ashift = sf->Ashift;
   9.116 @@ -544,10 +544,10 @@
   9.117  {
   9.118      int height = info->dst_h;
   9.119      Uint8 *src = (Uint8 *) info->src;
   9.120 -    int srcskip = info->s_skip;
   9.121 +    int srcskip = info->src_skip;
   9.122      Uint8 *dst = (Uint8 *) info->dst;
   9.123 -    int dstskip = info->dst_pitch;
   9.124 -    SDL_PixelFormat *srcfmt = info->src;
   9.125 +    int dstskip = info->dst_skip;
   9.126 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   9.127  
   9.128      vector unsigned char v0 = vec_splat_u8(0);
   9.129      vector unsigned short v8_16 = vec_splat_u16(8);
   9.130 @@ -720,15 +720,15 @@
   9.131  {
   9.132      int height = info->dst_h;
   9.133      Uint32 *srcp = (Uint32 *) info->src;
   9.134 -    int srcskip = info->s_skip >> 2;
   9.135 +    int srcskip = info->src_skip >> 2;
   9.136      Uint32 *dstp = (Uint32 *) info->dst;
   9.137 -    int dstskip = info->dst_pitch >> 2;
   9.138 -    SDL_PixelFormat *srcfmt = info->src;
   9.139 -    SDL_PixelFormat *dstfmt = info->dst;
   9.140 -    unsigned sA = (info->cmod >> 24);
   9.141 +    int dstskip = info->dst_skip >> 2;
   9.142 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   9.143 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   9.144 +    unsigned sA = info->a;
   9.145      unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
   9.146      Uint32 rgbmask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
   9.147 -    Uint32 ckey = info->ckey;
   9.148 +    Uint32 ckey = info->colorkey;
   9.149      vector unsigned char mergePermute;
   9.150      vector unsigned char vsrcPermute;
   9.151      vector unsigned char vdstPermute;
   9.152 @@ -847,11 +847,11 @@
   9.153      int width = info->dst_w;
   9.154      int height = info->dst_h;
   9.155      Uint32 *srcp = (Uint32 *) info->src;
   9.156 -    int srcskip = info->s_skip >> 2;
   9.157 +    int srcskip = info->src_skip >> 2;
   9.158      Uint32 *dstp = (Uint32 *) info->dst;
   9.159 -    int dstskip = info->dst_pitch >> 2;
   9.160 -    SDL_PixelFormat *srcfmt = info->src;
   9.161 -    SDL_PixelFormat *dstfmt = info->dst;
   9.162 +    int dstskip = info->dst_skip >> 2;
   9.163 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   9.164 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   9.165      vector unsigned char mergePermute;
   9.166      vector unsigned char valphaPermute;
   9.167      vector unsigned char vsrcPermute;
   9.168 @@ -945,9 +945,9 @@
   9.169      int width = info->dst_w;
   9.170      int height = info->dst_h;
   9.171      Uint32 *srcp = (Uint32 *) info->src;
   9.172 -    int srcskip = info->s_skip >> 2;
   9.173 +    int srcskip = info->src_skip >> 2;
   9.174      Uint32 *dstp = (Uint32 *) info->dst;
   9.175 -    int dstskip = info->dst_pitch >> 2;
   9.176 +    int dstskip = info->dst_skip >> 2;
   9.177      vector unsigned char mergePermute;
   9.178      vector unsigned char valphaPermute;
   9.179      vector unsigned char valphamask;
   9.180 @@ -1042,12 +1042,12 @@
   9.181      /* XXX : 6 */
   9.182      int height = info->dst_h;
   9.183      Uint32 *srcp = (Uint32 *) info->src;
   9.184 -    int srcskip = info->s_skip >> 2;
   9.185 +    int srcskip = info->src_skip >> 2;
   9.186      Uint32 *dstp = (Uint32 *) info->dst;
   9.187 -    int dstskip = info->dst_pitch >> 2;
   9.188 -    SDL_PixelFormat *srcfmt = info->src;
   9.189 -    SDL_PixelFormat *dstfmt = info->dst;
   9.190 -    unsigned sA = (info->cmod >> 24);
   9.191 +    int dstskip = info->dst_skip >> 2;
   9.192 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   9.193 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   9.194 +    unsigned sA = info->a;
   9.195      unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
   9.196      vector unsigned char mergePermute;
   9.197      vector unsigned char vsrcPermute;
   9.198 @@ -1136,12 +1136,12 @@
   9.199  static void
   9.200  BlitRGBtoRGBSurfaceAlphaAltivec(SDL_BlitInfo * info)
   9.201  {
   9.202 -    unsigned alpha = (info->cmod >> 24);
   9.203 +    unsigned alpha = info->a;
   9.204      int height = info->dst_h;
   9.205      Uint32 *srcp = (Uint32 *) info->src;
   9.206 -    int srcskip = info->s_skip >> 2;
   9.207 +    int srcskip = info->src_skip >> 2;
   9.208      Uint32 *dstp = (Uint32 *) info->dst;
   9.209 -    int dstskip = info->dst_pitch >> 2;
   9.210 +    int dstskip = info->dst_skip >> 2;
   9.211      vector unsigned char mergePermute;
   9.212      vector unsigned char valpha;
   9.213      vector unsigned char valphamask;
   9.214 @@ -1227,9 +1227,9 @@
   9.215      int width = info->dst_w;
   9.216      int height = info->dst_h;
   9.217      Uint32 *srcp = (Uint32 *) info->src;
   9.218 -    int srcskip = info->s_skip >> 2;
   9.219 +    int srcskip = info->src_skip >> 2;
   9.220      Uint32 *dstp = (Uint32 *) info->dst;
   9.221 -    int dstskip = info->dst_pitch >> 2;
   9.222 +    int dstskip = info->dst_skip >> 2;
   9.223  
   9.224      while (height--) {
   9.225  	    /* *INDENT-OFF* */
   9.226 @@ -1249,16 +1249,16 @@
   9.227  static void
   9.228  BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo * info)
   9.229  {
   9.230 -    unsigned alpha = (info->cmod >> 24);
   9.231 +    unsigned alpha = info->a;
   9.232      if (alpha == 128) {
   9.233          BlitRGBtoRGBSurfaceAlpha128(info);
   9.234      } else {
   9.235          int width = info->dst_w;
   9.236          int height = info->dst_h;
   9.237          Uint32 *srcp = (Uint32 *) info->src;
   9.238 -        int srcskip = info->s_skip >> 2;
   9.239 +        int srcskip = info->src_skip >> 2;
   9.240          Uint32 *dstp = (Uint32 *) info->dst;
   9.241 -        int dstskip = info->dst_pitch >> 2;
   9.242 +        int dstskip = info->dst_skip >> 2;
   9.243          Uint32 s;
   9.244          Uint32 d;
   9.245          Uint32 s1;
   9.246 @@ -1324,9 +1324,9 @@
   9.247      int width = info->dst_w;
   9.248      int height = info->dst_h;
   9.249      Uint32 *srcp = (Uint32 *) info->src;
   9.250 -    int srcskip = info->s_skip >> 2;
   9.251 +    int srcskip = info->src_skip >> 2;
   9.252      Uint32 *dstp = (Uint32 *) info->dst;
   9.253 -    int dstskip = info->dst_pitch >> 2;
   9.254 +    int dstskip = info->dst_skip >> 2;
   9.255  
   9.256      while (height--) {
   9.257  	    /* *INDENT-OFF* */
   9.258 @@ -1377,10 +1377,10 @@
   9.259      int width = info->dst_w;
   9.260      int height = info->dst_h;
   9.261      Uint32 *srcp = (Uint32 *) info->src;
   9.262 -    int srcskip = info->s_skip >> 2;
   9.263 +    int srcskip = info->src_skip >> 2;
   9.264      Uint32 *dstp = (Uint32 *) info->dst;
   9.265 -    int dstskip = info->dst_pitch >> 2;
   9.266 -    SDL_PixelFormat *sf = info->src;
   9.267 +    int dstskip = info->dst_skip >> 2;
   9.268 +    SDL_PixelFormat *sf = info->src_fmt;
   9.269      Uint32 chanmask = sf->Rmask | sf->Gmask | sf->Bmask;
   9.270      Uint32 amask = sf->Amask;
   9.271      Uint32 ashift = sf->Ashift;
   9.272 @@ -1459,9 +1459,9 @@
   9.273      int width = info->dst_w;
   9.274      int height = info->dst_h;
   9.275      Uint16 *srcp = (Uint16 *) info->src;
   9.276 -    int srcskip = info->s_skip >> 1;
   9.277 +    int srcskip = info->src_skip >> 1;
   9.278      Uint16 *dstp = (Uint16 *) info->dst;
   9.279 -    int dstskip = info->dst_pitch >> 1;
   9.280 +    int dstskip = info->dst_skip >> 1;
   9.281  
   9.282      while (height--) {
   9.283          if (((uintptr_t) srcp ^ (uintptr_t) dstp) & 2) {
   9.284 @@ -1558,16 +1558,16 @@
   9.285  static void
   9.286  Blit565to565SurfaceAlphaMMX(SDL_BlitInfo * info)
   9.287  {
   9.288 -    unsigned alpha = (info->cmod >> 24);
   9.289 +    unsigned alpha = info->a;
   9.290      if (alpha == 128) {
   9.291          Blit16to16SurfaceAlpha128(info, 0xf7de);
   9.292      } else {
   9.293          int width = info->dst_w;
   9.294          int height = info->dst_h;
   9.295          Uint16 *srcp = (Uint16 *) info->src;
   9.296 -        int srcskip = info->s_skip >> 1;
   9.297 +        int srcskip = info->src_skip >> 1;
   9.298          Uint16 *dstp = (Uint16 *) info->dst;
   9.299 -        int dstskip = info->dst_pitch >> 1;
   9.300 +        int dstskip = info->dst_skip >> 1;
   9.301          Uint32 s, d;
   9.302  
   9.303          __m64 src1, dst1, src2, dst2, gmask, bmask, mm_res, mm_alpha;
   9.304 @@ -1695,16 +1695,16 @@
   9.305  static void
   9.306  Blit555to555SurfaceAlphaMMX(SDL_BlitInfo * info)
   9.307  {
   9.308 -    unsigned alpha = (info->cmod >> 24);
   9.309 +    unsigned alpha = info->a;
   9.310      if (alpha == 128) {
   9.311          Blit16to16SurfaceAlpha128(info, 0xfbde);
   9.312      } else {
   9.313          int width = info->dst_w;
   9.314          int height = info->dst_h;
   9.315          Uint16 *srcp = (Uint16 *) info->src;
   9.316 -        int srcskip = info->s_skip >> 1;
   9.317 +        int srcskip = info->src_skip >> 1;
   9.318          Uint16 *dstp = (Uint16 *) info->dst;
   9.319 -        int dstskip = info->dst_pitch >> 1;
   9.320 +        int dstskip = info->dst_skip >> 1;
   9.321          Uint32 s, d;
   9.322  
   9.323          __m64 src1, dst1, src2, dst2, rmask, gmask, bmask, mm_res, mm_alpha;
   9.324 @@ -1835,16 +1835,16 @@
   9.325  static void
   9.326  Blit565to565SurfaceAlpha(SDL_BlitInfo * info)
   9.327  {
   9.328 -    unsigned alpha = (info->cmod >> 24);
   9.329 +    unsigned alpha = info->a;
   9.330      if (alpha == 128) {
   9.331          Blit16to16SurfaceAlpha128(info, 0xf7de);
   9.332      } else {
   9.333          int width = info->dst_w;
   9.334          int height = info->dst_h;
   9.335          Uint16 *srcp = (Uint16 *) info->src;
   9.336 -        int srcskip = info->s_skip >> 1;
   9.337 +        int srcskip = info->src_skip >> 1;
   9.338          Uint16 *dstp = (Uint16 *) info->dst;
   9.339 -        int dstskip = info->dst_pitch >> 1;
   9.340 +        int dstskip = info->dst_skip >> 1;
   9.341          alpha >>= 3;            /* downscale alpha to 5 bits */
   9.342  
   9.343          while (height--) {
   9.344 @@ -1874,16 +1874,16 @@
   9.345  static void
   9.346  Blit555to555SurfaceAlpha(SDL_BlitInfo * info)
   9.347  {
   9.348 -    unsigned alpha = (info->cmod >> 24);        /* downscale alpha to 5 bits */
   9.349 +    unsigned alpha = info->a;   /* downscale alpha to 5 bits */
   9.350      if (alpha == 128) {
   9.351          Blit16to16SurfaceAlpha128(info, 0xfbde);
   9.352      } else {
   9.353          int width = info->dst_w;
   9.354          int height = info->dst_h;
   9.355          Uint16 *srcp = (Uint16 *) info->src;
   9.356 -        int srcskip = info->s_skip >> 1;
   9.357 +        int srcskip = info->src_skip >> 1;
   9.358          Uint16 *dstp = (Uint16 *) info->dst;
   9.359 -        int dstskip = info->dst_pitch >> 1;
   9.360 +        int dstskip = info->dst_skip >> 1;
   9.361          alpha >>= 3;            /* downscale alpha to 5 bits */
   9.362  
   9.363          while (height--) {
   9.364 @@ -1916,9 +1916,9 @@
   9.365      int width = info->dst_w;
   9.366      int height = info->dst_h;
   9.367      Uint32 *srcp = (Uint32 *) info->src;
   9.368 -    int srcskip = info->s_skip >> 2;
   9.369 +    int srcskip = info->src_skip >> 2;
   9.370      Uint16 *dstp = (Uint16 *) info->dst;
   9.371 -    int dstskip = info->dst_pitch >> 1;
   9.372 +    int dstskip = info->dst_skip >> 1;
   9.373  
   9.374      while (height--) {
   9.375  	    /* *INDENT-OFF* */
   9.376 @@ -1962,9 +1962,9 @@
   9.377      int width = info->dst_w;
   9.378      int height = info->dst_h;
   9.379      Uint32 *srcp = (Uint32 *) info->src;
   9.380 -    int srcskip = info->s_skip >> 2;
   9.381 +    int srcskip = info->src_skip >> 2;
   9.382      Uint16 *dstp = (Uint16 *) info->dst;
   9.383 -    int dstskip = info->dst_pitch >> 1;
   9.384 +    int dstskip = info->dst_skip >> 1;
   9.385  
   9.386      while (height--) {
   9.387  	    /* *INDENT-OFF* */
   9.388 @@ -2009,14 +2009,14 @@
   9.389      int width = info->dst_w;
   9.390      int height = info->dst_h;
   9.391      Uint8 *src = info->src;
   9.392 -    int srcskip = info->s_skip;
   9.393 +    int srcskip = info->src_skip;
   9.394      Uint8 *dst = info->dst;
   9.395 -    int dstskip = info->dst_pitch;
   9.396 -    SDL_PixelFormat *srcfmt = info->src;
   9.397 -    SDL_PixelFormat *dstfmt = info->dst;
   9.398 +    int dstskip = info->dst_skip;
   9.399 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   9.400 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   9.401      int srcbpp = srcfmt->BytesPerPixel;
   9.402      int dstbpp = dstfmt->BytesPerPixel;
   9.403 -    unsigned sA = (info->cmod >> 24);
   9.404 +    unsigned sA = info->a;
   9.405      unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
   9.406  
   9.407      if (sA) {
   9.408 @@ -2053,15 +2053,15 @@
   9.409      int width = info->dst_w;
   9.410      int height = info->dst_h;
   9.411      Uint8 *src = info->src;
   9.412 -    int srcskip = info->s_skip;
   9.413 +    int srcskip = info->src_skip;
   9.414      Uint8 *dst = info->dst;
   9.415 -    int dstskip = info->dst_pitch;
   9.416 -    SDL_PixelFormat *srcfmt = info->src;
   9.417 -    SDL_PixelFormat *dstfmt = info->dst;
   9.418 -    Uint32 ckey = info->ckey;
   9.419 +    int dstskip = info->dst_skip;
   9.420 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   9.421 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   9.422 +    Uint32 ckey = info->colorkey;
   9.423      int srcbpp = srcfmt->BytesPerPixel;
   9.424      int dstbpp = dstfmt->BytesPerPixel;
   9.425 -    unsigned sA = (info->cmod >> 24);
   9.426 +    unsigned sA = info->a;
   9.427      unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
   9.428  
   9.429      while (height--) {
   9.430 @@ -2099,11 +2099,11 @@
   9.431      int width = info->dst_w;
   9.432      int height = info->dst_h;
   9.433      Uint8 *src = info->src;
   9.434 -    int srcskip = info->s_skip;
   9.435 +    int srcskip = info->src_skip;
   9.436      Uint8 *dst = info->dst;
   9.437 -    int dstskip = info->dst_pitch;
   9.438 -    SDL_PixelFormat *srcfmt = info->src;
   9.439 -    SDL_PixelFormat *dstfmt = info->dst;
   9.440 +    int dstskip = info->dst_skip;
   9.441 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   9.442 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   9.443  
   9.444      int srcbpp;
   9.445      int dstbpp;
   9.446 @@ -2147,81 +2147,14 @@
   9.447  }
   9.448  
   9.449  
   9.450 -SDL_loblit
   9.451 -SDL_CalculateAlphaBlit(SDL_Surface * surface, int blit_index)
   9.452 +SDL_BlitFunc
   9.453 +SDL_CalculateBlitA(SDL_Surface * surface)
   9.454  {
   9.455      SDL_PixelFormat *sf = surface->format;
   9.456      SDL_PixelFormat *df = surface->map->dst->format;
   9.457  
   9.458 -    if (sf->Amask == 0) {
   9.459 -        if ((surface->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) {
   9.460 -            if (df->BytesPerPixel == 1)
   9.461 -                return BlitNto1SurfaceAlphaKey;
   9.462 -            else
   9.463 -#if SDL_ALTIVEC_BLITTERS
   9.464 -            if (sf->BytesPerPixel == 4 && df->BytesPerPixel == 4 &&
   9.465 -                    SDL_HasAltiVec())
   9.466 -                return Blit32to32SurfaceAlphaKeyAltivec;
   9.467 -            else
   9.468 -#endif
   9.469 -                return BlitNtoNSurfaceAlphaKey;
   9.470 -        } else {
   9.471 -            /* Per-surface alpha blits */
   9.472 -            switch (df->BytesPerPixel) {
   9.473 -            case 1:
   9.474 -                return BlitNto1SurfaceAlpha;
   9.475 -
   9.476 -            case 2:
   9.477 -                if (surface->map->identity) {
   9.478 -                    if (df->Gmask == 0x7e0) {
   9.479 -#ifdef __MMX__
   9.480 -                        if (SDL_HasMMX())
   9.481 -                            return Blit565to565SurfaceAlphaMMX;
   9.482 -                        else
   9.483 -#endif
   9.484 -                            return Blit565to565SurfaceAlpha;
   9.485 -                    } else if (df->Gmask == 0x3e0) {
   9.486 -#ifdef __MMX__
   9.487 -                        if (SDL_HasMMX())
   9.488 -                            return Blit555to555SurfaceAlphaMMX;
   9.489 -                        else
   9.490 -#endif
   9.491 -                            return Blit555to555SurfaceAlpha;
   9.492 -                    }
   9.493 -                }
   9.494 -                return BlitNtoNSurfaceAlpha;
   9.495 -
   9.496 -            case 4:
   9.497 -                if (sf->Rmask == df->Rmask
   9.498 -                    && sf->Gmask == df->Gmask
   9.499 -                    && sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
   9.500 -#ifdef __MMX__
   9.501 -                    if (sf->Rshift % 8 == 0
   9.502 -                        && sf->Gshift % 8 == 0
   9.503 -                        && sf->Bshift % 8 == 0 && SDL_HasMMX())
   9.504 -                        return BlitRGBtoRGBSurfaceAlphaMMX;
   9.505 -#endif
   9.506 -                    if ((sf->Rmask | sf->Gmask | sf->Bmask) == 0xffffff) {
   9.507 -#if SDL_ALTIVEC_BLITTERS
   9.508 -                        if (SDL_HasAltiVec())
   9.509 -                            return BlitRGBtoRGBSurfaceAlphaAltivec;
   9.510 -#endif
   9.511 -                        return BlitRGBtoRGBSurfaceAlpha;
   9.512 -                    }
   9.513 -                }
   9.514 -#if SDL_ALTIVEC_BLITTERS
   9.515 -                if ((sf->BytesPerPixel == 4) && SDL_HasAltiVec())
   9.516 -                    return Blit32to32SurfaceAlphaAltivec;
   9.517 -                else
   9.518 -#endif
   9.519 -                    return BlitNtoNSurfaceAlpha;
   9.520 -
   9.521 -            case 3:
   9.522 -            default:
   9.523 -                return BlitNtoNSurfaceAlpha;
   9.524 -            }
   9.525 -        }
   9.526 -    } else {
   9.527 +    switch (surface->map->info.flags) {
   9.528 +    case SDL_COPY_BLEND:
   9.529          /* Per-pixel alpha blits */
   9.530          switch (df->BytesPerPixel) {
   9.531          case 1:
   9.532 @@ -2284,7 +2217,84 @@
   9.533          default:
   9.534              return BlitNtoNPixelAlpha;
   9.535          }
   9.536 +        break;
   9.537 +
   9.538 +    case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
   9.539 +        if (sf->Amask == 0) {
   9.540 +            /* Per-surface alpha blits */
   9.541 +            switch (df->BytesPerPixel) {
   9.542 +            case 1:
   9.543 +                return BlitNto1SurfaceAlpha;
   9.544 +
   9.545 +            case 2:
   9.546 +                if (surface->map->identity) {
   9.547 +                    if (df->Gmask == 0x7e0) {
   9.548 +#ifdef __MMX__
   9.549 +                        if (SDL_HasMMX())
   9.550 +                            return Blit565to565SurfaceAlphaMMX;
   9.551 +                        else
   9.552 +#endif
   9.553 +                            return Blit565to565SurfaceAlpha;
   9.554 +                    } else if (df->Gmask == 0x3e0) {
   9.555 +#ifdef __MMX__
   9.556 +                        if (SDL_HasMMX())
   9.557 +                            return Blit555to555SurfaceAlphaMMX;
   9.558 +                        else
   9.559 +#endif
   9.560 +                            return Blit555to555SurfaceAlpha;
   9.561 +                    }
   9.562 +                }
   9.563 +                return BlitNtoNSurfaceAlpha;
   9.564 +
   9.565 +            case 4:
   9.566 +                if (sf->Rmask == df->Rmask
   9.567 +                    && sf->Gmask == df->Gmask
   9.568 +                    && sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
   9.569 +#ifdef __MMX__
   9.570 +                    if (sf->Rshift % 8 == 0
   9.571 +                        && sf->Gshift % 8 == 0
   9.572 +                        && sf->Bshift % 8 == 0 && SDL_HasMMX())
   9.573 +                        return BlitRGBtoRGBSurfaceAlphaMMX;
   9.574 +#endif
   9.575 +                    if ((sf->Rmask | sf->Gmask | sf->Bmask) == 0xffffff) {
   9.576 +#if SDL_ALTIVEC_BLITTERS
   9.577 +                        if (SDL_HasAltiVec())
   9.578 +                            return BlitRGBtoRGBSurfaceAlphaAltivec;
   9.579 +#endif
   9.580 +                        return BlitRGBtoRGBSurfaceAlpha;
   9.581 +                    }
   9.582 +                }
   9.583 +#if SDL_ALTIVEC_BLITTERS
   9.584 +                if ((sf->BytesPerPixel == 4) && SDL_HasAltiVec())
   9.585 +                    return Blit32to32SurfaceAlphaAltivec;
   9.586 +                else
   9.587 +#endif
   9.588 +                    return BlitNtoNSurfaceAlpha;
   9.589 +
   9.590 +            case 3:
   9.591 +            default:
   9.592 +                return BlitNtoNSurfaceAlpha;
   9.593 +            }
   9.594 +        }
   9.595 +        break;
   9.596 +
   9.597 +    case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
   9.598 +        if (sf->Amask == 0) {
   9.599 +            if (df->BytesPerPixel == 1)
   9.600 +                return BlitNto1SurfaceAlphaKey;
   9.601 +            else
   9.602 +#if SDL_ALTIVEC_BLITTERS
   9.603 +            if (sf->BytesPerPixel == 4 && df->BytesPerPixel == 4 &&
   9.604 +                    SDL_HasAltiVec())
   9.605 +                return Blit32to32SurfaceAlphaKeyAltivec;
   9.606 +            else
   9.607 +#endif
   9.608 +                return BlitNtoNSurfaceAlphaKey;
   9.609 +        }
   9.610 +        break;
   9.611      }
   9.612 +
   9.613 +    return NULL;
   9.614  }
   9.615  
   9.616  /* vi: set ts=4 sw=4 expandtab: */
    10.1 --- a/src/video/SDL_blit_N.c	Sat Aug 18 01:44:21 2007 +0000
    10.2 +++ b/src/video/SDL_blit_N.c	Sat Aug 18 05:39:09 2007 +0000
    10.3 @@ -160,9 +160,9 @@
    10.4  {
    10.5      int height = info->dst_h;
    10.6      Uint8 *src = (Uint8 *) info->src;
    10.7 -    int srcskip = info->s_skip;
    10.8 +    int srcskip = info->src_skip;
    10.9      Uint8 *dst = (Uint8 *) info->dst;
   10.10 -    int dstskip = info->dst_pitch;
   10.11 +    int dstskip = info->dst_skip;
   10.12      SDL_PixelFormat *srcfmt = info->src;
   10.13      vector unsigned char valpha = vec_splat_u8(0);
   10.14      vector unsigned char vpermute = calc_swizzle32(srcfmt, NULL);
   10.15 @@ -264,9 +264,9 @@
   10.16  {
   10.17      int height = info->dst_h;
   10.18      Uint8 *src = (Uint8 *) info->src;
   10.19 -    int srcskip = info->s_skip;
   10.20 +    int srcskip = info->src_skip;
   10.21      Uint8 *dst = (Uint8 *) info->dst;
   10.22 -    int dstskip = info->dst_pitch;
   10.23 +    int dstskip = info->dst_skip;
   10.24      SDL_PixelFormat *srcfmt = info->src;
   10.25      SDL_PixelFormat *dstfmt = info->dst;
   10.26      unsigned alpha;
   10.27 @@ -322,8 +322,8 @@
   10.28      vf800 = (vector unsigned short) vec_splat_u8(-7);
   10.29      vf800 = vec_sl(vf800, vec_splat_u16(8));
   10.30  
   10.31 -    if (dstfmt->Amask && (info->cmod >> 24)) {
   10.32 -        ((unsigned char *) &valpha)[0] = alpha = (info->cmod >> 24);
   10.33 +    if (dstfmt->Amask && info->a) {
   10.34 +        ((unsigned char *) &valpha)[0] = alpha = info->a;
   10.35          valpha = vec_splat(valpha, 0);
   10.36      } else {
   10.37          alpha = 0;
   10.38 @@ -412,9 +412,9 @@
   10.39  {
   10.40      int height = info->dst_h;
   10.41      Uint8 *src = (Uint8 *) info->src;
   10.42 -    int srcskip = info->s_skip;
   10.43 +    int srcskip = info->src_skip;
   10.44      Uint8 *dst = (Uint8 *) info->dst;
   10.45 -    int dstskip = info->dst_pitch;
   10.46 +    int dstskip = info->dst_skip;
   10.47      SDL_PixelFormat *srcfmt = info->src;
   10.48      SDL_PixelFormat *dstfmt = info->dst;
   10.49      unsigned alpha;
   10.50 @@ -470,8 +470,8 @@
   10.51      vf800 = (vector unsigned short) vec_splat_u8(-7);
   10.52      vf800 = vec_sl(vf800, vec_splat_u16(8));
   10.53  
   10.54 -    if (dstfmt->Amask && (info->cmod >> 24)) {
   10.55 -        ((unsigned char *) &valpha)[0] = alpha = (info->cmod >> 24);
   10.56 +    if (dstfmt->Amask && info->a) {
   10.57 +        ((unsigned char *) &valpha)[0] = alpha = info->a;
   10.58          valpha = vec_splat(valpha, 0);
   10.59      } else {
   10.60          alpha = 0;
   10.61 @@ -561,17 +561,17 @@
   10.62  {
   10.63      int height = info->dst_h;
   10.64      Uint32 *srcp = (Uint32 *) info->src;
   10.65 -    int srcskip = info->s_skip;
   10.66 +    int srcskip = info->src_skip;
   10.67      Uint32 *dstp = (Uint32 *) info->dst;
   10.68 -    int dstskip = info->dst_pitch;
   10.69 +    int dstskip = info->dst_skip;
   10.70      SDL_PixelFormat *srcfmt = info->src;
   10.71      int srcbpp = srcfmt->BytesPerPixel;
   10.72      SDL_PixelFormat *dstfmt = info->dst;
   10.73      int dstbpp = dstfmt->BytesPerPixel;
   10.74      int copy_alpha = (srcfmt->Amask && dstfmt->Amask);
   10.75 -    unsigned alpha = dstfmt->Amask ? (info->cmod >> 24) : 0;
   10.76 +    unsigned alpha = dstfmt->Amask ? info->a : 0;
   10.77      Uint32 rgbmask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
   10.78 -    Uint32 ckey = info->ckey;
   10.79 +    Uint32 ckey = info->colorkey;
   10.80      vector unsigned int valpha;
   10.81      vector unsigned char vpermute;
   10.82      vector unsigned char vzero;
   10.83 @@ -679,17 +679,17 @@
   10.84  {
   10.85      int height = info->dst_h;
   10.86      Uint32 *src = (Uint32 *) info->src;
   10.87 -    int srcskip = info->s_skip;
   10.88 +    int srcskip = info->src_skip;
   10.89      Uint32 *dst = (Uint32 *) info->dst;
   10.90 -    int dstskip = info->dst_pitch;
   10.91 +    int dstskip = info->dst_skip;
   10.92      SDL_PixelFormat *srcfmt = info->src;
   10.93      SDL_PixelFormat *dstfmt = info->dst;
   10.94      vector unsigned int vzero = vec_splat_u32(0);
   10.95      vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
   10.96      if (dstfmt->Amask && !srcfmt->Amask) {
   10.97 -        if ((info->cmod >> 24)) {
   10.98 +        if (info->a) {
   10.99              vector unsigned char valpha;
  10.100 -            ((unsigned char *) &valpha)[0] = (info->cmod >> 24);
  10.101 +            ((unsigned char *) &valpha)[0] = info->a;
  10.102              vzero = (vector unsigned int) vec_splat(valpha, 0);
  10.103          }
  10.104      }
  10.105 @@ -758,17 +758,17 @@
  10.106  
  10.107      int height = info->dst_h;
  10.108      Uint32 *src = (Uint32 *) info->src;
  10.109 -    int srcskip = info->s_skip;
  10.110 +    int srcskip = info->src_skip;
  10.111      Uint32 *dst = (Uint32 *) info->dst;
  10.112 -    int dstskip = info->dst_pitch;
  10.113 +    int dstskip = info->dst_skip;
  10.114      SDL_PixelFormat *srcfmt = info->src;
  10.115      SDL_PixelFormat *dstfmt = info->dst;
  10.116      vector unsigned int vzero = vec_splat_u32(0);
  10.117      vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
  10.118      if (dstfmt->Amask && !srcfmt->Amask) {
  10.119 -        if ((info->cmod >> 24)) {
  10.120 +        if (info->a) {
  10.121              vector unsigned char valpha;
  10.122 -            ((unsigned char *) &valpha)[0] = (info->cmod >> 24);
  10.123 +            ((unsigned char *) &valpha)[0] = info->a;
  10.124              vzero = (vector unsigned int) vec_splat(valpha, 0);
  10.125          }
  10.126      }
  10.127 @@ -901,9 +901,9 @@
  10.128      width = info->dst_w;
  10.129      height = info->dst_h;
  10.130      src = (Uint32 *) info->src;
  10.131 -    srcskip = info->s_skip / 4;
  10.132 +    srcskip = info->src_skip / 4;
  10.133      dst = info->dst;
  10.134 -    dstskip = info->dst_pitch;
  10.135 +    dstskip = info->dst_skip;
  10.136      map = info->table;
  10.137  
  10.138      if (map == NULL) {
  10.139 @@ -1018,9 +1018,9 @@
  10.140      width = info->dst_w;
  10.141      height = info->dst_h;
  10.142      src = (Uint32 *) info->src;
  10.143 -    srcskip = info->s_skip / 4;
  10.144 +    srcskip = info->src_skip / 4;
  10.145      dst = (Uint16 *) info->dst;
  10.146 -    dstskip = info->dst_pitch / 2;
  10.147 +    dstskip = info->dst_skip / 2;
  10.148  
  10.149  #ifdef USE_DUFFS_LOOP
  10.150      while (height--) {
  10.151 @@ -1142,9 +1142,9 @@
  10.152      width = info->dst_w;
  10.153      height = info->dst_h;
  10.154      src = (Uint32 *) info->src;
  10.155 -    srcskip = info->s_skip / 4;
  10.156 +    srcskip = info->src_skip / 4;
  10.157      dst = (Uint16 *) info->dst;
  10.158 -    dstskip = info->dst_pitch / 2;
  10.159 +    dstskip = info->dst_skip / 2;
  10.160  
  10.161  #ifdef USE_DUFFS_LOOP
  10.162      while (height--) {
  10.163 @@ -1255,9 +1255,9 @@
  10.164      width = info->dst_w;
  10.165      height = info->dst_h;
  10.166      src = (Uint8 *) info->src;
  10.167 -    srcskip = info->s_skip;
  10.168 +    srcskip = info->src_skip;
  10.169      dst = (Uint32 *) info->dst;
  10.170 -    dstskip = info->dst_pitch / 4;
  10.171 +    dstskip = info->dst_skip / 4;
  10.172  
  10.173  #ifdef USE_DUFFS_LOOP
  10.174      while (height--) {
  10.175 @@ -1877,9 +1877,9 @@
  10.176      width = info->dst_w;
  10.177      height = info->dst_h;
  10.178      src = (Uint32 *) info->src;
  10.179 -    srcskip = info->s_skip / 4;
  10.180 +    srcskip = info->src_skip / 4;
  10.181      dst = info->dst;
  10.182 -    dstskip = info->dst_pitch;
  10.183 +    dstskip = info->dst_skip;
  10.184      map = info->table;
  10.185  
  10.186  #ifdef USE_DUFFS_LOOP
  10.187 @@ -1950,11 +1950,11 @@
  10.188      width = info->dst_w;
  10.189      height = info->dst_h;
  10.190      src = info->src;
  10.191 -    srcskip = info->s_skip;
  10.192 +    srcskip = info->src_skip;
  10.193      dst = info->dst;
  10.194 -    dstskip = info->dst_pitch;
  10.195 +    dstskip = info->dst_skip;
  10.196      map = info->table;
  10.197 -    srcfmt = info->src;
  10.198 +    srcfmt = info->src_fmt;
  10.199      srcbpp = srcfmt->BytesPerPixel;
  10.200  
  10.201      if (map == NULL) {
  10.202 @@ -2031,15 +2031,15 @@
  10.203      int width = info->dst_w;
  10.204      int height = info->dst_h;
  10.205      Uint32 *src = (Uint32 *) info->src;
  10.206 -    int srcskip = info->s_skip;
  10.207 +    int srcskip = info->src_skip;
  10.208      Uint32 *dst = (Uint32 *) info->dst;
  10.209 -    int dstskip = info->dst_pitch;
  10.210 -    SDL_PixelFormat *srcfmt = info->src;
  10.211 -    SDL_PixelFormat *dstfmt = info->dst;
  10.212 +    int dstskip = info->dst_skip;
  10.213 +    SDL_PixelFormat *srcfmt = info->src_fmt;
  10.214 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
  10.215  
  10.216      if (dstfmt->Amask) {
  10.217          /* RGB->RGBA, SET_ALPHA */
  10.218 -        Uint32 mask = ((info->cmod >> 24) >> dstfmt->Aloss) << dstfmt->Ashift;
  10.219 +        Uint32 mask = (info->a >> dstfmt->Aloss) << dstfmt->Ashift;
  10.220  
  10.221          while (height--) {
  10.222  			/* *INDENT-OFF* */
  10.223 @@ -2080,14 +2080,14 @@
  10.224      int width = info->dst_w;
  10.225      int height = info->dst_h;
  10.226      Uint8 *src = info->src;
  10.227 -    int srcskip = info->s_skip;
  10.228 +    int srcskip = info->src_skip;
  10.229      Uint8 *dst = info->dst;
  10.230 -    int dstskip = info->dst_pitch;
  10.231 -    SDL_PixelFormat *srcfmt = info->src;
  10.232 +    int dstskip = info->dst_skip;
  10.233 +    SDL_PixelFormat *srcfmt = info->src_fmt;
  10.234      int srcbpp = srcfmt->BytesPerPixel;
  10.235 -    SDL_PixelFormat *dstfmt = info->dst;
  10.236 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
  10.237      int dstbpp = dstfmt->BytesPerPixel;
  10.238 -    unsigned alpha = dstfmt->Amask ? (info->cmod >> 24) : 0;
  10.239 +    unsigned alpha = dstfmt->Amask ? info->a : 0;
  10.240  
  10.241      while (height--) {
  10.242  		/* *INDENT-OFF* */
  10.243 @@ -2115,12 +2115,12 @@
  10.244      int width = info->dst_w;
  10.245      int height = info->dst_h;
  10.246      Uint8 *src = info->src;
  10.247 -    int srcskip = info->s_skip;
  10.248 +    int srcskip = info->src_skip;
  10.249      Uint8 *dst = info->dst;
  10.250 -    int dstskip = info->dst_pitch;
  10.251 -    SDL_PixelFormat *srcfmt = info->src;
  10.252 +    int dstskip = info->dst_skip;
  10.253 +    SDL_PixelFormat *srcfmt = info->src_fmt;
  10.254      int srcbpp = srcfmt->BytesPerPixel;
  10.255 -    SDL_PixelFormat *dstfmt = info->dst;
  10.256 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
  10.257      int dstbpp = dstfmt->BytesPerPixel;
  10.258      int c;
  10.259  
  10.260 @@ -2145,12 +2145,12 @@
  10.261      int width = info->dst_w;
  10.262      int height = info->dst_h;
  10.263      Uint8 *src = info->src;
  10.264 -    int srcskip = info->s_skip;
  10.265 +    int srcskip = info->src_skip;
  10.266      Uint8 *dst = info->dst;
  10.267 -    int dstskip = info->dst_pitch;
  10.268 -    SDL_PixelFormat *srcfmt = info->src;
  10.269 +    int dstskip = info->dst_skip;
  10.270 +    SDL_PixelFormat *srcfmt = info->src_fmt;
  10.271      const Uint8 *palmap = info->table;
  10.272 -    Uint32 ckey = info->ckey;
  10.273 +    Uint32 ckey = info->colorkey;
  10.274      Uint32 rgbmask = ~srcfmt->Amask;
  10.275      int srcbpp;
  10.276      Uint32 Pixel;
  10.277 @@ -2211,11 +2211,11 @@
  10.278      int width = info->dst_w;
  10.279      int height = info->dst_h;
  10.280      Uint16 *srcp = (Uint16 *) info->src;
  10.281 -    int srcskip = info->s_skip;
  10.282 +    int srcskip = info->src_skip;
  10.283      Uint16 *dstp = (Uint16 *) info->dst;
  10.284 -    int dstskip = info->dst_pitch;
  10.285 -    Uint32 ckey = info->ckey;
  10.286 -    Uint32 rgbmask = ~info->src->Amask;
  10.287 +    int dstskip = info->dst_skip;
  10.288 +    Uint32 ckey = info->colorkey;
  10.289 +    Uint32 rgbmask = ~info->src_fmt->Amask;
  10.290  
  10.291      /* Set up some basic variables */
  10.292      srcskip /= 2;
  10.293 @@ -2245,15 +2245,15 @@
  10.294      int width = info->dst_w;
  10.295      int height = info->dst_h;
  10.296      Uint8 *src = info->src;
  10.297 -    int srcskip = info->s_skip;
  10.298 +    int srcskip = info->src_skip;
  10.299      Uint8 *dst = info->dst;
  10.300 -    int dstskip = info->dst_pitch;
  10.301 -    Uint32 ckey = info->ckey;
  10.302 -    SDL_PixelFormat *srcfmt = info->src;
  10.303 -    SDL_PixelFormat *dstfmt = info->dst;
  10.304 +    int dstskip = info->dst_skip;
  10.305 +    Uint32 ckey = info->colorkey;
  10.306 +    SDL_PixelFormat *srcfmt = info->src_fmt;
  10.307 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
  10.308      int srcbpp = srcfmt->BytesPerPixel;
  10.309      int dstbpp = dstfmt->BytesPerPixel;
  10.310 -    unsigned alpha = dstfmt->Amask ? (info->cmod >> 24) : 0;
  10.311 +    unsigned alpha = dstfmt->Amask ? info->a : 0;
  10.312      Uint32 rgbmask = ~srcfmt->Amask;
  10.313  
  10.314      /* Set up some basic variables */
  10.315 @@ -2288,12 +2288,12 @@
  10.316      int width = info->dst_w;
  10.317      int height = info->dst_h;
  10.318      Uint8 *src = info->src;
  10.319 -    int srcskip = info->s_skip;
  10.320 +    int srcskip = info->src_skip;
  10.321      Uint8 *dst = info->dst;
  10.322 -    int dstskip = info->dst_pitch;
  10.323 -    Uint32 ckey = info->ckey;
  10.324 -    SDL_PixelFormat *srcfmt = info->src;
  10.325 -    SDL_PixelFormat *dstfmt = info->dst;
  10.326 +    int dstskip = info->dst_skip;
  10.327 +    Uint32 ckey = info->colorkey;
  10.328 +    SDL_PixelFormat *srcfmt = info->src_fmt;
  10.329 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
  10.330      Uint32 rgbmask = ~srcfmt->Amask;
  10.331  
  10.332      Uint8 srcbpp;
  10.333 @@ -2332,7 +2332,7 @@
  10.334      int dstbpp;
  10.335      Uint32 dstR, dstG, dstB;
  10.336      Uint32 blit_features;
  10.337 -    SDL_loblit blitfunc;
  10.338 +    SDL_BlitFunc blitfunc;
  10.339      enum
  10.340      { NO_ALPHA = 1, SET_ALPHA = 2, COPY_ALPHA = 4 } alpha;
  10.341  };
  10.342 @@ -2403,30 +2403,77 @@
  10.343  /* Mask matches table, or table entry is zero */
  10.344  #define MASKOK(x, y) (((x) == (y)) || ((y) == 0x00000000))
  10.345  
  10.346 -SDL_loblit
  10.347 -SDL_CalculateBlitN(SDL_Surface * surface, int blit_index)
  10.348 +SDL_BlitFunc
  10.349 +SDL_CalculateBlitN(SDL_Surface * surface)
  10.350  {
  10.351      SDL_PixelFormat *srcfmt;
  10.352      SDL_PixelFormat *dstfmt;
  10.353      const struct blit_table *table;
  10.354      int which;
  10.355 -    SDL_loblit blitfun;
  10.356 +    SDL_BlitFunc blitfun;
  10.357  
  10.358      /* Set up data for choosing the blit */
  10.359      srcfmt = surface->format;
  10.360      dstfmt = surface->map->dst->format;
  10.361  
  10.362 -    if (blit_index & 2) {
  10.363 -        /* alpha or alpha+colorkey */
  10.364 -        return SDL_CalculateAlphaBlit(surface, blit_index);
  10.365 -    }
  10.366 -
  10.367      /* We don't support destinations less than 8-bits */
  10.368      if (dstfmt->BitsPerPixel < 8) {
  10.369          return (NULL);
  10.370      }
  10.371  
  10.372 -    if (blit_index == 1) {
  10.373 +    switch (surface->map->info.flags) {
  10.374 +    case 0:
  10.375 +        blitfun = NULL;
  10.376 +        if (dstfmt->BitsPerPixel == 8) {
  10.377 +            /* We assume 8-bit destinations are palettized */
  10.378 +            if ((srcfmt->BytesPerPixel == 4) &&
  10.379 +                (srcfmt->Rmask == 0x00FF0000) &&
  10.380 +                (srcfmt->Gmask == 0x0000FF00) &&
  10.381 +                (srcfmt->Bmask == 0x000000FF)) {
  10.382 +                if (surface->map->info.table) {
  10.383 +                    blitfun = Blit_RGB888_index8_map;
  10.384 +                } else {
  10.385 +                    blitfun = Blit_RGB888_index8;
  10.386 +                }
  10.387 +            } else {
  10.388 +                blitfun = BlitNto1;
  10.389 +            }
  10.390 +        } else {
  10.391 +            /* Now the meat, choose the blitter we want */
  10.392 +            int a_need = NO_ALPHA;
  10.393 +            if (dstfmt->Amask)
  10.394 +                a_need = srcfmt->Amask ? COPY_ALPHA : SET_ALPHA;
  10.395 +            table = normal_blit[srcfmt->BytesPerPixel - 1];
  10.396 +            for (which = 0; table[which].dstbpp; ++which) {
  10.397 +                if (MASKOK(srcfmt->Rmask, table[which].srcR) &&
  10.398 +                    MASKOK(srcfmt->Gmask, table[which].srcG) &&
  10.399 +                    MASKOK(srcfmt->Bmask, table[which].srcB) &&
  10.400 +                    MASKOK(dstfmt->Rmask, table[which].dstR) &&
  10.401 +                    MASKOK(dstfmt->Gmask, table[which].dstG) &&
  10.402 +                    MASKOK(dstfmt->Bmask, table[which].dstB) &&
  10.403 +                    dstfmt->BytesPerPixel == table[which].dstbpp &&
  10.404 +                    (a_need & table[which].alpha) == a_need &&
  10.405 +                    ((table[which].blit_features & GetBlitFeatures()) ==
  10.406 +                     table[which].blit_features))
  10.407 +                    break;
  10.408 +            }
  10.409 +            blitfun = table[which].blitfunc;
  10.410 +
  10.411 +            if (blitfun == BlitNtoN) {  /* default C fallback catch-all. Slow! */
  10.412 +                /* Fastpath C fallback: 32bit RGB<->RGBA blit with matching RGB */
  10.413 +                if (srcfmt->BytesPerPixel == 4 && dstfmt->BytesPerPixel == 4
  10.414 +                    && srcfmt->Rmask == dstfmt->Rmask
  10.415 +                    && srcfmt->Gmask == dstfmt->Gmask
  10.416 +                    && srcfmt->Bmask == dstfmt->Bmask) {
  10.417 +                    blitfun = Blit4to4MaskAlpha;
  10.418 +                } else if (a_need == COPY_ALPHA) {
  10.419 +                    blitfun = BlitNtoNCopyAlpha;
  10.420 +                }
  10.421 +            }
  10.422 +        }
  10.423 +        return (blitfun);
  10.424 +
  10.425 +    case SDL_COPY_COLORKEY:
  10.426          /* colorkey blit: Here we don't have too many options, mostly
  10.427             because RLE is the preferred fast way to deal with this.
  10.428             If a particular case turns out to be useful we'll add it. */
  10.429 @@ -2442,70 +2489,15 @@
  10.430                  return Blit32to32KeyAltivec;
  10.431              } else
  10.432  #endif
  10.433 -
  10.434 -            if (srcfmt->Amask && dstfmt->Amask)
  10.435 +            if (srcfmt->Amask && dstfmt->Amask) {
  10.436                  return BlitNtoNKeyCopyAlpha;
  10.437 -            else
  10.438 +            } else {
  10.439                  return BlitNtoNKey;
  10.440 -        }
  10.441 -    }
  10.442 -
  10.443 -    blitfun = NULL;
  10.444 -    if (dstfmt->BitsPerPixel == 8) {
  10.445 -        /* We assume 8-bit destinations are palettized */
  10.446 -        if ((srcfmt->BytesPerPixel == 4) &&
  10.447 -            (srcfmt->Rmask == 0x00FF0000) &&
  10.448 -            (srcfmt->Gmask == 0x0000FF00) && (srcfmt->Bmask == 0x000000FF)) {
  10.449 -            if (surface->map->table) {
  10.450 -                blitfun = Blit_RGB888_index8_map;
  10.451 -            } else {
  10.452 -                blitfun = Blit_RGB888_index8;
  10.453 -            }
  10.454 -        } else {
  10.455 -            blitfun = BlitNto1;
  10.456 -        }
  10.457 -    } else {
  10.458 -        /* Now the meat, choose the blitter we want */
  10.459 -        int a_need = NO_ALPHA;
  10.460 -        if (dstfmt->Amask)
  10.461 -            a_need = srcfmt->Amask ? COPY_ALPHA : SET_ALPHA;
  10.462 -        table = normal_blit[srcfmt->BytesPerPixel - 1];
  10.463 -        for (which = 0; table[which].dstbpp; ++which) {
  10.464 -            if (MASKOK(srcfmt->Rmask, table[which].srcR) &&
  10.465 -                MASKOK(srcfmt->Gmask, table[which].srcG) &&
  10.466 -                MASKOK(srcfmt->Bmask, table[which].srcB) &&
  10.467 -                MASKOK(dstfmt->Rmask, table[which].dstR) &&
  10.468 -                MASKOK(dstfmt->Gmask, table[which].dstG) &&
  10.469 -                MASKOK(dstfmt->Bmask, table[which].dstB) &&
  10.470 -                dstfmt->BytesPerPixel == table[which].dstbpp &&
  10.471 -                (a_need & table[which].alpha) == a_need &&
  10.472 -                ((table[which].blit_features & GetBlitFeatures()) ==
  10.473 -                 table[which].blit_features))
  10.474 -                break;
  10.475 -        }
  10.476 -        blitfun = table[which].blitfunc;
  10.477 -
  10.478 -        if (blitfun == BlitNtoN) {      /* default C fallback catch-all. Slow! */
  10.479 -            /* Fastpath C fallback: 32bit RGB<->RGBA blit with matching RGB */
  10.480 -            if (srcfmt->BytesPerPixel == 4 && dstfmt->BytesPerPixel == 4 &&
  10.481 -                srcfmt->Rmask == dstfmt->Rmask &&
  10.482 -                srcfmt->Gmask == dstfmt->Gmask &&
  10.483 -                srcfmt->Bmask == dstfmt->Bmask) {
  10.484 -                blitfun = Blit4to4MaskAlpha;
  10.485 -            } else if (a_need == COPY_ALPHA) {
  10.486 -                blitfun = BlitNtoNCopyAlpha;
  10.487              }
  10.488          }
  10.489      }
  10.490  
  10.491 -#ifdef DEBUG_ASM
  10.492 -    if ((blitfun == BlitNtoN) || (blitfun == BlitNto1))
  10.493 -        fprintf(stderr, "Using C blit\n");
  10.494 -    else
  10.495 -        fprintf(stderr, "Using optimized C blit\n");
  10.496 -#endif /* DEBUG_ASM */
  10.497 -
  10.498 -    return (blitfun);
  10.499 +    return NULL;
  10.500  }
  10.501  
  10.502  /* vi: set ts=4 sw=4 expandtab: */
    11.1 --- a/src/video/SDL_blit_auto.c	Sat Aug 18 01:44:21 2007 +0000
    11.2 +++ b/src/video/SDL_blit_auto.c	Sat Aug 18 05:39:09 2007 +0000
    11.3 @@ -5262,7 +5262,7 @@
    11.4      }
    11.5  }
    11.6  
    11.7 -static SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = {
    11.8 +SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = {
    11.9      { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Scale },
   11.10      { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend },
   11.11      { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend_Scale },
    12.1 --- a/src/video/SDL_blit_copy.c	Sat Aug 18 01:44:21 2007 +0000
    12.2 +++ b/src/video/SDL_blit_copy.c	Sat Aug 18 05:39:09 2007 +0000
    12.3 @@ -95,12 +95,12 @@
    12.4      int w, h;
    12.5      int srcskip, dstskip;
    12.6  
    12.7 -    w = info->dst_w * info->dst->BytesPerPixel;
    12.8 +    w = info->dst_w * info->dst_fmt->BytesPerPixel;
    12.9      h = info->dst_h;
   12.10      src = info->src;
   12.11      dst = info->dst;
   12.12 -    srcskip = w + info->s_skip;
   12.13 -    dstskip = w + info->dst_pitch;
   12.14 +    srcskip = info->src_pitch;
   12.15 +    dstskip = info->dst_pitch;
   12.16  
   12.17  #ifdef __SSE__
   12.18      if (SDL_HasSSE() && !((uintptr_t) src & 15) && !((uintptr_t) dst & 15)) {
   12.19 @@ -139,11 +139,11 @@
   12.20      int w, h;
   12.21      int skip;
   12.22  
   12.23 -    w = info->dst_w * info->dst->BytesPerPixel;
   12.24 +    w = info->dst_w * info->dst_fmt->BytesPerPixel;
   12.25      h = info->dst_h;
   12.26      src = info->src;
   12.27      dst = info->dst;
   12.28 -    skip = w + info->s_skip;
   12.29 +    skip = info->src_pitch;
   12.30      if ((dst < src) || (dst >= (src + h * skip))) {
   12.31          SDL_BlitCopy(info);
   12.32      } else {
    13.1 --- a/src/video/SDL_pixels.c	Sat Aug 18 01:44:21 2007 +0000
    13.2 +++ b/src/video/SDL_pixels.c	Sat Aug 18 05:39:09 2007 +0000
    13.3 @@ -668,12 +668,12 @@
    13.4  
    13.5  /* Map from Palette to BitField */
    13.6  static Uint8 *
    13.7 -Map1toN(SDL_PixelFormat * src, Uint32 cmod, SDL_PixelFormat * dst)
    13.8 +Map1toN(SDL_PixelFormat * src, Uint8 Rmod, Uint8 Gmod, Uint8 Bmod, Uint8 Amod,
    13.9 +        SDL_PixelFormat * dst)
   13.10  {
   13.11      Uint8 *map;
   13.12      int i;
   13.13      int bpp;
   13.14 -    unsigned Amod, Rmod, Gmod, Bmod;
   13.15      SDL_Palette *pal = src->palette;
   13.16  
   13.17      bpp = ((dst->BytesPerPixel == 3) ? 4 : dst->BytesPerPixel);
   13.18 @@ -683,17 +683,12 @@
   13.19          return (NULL);
   13.20      }
   13.21  
   13.22 -    Amod = (cmod >> 24) & 0xFF;
   13.23 -    Rmod = (cmod >> 16) & 0xFF;
   13.24 -    Gmod = (cmod >> 8) & 0xFF;
   13.25 -    Bmod = (cmod >> 0) & 0xFF;
   13.26 -
   13.27      /* We memory copy to the pixel map so the endianness is preserved */
   13.28      for (i = 0; i < pal->ncolors; ++i) {
   13.29          Uint8 A = Amod;
   13.30 -        Uint8 R = (pal->colors[i].r * Rmod) / 255;
   13.31 -        Uint8 G = (pal->colors[i].g * Gmod) / 255;
   13.32 -        Uint8 B = (pal->colors[i].b * Bmod) / 255;
   13.33 +        Uint8 R = (Uint8) ((pal->colors[i].r * Rmod) / 255);
   13.34 +        Uint8 G = (Uint8) ((pal->colors[i].g * Gmod) / 255);
   13.35 +        Uint8 B = (Uint8) ((pal->colors[i].b * Bmod) / 255);
   13.36          ASSEMBLE_RGBA(&map[i * bpp], dst->BytesPerPixel, dst, R, G, B, A);
   13.37      }
   13.38      return (map);
   13.39 @@ -725,7 +720,10 @@
   13.40          SDL_OutOfMemory();
   13.41          return (NULL);
   13.42      }
   13.43 -    map->cmod = 0xFFFFFFFF;
   13.44 +    map->info.r = 0xFF;
   13.45 +    map->info.g = 0xFF;
   13.46 +    map->info.b = 0xFF;
   13.47 +    map->info.a = 0xFF;
   13.48  
   13.49      /* It's ready to go */
   13.50      return (map);
   13.51 @@ -739,9 +737,9 @@
   13.52      }
   13.53      map->dst = NULL;
   13.54      map->format_version = (unsigned int) -1;
   13.55 -    if (map->table) {
   13.56 -        SDL_free(map->table);
   13.57 -        map->table = NULL;
   13.58 +    if (map->info.table) {
   13.59 +        SDL_free(map->info.table);
   13.60 +        map->info.table = NULL;
   13.61      }
   13.62  }
   13.63  int
   13.64 @@ -767,10 +765,10 @@
   13.65          switch (dstfmt->BytesPerPixel) {
   13.66          case 1:
   13.67              /* Palette --> Palette */
   13.68 -            map->table =
   13.69 +            map->info.table =
   13.70                  Map1to1(srcfmt->palette, dstfmt->palette, &map->identity);
   13.71              if (!map->identity) {
   13.72 -                if (map->table == NULL) {
   13.73 +                if (map->info.table == NULL) {
   13.74                      return (-1);
   13.75                  }
   13.76              }
   13.77 @@ -780,8 +778,10 @@
   13.78  
   13.79          default:
   13.80              /* Palette --> BitField */
   13.81 -            map->table = Map1toN(srcfmt, src->map->cmod, dstfmt);
   13.82 -            if (map->table == NULL) {
   13.83 +            map->info.table =
   13.84 +                Map1toN(srcfmt, src->map->info.r, src->map->info.g,
   13.85 +                        src->map->info.b, src->map->info.a, dstfmt);
   13.86 +            if (map->info.table == NULL) {
   13.87                  return (-1);
   13.88              }
   13.89              break;
   13.90 @@ -791,9 +791,9 @@
   13.91          switch (dstfmt->BytesPerPixel) {
   13.92          case 1:
   13.93              /* BitField --> Palette */
   13.94 -            map->table = MapNto1(srcfmt, dstfmt, &map->identity);
   13.95 +            map->info.table = MapNto1(srcfmt, dstfmt, &map->identity);
   13.96              if (!map->identity) {
   13.97 -                if (map->table == NULL) {
   13.98 +                if (map->info.table == NULL) {
   13.99                      return (-1);
  13.100                  }
  13.101              }
    14.1 --- a/src/video/SDL_renderer_sw.c	Sat Aug 18 01:44:21 2007 +0000
    14.2 +++ b/src/video/SDL_renderer_sw.c	Sat Aug 18 05:39:09 2007 +0000
    14.3 @@ -26,7 +26,6 @@
    14.4  #include "SDL_pixels_c.h"
    14.5  #include "SDL_rect_c.h"
    14.6  #include "SDL_yuv_sw_c.h"
    14.7 -#include "SDL_rendercopy.h"
    14.8  
    14.9  
   14.10  /* SDL surface based renderer implementation */
   14.11 @@ -431,81 +430,33 @@
   14.12      }
   14.13  }
   14.14  
   14.15 -static void
   14.16 -SW_UpdateRenderCopyFunc(SDL_Renderer * renderer, SDL_Texture * texture)
   14.17 -{
   14.18 -    SDL_Window *window = SDL_GetWindowFromID(renderer->window);
   14.19 -    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   14.20 -    SDL_DisplayMode *displayMode = &display->current_mode;
   14.21 -    SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
   14.22 -
   14.23 -    /* We only need a special copy function for advanced features */
   14.24 -    if (texture->modMode
   14.25 -        || (texture->
   14.26 -            blendMode & (SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD))
   14.27 -        || texture->scaleMode) {
   14.28 -        surface->userdata =
   14.29 -            SDL_GetRenderCopyFunc(texture->format, displayMode->format,
   14.30 -                                  texture->modMode, texture->blendMode,
   14.31 -                                  texture->scaleMode);
   14.32 -    } else {
   14.33 -        surface->userdata = NULL;
   14.34 -    }
   14.35 -}
   14.36 -
   14.37  static int
   14.38  SW_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
   14.39  {
   14.40 -    SW_UpdateRenderCopyFunc(renderer, texture);
   14.41 -    return 0;
   14.42 +    SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
   14.43 +    return SDL_SetSurfaceColorMod(surface, texture->r, texture->g,
   14.44 +                                  texture->b);
   14.45  }
   14.46  
   14.47  static int
   14.48  SW_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
   14.49  {
   14.50 -    SW_UpdateRenderCopyFunc(renderer, texture);
   14.51 -    return 0;
   14.52 +    SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
   14.53 +    return SDL_SetSurfaceAlphaMod(surface, texture->a);
   14.54  }
   14.55  
   14.56  static int
   14.57  SW_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
   14.58  {
   14.59 -    switch (texture->blendMode) {
   14.60 -    case SDL_TEXTUREBLENDMODE_NONE:
   14.61 -    case SDL_TEXTUREBLENDMODE_MASK:
   14.62 -    case SDL_TEXTUREBLENDMODE_BLEND:
   14.63 -    case SDL_TEXTUREBLENDMODE_ADD:
   14.64 -    case SDL_TEXTUREBLENDMODE_MOD:
   14.65 -        SW_UpdateRenderCopyFunc(renderer, texture);
   14.66 -        return 0;
   14.67 -    default:
   14.68 -        SDL_Unsupported();
   14.69 -        texture->blendMode = SDL_TEXTUREBLENDMODE_NONE;
   14.70 -        SW_UpdateRenderCopyFunc(renderer, texture);
   14.71 -        return -1;
   14.72 -    }
   14.73 +    SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
   14.74 +    return SDL_SetSurfaceBlendMode(surface, texture->blendMode);
   14.75  }
   14.76  
   14.77  static int
   14.78  SW_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture)
   14.79  {
   14.80 -    switch (texture->scaleMode) {
   14.81 -    case SDL_TEXTURESCALEMODE_NONE:
   14.82 -    case SDL_TEXTURESCALEMODE_FAST:
   14.83 -        SW_UpdateRenderCopyFunc(renderer, texture);
   14.84 -        return 0;
   14.85 -    case SDL_TEXTURESCALEMODE_SLOW:
   14.86 -    case SDL_TEXTURESCALEMODE_BEST:
   14.87 -        SDL_Unsupported();
   14.88 -        texture->scaleMode = SDL_TEXTURESCALEMODE_FAST;
   14.89 -        SW_UpdateRenderCopyFunc(renderer, texture);
   14.90 -        return -1;
   14.91 -    default:
   14.92 -        SDL_Unsupported();
   14.93 -        texture->scaleMode = SDL_TEXTURESCALEMODE_NONE;
   14.94 -        SW_UpdateRenderCopyFunc(renderer, texture);
   14.95 -        return -1;
   14.96 -    }
   14.97 +    SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
   14.98 +    return SDL_SetSurfaceBlendMode(surface, texture->scaleMode);
   14.99  }
  14.100  
  14.101  static int
  14.102 @@ -629,60 +580,18 @@
  14.103                                  data->surface.pixels, data->surface.pitch);
  14.104      } else {
  14.105          SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
  14.106 -        SDL_RenderCopyFunc copyfunc = (SDL_RenderCopyFunc) surface->userdata;
  14.107 +        SDL_Rect real_srcrect = *srcrect;
  14.108 +        SDL_Rect real_dstrect;
  14.109  
  14.110 -        if (copyfunc) {
  14.111 -            SDL_RenderCopyData copydata;
  14.112 +        data->surface.w = dstrect->w;
  14.113 +        data->surface.h = dstrect->h;
  14.114 +        data->surface.clip_rect.w = dstrect->w;
  14.115 +        data->surface.clip_rect.h = dstrect->h;
  14.116 +        real_dstrect = data->surface.clip_rect;
  14.117  
  14.118 -            copydata.src =
  14.119 -                (Uint8 *) surface->pixels + srcrect->y * surface->pitch +
  14.120 -                srcrect->x * surface->format->BytesPerPixel;
  14.121 -            copydata.src_w = srcrect->w;
  14.122 -            copydata.src_h = srcrect->h;
  14.123 -            copydata.src_pitch = surface->pitch;
  14.124 -            copydata.dst = (Uint8 *) data->surface.pixels;
  14.125 -            copydata.dst_w = dstrect->w;
  14.126 -            copydata.dst_h = dstrect->h;
  14.127 -            copydata.dst_pitch = data->surface.pitch;
  14.128 -            copydata.flags = 0;
  14.129 -            if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) {
  14.130 -                copydata.flags |= SDL_RENDERCOPY_MODULATE_COLOR;
  14.131 -                copydata.r = texture->r;
  14.132 -                copydata.g = texture->g;
  14.133 -                copydata.b = texture->b;
  14.134 -            }
  14.135 -            if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) {
  14.136 -                copydata.flags |= SDL_RENDERCOPY_MODULATE_ALPHA;
  14.137 -                copydata.a = texture->a;
  14.138 -            }
  14.139 -            if (texture->blendMode & SDL_TEXTUREBLENDMODE_MASK) {
  14.140 -                copydata.flags |= SDL_RENDERCOPY_MASK;
  14.141 -            } else if (texture->blendMode & SDL_TEXTUREBLENDMODE_BLEND) {
  14.142 -                copydata.flags |= SDL_RENDERCOPY_BLEND;
  14.143 -            } else if (texture->blendMode & SDL_TEXTUREBLENDMODE_ADD) {
  14.144 -                copydata.flags |= SDL_RENDERCOPY_ADD;
  14.145 -            } else if (texture->blendMode & SDL_TEXTUREBLENDMODE_MOD) {
  14.146 -                copydata.flags |= SDL_RENDERCOPY_MOD;
  14.147 -            }
  14.148 -            if (texture->scaleMode) {
  14.149 -                copydata.flags |= SDL_RENDERCOPY_NEAREST;
  14.150 -            }
  14.151 -            copyfunc(&copydata);
  14.152 -            status = 0;
  14.153 -        } else {
  14.154 -            SDL_Rect real_srcrect = *srcrect;
  14.155 -            SDL_Rect real_dstrect;
  14.156 -
  14.157 -            data->surface.w = dstrect->w;
  14.158 -            data->surface.h = dstrect->h;
  14.159 -            data->surface.clip_rect.w = dstrect->w;
  14.160 -            data->surface.clip_rect.h = dstrect->h;
  14.161 -            real_dstrect = data->surface.clip_rect;
  14.162 -
  14.163 -            status =
  14.164 -                SDL_LowerBlit(surface, &real_srcrect, &data->surface,
  14.165 -                              &real_dstrect);
  14.166 -        }
  14.167 +        status =
  14.168 +            SDL_LowerBlit(surface, &real_srcrect, &data->surface,
  14.169 +                          &real_dstrect);
  14.170      }
  14.171      data->renderer->UnlockTexture(data->renderer,
  14.172                                    data->texture[data->current_texture]);
    15.1 --- a/src/video/SDL_surface.c	Sat Aug 18 01:44:21 2007 +0000
    15.2 +++ b/src/video/SDL_surface.c	Sat Aug 18 05:39:09 2007 +0000
    15.3 @@ -53,9 +53,6 @@
    15.4          SDL_FreeSurface(surface);
    15.5          return NULL;
    15.6      }
    15.7 -    if (Amask) {
    15.8 -        surface->flags |= SDL_SRCALPHA;
    15.9 -    }
   15.10      surface->w = width;
   15.11      surface->h = height;
   15.12      surface->pitch = SDL_CalculatePitch(surface);
   15.13 @@ -138,6 +135,11 @@
   15.14      }
   15.15      SDL_FormatChanged(surface);
   15.16  
   15.17 +    /* By default surface with an alpha mask are set up for blending */
   15.18 +    if (Amask) {
   15.19 +        SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_BLEND);
   15.20 +    }
   15.21 +
   15.22      /* The surface is ready to go */
   15.23      surface->refcount = 1;
   15.24  #ifdef CHECK_LEAKS
   15.25 @@ -212,26 +214,29 @@
   15.26      return 0;
   15.27  }
   15.28  
   15.29 -int SDL_SetSurfaceRLE(SDL_Surface *surface, int flag)
   15.30 +int
   15.31 +SDL_SetSurfaceRLE(SDL_Surface * surface, int flag)
   15.32  {
   15.33 -    Uint32 flags;
   15.34 +    int flags;
   15.35  
   15.36      if (!surface) {
   15.37          return -1;
   15.38      }
   15.39  
   15.40 +    flags = surface->map->info.flags;
   15.41      if (flag) {
   15.42 -        surface->flags |= SDL_RLEACCELOK;
   15.43 +        surface->map->info.flags |= SDL_COPY_RLE_DESIRED;
   15.44      } else {
   15.45 -        surface->flags &= ~SDL_RLEACCELOK;
   15.46 +        surface->map->info.flags &= ~SDL_COPY_RLE_DESIRED;
   15.47      }
   15.48 -    if (surface->flags != flags) {
   15.49 +    if (surface->map->info.flags != flags) {
   15.50          SDL_InvalidateMap(surface->map);
   15.51      }
   15.52      return 0;
   15.53  }
   15.54  
   15.55 -int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key)
   15.56 +int
   15.57 +SDL_SetColorKey(SDL_Surface * surface, Uint32 flag, Uint32 key)
   15.58  {
   15.59      int flags;
   15.60  
   15.61 @@ -253,10 +258,19 @@
   15.62      if (surface->map->info.flags != flags) {
   15.63          SDL_InvalidateMap(surface->map);
   15.64      }
   15.65 +
   15.66 +    /* Compatibility mode */
   15.67 +    if (surface->map->info.flags & SDL_COPY_COLORKEY) {
   15.68 +        surface->flags |= SDL_SRCCOLORKEY;
   15.69 +    } else {
   15.70 +        surface->flags &= ~SDL_SRCCOLORKEY;
   15.71 +    }
   15.72 +
   15.73      return 0;
   15.74  }
   15.75  
   15.76 -int SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)
   15.77 +int
   15.78 +SDL_SetSurfaceColorMod(SDL_Surface * surface, Uint8 r, Uint8 g, Uint8 b)
   15.79  {
   15.80      int flags;
   15.81  
   15.82 @@ -281,7 +295,8 @@
   15.83  }
   15.84  
   15.85  
   15.86 -int SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 * r, Uint8 * g, Uint8 * b)
   15.87 +int
   15.88 +SDL_GetSurfaceColorMod(SDL_Surface * surface, Uint8 * r, Uint8 * g, Uint8 * b)
   15.89  {
   15.90      if (!surface) {
   15.91          return -1;
   15.92 @@ -299,7 +314,8 @@
   15.93      return 0;
   15.94  }
   15.95  
   15.96 -int SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha)
   15.97 +int
   15.98 +SDL_SetSurfaceAlphaMod(SDL_Surface * surface, Uint8 alpha)
   15.99  {
  15.100      int flags;
  15.101  
  15.102 @@ -321,7 +337,8 @@
  15.103      return 0;
  15.104  }
  15.105  
  15.106 -int SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 * alpha)
  15.107 +int
  15.108 +SDL_GetSurfaceAlphaMod(SDL_Surface * surface, Uint8 * alpha)
  15.109  {
  15.110      if (!surface) {
  15.111          return -1;
  15.112 @@ -333,7 +350,8 @@
  15.113      return 0;
  15.114  }
  15.115  
  15.116 -int SDL_SetSurfaceBlendMode(SDL_Surface *surface, int blendMode)
  15.117 +int
  15.118 +SDL_SetSurfaceBlendMode(SDL_Surface * surface, int blendMode)
  15.119  {
  15.120      int flags, status;
  15.121  
  15.122 @@ -343,7 +361,8 @@
  15.123  
  15.124      status = 0;
  15.125      flags = surface->map->info.flags;
  15.126 -    surface->map->info.flags &= ~(SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD);
  15.127 +    surface->map->info.flags &=
  15.128 +        ~(SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD);
  15.129      switch (blendMode) {
  15.130      case SDL_TEXTUREBLENDMODE_NONE:
  15.131          break;
  15.132 @@ -368,10 +387,19 @@
  15.133      if (surface->map->info.flags != flags) {
  15.134          SDL_InvalidateMap(surface->map);
  15.135      }
  15.136 +
  15.137 +    /* Compatibility mode */
  15.138 +    if (surface->map->info.flags & SDL_COPY_BLEND) {
  15.139 +        surface->flags |= SDL_SRCALPHA;
  15.140 +    } else {
  15.141 +        surface->flags &= ~SDL_SRCALPHA;
  15.142 +    }
  15.143 +
  15.144      return status;
  15.145  }
  15.146  
  15.147 -int SDL_GetSurfaceBlendMode(SDL_Surface *surface, int *blendMode)
  15.148 +int
  15.149 +SDL_GetSurfaceBlendMode(SDL_Surface * surface, int *blendMode)
  15.150  {
  15.151      if (!surface) {
  15.152          return -1;
  15.153 @@ -381,27 +409,30 @@
  15.154          return 0;
  15.155      }
  15.156  
  15.157 -    switch(surface->map->info.flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  15.158 +    switch (surface->map->info.
  15.159 +            flags & (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD |
  15.160 +                     SDL_COPY_MOD)) {
  15.161      case SDL_COPY_MASK:
  15.162 -        *blendMode = SDL_TEXTUREBLENDMODE_MASK:
  15.163 +        *blendMode = SDL_TEXTUREBLENDMODE_MASK;
  15.164          break;
  15.165      case SDL_COPY_BLEND:
  15.166 -        *blendMode = SDL_TEXTUREBLENDMODE_BLEND:
  15.167 +        *blendMode = SDL_TEXTUREBLENDMODE_BLEND;
  15.168          break;
  15.169      case SDL_COPY_ADD:
  15.170 -        *blendMode = SDL_TEXTUREBLENDMODE_ADD:
  15.171 +        *blendMode = SDL_TEXTUREBLENDMODE_ADD;
  15.172          break;
  15.173      case SDL_COPY_MOD:
  15.174 -        *blendMode = SDL_TEXTUREBLENDMODE_MOD:
  15.175 +        *blendMode = SDL_TEXTUREBLENDMODE_MOD;
  15.176          break;
  15.177      default:
  15.178 -        *blendMode = SDL_TEXTUREBLENDMODE_NONE:
  15.179 +        *blendMode = SDL_TEXTUREBLENDMODE_NONE;
  15.180          break;
  15.181      }
  15.182      return 0;
  15.183  }
  15.184  
  15.185 -int SDL_SetSurfaceScaleMode(SDL_Surface *surface, int scaleMode)
  15.186 +int
  15.187 +SDL_SetSurfaceScaleMode(SDL_Surface * surface, int scaleMode)
  15.188  {
  15.189      int flags, status;
  15.190  
  15.191 @@ -436,7 +467,8 @@
  15.192      return status;
  15.193  }
  15.194  
  15.195 -int SDL_GetSurfaceScaleMode(SDL_Surface *surface, int *scaleMode)
  15.196 +int
  15.197 +SDL_GetSurfaceScaleMode(SDL_Surface * surface, int *scaleMode)
  15.198  {
  15.199      if (!surface) {
  15.200          return -1;
  15.201 @@ -446,12 +478,12 @@
  15.202          return 0;
  15.203      }
  15.204  
  15.205 -    switch(surface->map->info.flags & (SDL_COPY_LINEAR)) {
  15.206 -    case SDL_COPY_LINEAR:
  15.207 -        *scaleMode = SDL_TEXTURESCALEMODE_FAST:
  15.208 +    switch (surface->map->info.flags & (SDL_COPY_NEAREST)) {
  15.209 +    case SDL_COPY_NEAREST:
  15.210 +        *scaleMode = SDL_TEXTURESCALEMODE_FAST;
  15.211          break;
  15.212      default:
  15.213 -        *scaleMode = SDL_TEXTURESCALEMODE_NONE:
  15.214 +        *scaleMode = SDL_TEXTURESCALEMODE_NONE;
  15.215          break;
  15.216      }
  15.217      return 0;
  15.218 @@ -706,7 +738,8 @@
  15.219      if (copy_flags & SDL_COPY_COLORKEY) {
  15.220          Uint8 keyR, keyG, keyB, keyA;
  15.221  
  15.222 -        SDL_GetRGBA(colorkey, surface->format, &keyR, &keyG, &keyB, &keyA);
  15.223 +        SDL_GetRGBA(surface->map->info.colorkey, surface->format, &keyR,
  15.224 +                    &keyG, &keyB, &keyA);
  15.225          SDL_SetColorKey(convert, 1,
  15.226                          SDL_MapRGBA(convert->format, keyR, keyG, keyB, keyA));
  15.227      }
    16.1 --- a/src/video/SDL_video.c	Sat Aug 18 01:44:21 2007 +0000
    16.2 +++ b/src/video/SDL_video.c	Sat Aug 18 05:39:09 2007 +0000
    16.3 @@ -1552,7 +1552,9 @@
    16.4              return 0;
    16.5          }
    16.6      } else {
    16.7 -        if (surface->format->Amask || !(flags & (SDL_COPY_COLORKEY|SDL_COPY_MASK|SDL_COPY_BLEND))) {
    16.8 +        if (surface->format->Amask
    16.9 +            || !(surface->map->info.flags &
   16.10 +                 (SDL_COPY_COLORKEY | SDL_COPY_MASK | SDL_COPY_BLEND))) {
   16.11              bpp = fmt->BitsPerPixel;
   16.12              Rmask = fmt->Rmask;
   16.13              Gmask = fmt->Gmask;
   16.14 @@ -1602,31 +1604,34 @@
   16.15          dst_fmt = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask);
   16.16          if (dst_fmt) {
   16.17              if (SDL_ISPIXELFORMAT_INDEXED(format)) {
   16.18 -                dst_fmt->palette = SDL_AllocPalette((1 << SDL_BITSPERPIXEL(format)));
   16.19 +                dst_fmt->palette =
   16.20 +                    SDL_AllocPalette((1 << SDL_BITSPERPIXEL(format)));
   16.21                  if (dst_fmt->palette) {
   16.22 -                    if (fmt->palette) {
   16.23 -fixme
   16.24 -                    } else {
   16.25 -                        SDL_DitherColors(dst_fmt->palette->colors, SDL_BITSPERPIXEL(format));
   16.26 -                    }
   16.27 -                }
   16.28 -                if (fmt->palette) {
   16.29 -                    dst_fmt->palette = fmt->palette;
   16.30 -                } else {
   16.31 +                    /* FIXME: Should we try to copy fmt->palette? */
   16.32 +                    SDL_DitherColors(dst_fmt->palette->colors,
   16.33 +                                     SDL_BITSPERPIXEL(format));
   16.34                  }
   16.35              }
   16.36  
   16.37 -            cvt = SDL_ConvertSurface(surface, fmt, 0);
   16.38 -            if (cvt) {
   16.39 -                SDL_UpdateTexture(textureID, NULL, cvt->pixels, cvt->pitch);
   16.40 -                SDL_FreeSurface(cvt);
   16.41 +            dst = SDL_ConvertSurface(surface, dst_fmt, 0);
   16.42 +            if (dst) {
   16.43 +                SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch);
   16.44 +                SDL_FreeSurface(dst);
   16.45              }
   16.46 -            SDL_FreeFormat(fmt);
   16.47 +            if (dst_fmt->palette) {
   16.48 +                SDL_FreePalette(dst_fmt->palette);
   16.49 +            }
   16.50 +            SDL_FreeFormat(dst_fmt);
   16.51 +        }
   16.52 +        if (!dst) {
   16.53 +            SDL_DestroyTexture(textureID);
   16.54 +            return 0;
   16.55          }
   16.56      }
   16.57  
   16.58      if (SDL_ISPIXELFORMAT_INDEXED(format) && fmt->palette) {
   16.59 -        SDL_SetTexturePalette(textureID, fmt->palette->colors, 0, fmt->palette->ncolors);
   16.60 +        SDL_SetTexturePalette(textureID, fmt->palette->colors, 0,
   16.61 +                              fmt->palette->ncolors);
   16.62      }
   16.63  
   16.64      return textureID;
    17.1 --- a/src/video/dummy/SDL_nullrender.c	Sat Aug 18 01:44:21 2007 +0000
    17.2 +++ b/src/video/dummy/SDL_nullrender.c	Sat Aug 18 05:39:09 2007 +0000
    17.3 @@ -25,7 +25,6 @@
    17.4  #include "../SDL_sysvideo.h"
    17.5  #include "../SDL_yuv_sw_c.h"
    17.6  #include "../SDL_renderer_sw.h"
    17.7 -#include "../SDL_rendercopy.h"
    17.8  
    17.9  
   17.10  /* SDL surface based renderer implementation */
   17.11 @@ -160,55 +159,10 @@
   17.12      } else {
   17.13          SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
   17.14          SDL_Surface *target = data->screens[data->current_screen];
   17.15 -        SDL_RenderCopyFunc copyfunc = (SDL_RenderCopyFunc) surface->userdata;
   17.16 +        SDL_Rect real_srcrect = *srcrect;
   17.17 +        SDL_Rect real_dstrect = *dstrect;
   17.18  
   17.19 -        if (copyfunc) {
   17.20 -            SDL_RenderCopyData copydata;
   17.21 -
   17.22 -            copydata.src =
   17.23 -                (Uint8 *) surface->pixels + srcrect->y * surface->pitch +
   17.24 -                srcrect->x * surface->format->BytesPerPixel;
   17.25 -            copydata.src_w = srcrect->w;
   17.26 -            copydata.src_h = srcrect->h;
   17.27 -            copydata.src_pitch = surface->pitch;
   17.28 -            copydata.dst =
   17.29 -                (Uint8 *) target->pixels + dstrect->y * target->pitch +
   17.30 -                dstrect->x * target->format->BytesPerPixel;
   17.31 -            copydata.dst_w = dstrect->w;
   17.32 -            copydata.dst_h = dstrect->h;
   17.33 -            copydata.dst_pitch = target->pitch;
   17.34 -            copydata.flags = 0;
   17.35 -            if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) {
   17.36 -                copydata.flags |= SDL_RENDERCOPY_MODULATE_COLOR;
   17.37 -                copydata.r = texture->r;
   17.38 -                copydata.g = texture->g;
   17.39 -                copydata.b = texture->b;
   17.40 -            }
   17.41 -            if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) {
   17.42 -                copydata.flags |= SDL_RENDERCOPY_MODULATE_ALPHA;
   17.43 -                copydata.a = texture->a;
   17.44 -            }
   17.45 -            if (texture->blendMode & SDL_TEXTUREBLENDMODE_MASK) {
   17.46 -                copydata.flags |= SDL_RENDERCOPY_MASK;
   17.47 -            } else if (texture->blendMode & SDL_TEXTUREBLENDMODE_BLEND) {
   17.48 -                copydata.flags |= SDL_RENDERCOPY_BLEND;
   17.49 -            } else if (texture->blendMode & SDL_TEXTUREBLENDMODE_ADD) {
   17.50 -                copydata.flags |= SDL_RENDERCOPY_ADD;
   17.51 -            } else if (texture->blendMode & SDL_TEXTUREBLENDMODE_MOD) {
   17.52 -                copydata.flags |= SDL_RENDERCOPY_MOD;
   17.53 -            }
   17.54 -            if (texture->scaleMode) {
   17.55 -                copydata.flags |= SDL_RENDERCOPY_NEAREST;
   17.56 -            }
   17.57 -            copyfunc(&copydata);
   17.58 -            return 0;
   17.59 -        } else {
   17.60 -            SDL_Rect real_srcrect = *srcrect;
   17.61 -            SDL_Rect real_dstrect = *dstrect;
   17.62 -
   17.63 -            return SDL_LowerBlit(surface, &real_srcrect, target,
   17.64 -                                 &real_dstrect);
   17.65 -        }
   17.66 +        return SDL_LowerBlit(surface, &real_srcrect, target, &real_dstrect);
   17.67      }
   17.68  }
   17.69  
    18.1 --- a/src/video/sdlgenblit.pl	Sat Aug 18 01:44:21 2007 +0000
    18.2 +++ b/src/video/sdlgenblit.pl	Sat Aug 18 05:39:09 2007 +0000
    18.3 @@ -384,7 +384,7 @@
    18.4  sub output_copyfunctable
    18.5  {
    18.6      print FILE <<__EOF__;
    18.7 -static SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = {
    18.8 +SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = {
    18.9  __EOF__
   18.10      for (my $i = 0; $i <= $#src_formats; ++$i) {
   18.11          my $src = $src_formats[$i];
    19.1 --- a/test/testalpha.c	Sat Aug 18 01:44:21 2007 +0000
    19.2 +++ b/test/testalpha.c	Sat Aug 18 05:39:09 2007 +0000
    19.3 @@ -253,7 +253,7 @@
    19.4  MoveSprite(SDL_Surface * screen, SDL_Surface * light)
    19.5  {
    19.6      SDL_Rect updates[2];
    19.7 -    int alpha;
    19.8 +    Uint8 alpha;
    19.9  
   19.10      /* Erase the sprite if it was visible */
   19.11      if (sprite_visible) {
   19.12 @@ -290,10 +290,10 @@
   19.13      }
   19.14  
   19.15      /* Update transparency (fade in and out) */
   19.16 -    alpha = sprite->format->alpha;
   19.17 -    if ((alpha + alpha_vel) < 0) {
   19.18 +    SDL_GetSurfaceAlphaMod(sprite, &alpha);
   19.19 +    if (((int) alpha + alpha_vel) < 0) {
   19.20          alpha_vel = -alpha_vel;
   19.21 -    } else if ((alpha + alpha_vel) > 255) {
   19.22 +    } else if (((int) alpha + alpha_vel) > 255) {
   19.23          alpha_vel = -alpha_vel;
   19.24      }
   19.25      SDL_SetAlpha(sprite, SDL_SRCALPHA, (Uint8) (alpha + alpha_vel));
    20.1 --- a/test/testblitspeed.c	Sat Aug 18 01:44:21 2007 +0000
    20.2 +++ b/test/testblitspeed.c	Sat Aug 18 05:39:09 2007 +0000
    20.3 @@ -91,9 +91,6 @@
    20.4          printf("  depth      : %d bits per pixel\n",
    20.5                 surface->format->BitsPerPixel);
    20.6          printf("  pitch      : %d\n", (int) surface->pitch);
    20.7 -        printf("  alpha      : %d\n", (int) surface->format->alpha);
    20.8 -        printf("  colorkey   : 0x%X\n",
    20.9 -               (unsigned int) surface->format->colorkey);
   20.10  
   20.11          printf("  red bits   : 0x%08X mask, %d shift, %d loss\n",
   20.12                 (int) surface->format->Rmask,
   20.13 @@ -216,8 +213,10 @@
   20.14      Uint32 origdstalphaflags = 0;
   20.15      Uint32 srcalphaflags = 0;
   20.16      Uint32 dstalphaflags = 0;
   20.17 -    int srcalpha = 255;
   20.18 -    int dstalpha = 255;
   20.19 +    Uint8 origsrcalpha = 255;
   20.20 +    Uint8 origdstalpha = 255;
   20.21 +    Uint8 srcalpha = 255;
   20.22 +    Uint8 dstalpha = 255;
   20.23      int screenSurface = 0;
   20.24      int i = 0;
   20.25  
   20.26 @@ -313,8 +312,10 @@
   20.27          (dest->flags & SDL_SRCALPHA) | (dest->flags & SDL_RLEACCEL);
   20.28      origsrcalphaflags = srcalphaflags;
   20.29      origdstalphaflags = dstalphaflags;
   20.30 -    srcalpha = src->format->alpha;
   20.31 -    dstalpha = dest->format->alpha;
   20.32 +    SDL_GetSurfaceAlphaMod(src, &srcalpha);
   20.33 +    SDL_GetSurfaceAlphaMod(dest, &dstalpha);
   20.34 +    origsrcalpha = srcalpha;
   20.35 +    origdstalpha = dstalpha;
   20.36      for (i = 1; i < argc; i++) {
   20.37          const char *arg = argv[i];
   20.38  
   20.39 @@ -339,12 +340,10 @@
   20.40          else if (strcmp(arg, "--dstnorleaccel") == 0)
   20.41              dstalphaflags &= ~SDL_RLEACCEL;
   20.42      }
   20.43 -    if ((dstalphaflags != origdstalphaflags)
   20.44 -        || (dstalpha != dest->format->alpha))
   20.45 -        SDL_SetAlpha(dest, dstalphaflags, (Uint8) dstalpha);
   20.46 -    if ((srcalphaflags != origsrcalphaflags)
   20.47 -        || (srcalpha != src->format->alpha))
   20.48 -        SDL_SetAlpha(src, srcalphaflags, (Uint8) srcalpha);
   20.49 +    if ((dstalphaflags != origdstalphaflags) || (origdstalpha != dstalpha))
   20.50 +        SDL_SetAlpha(dest, dstalphaflags, dstalpha);
   20.51 +    if ((srcalphaflags != origsrcalphaflags) || (origsrcalpha != srcalpha))
   20.52 +        SDL_SetAlpha(src, srcalphaflags, srcalpha);
   20.53  
   20.54      /* set some sane defaults so we can see if the blit code is broken... */
   20.55      SDL_FillRect(dest, NULL, SDL_MapRGB(dest->format, 0, 0, 0));
    21.1 --- a/test/testgl.c	Sat Aug 18 01:44:21 2007 +0000
    21.2 +++ b/test/testgl.c	Sat Aug 18 05:39:09 2007 +0000
    21.3 @@ -201,7 +201,7 @@
    21.4  
    21.5      /* Save the alpha blending attributes */
    21.6      saved_flags = surface->flags & (SDL_SRCALPHA | SDL_RLEACCELOK);
    21.7 -    saved_alpha = surface->format->alpha;
    21.8 +    SDL_GetSurfaceAlphaMod(surface, &saved_alpha);
    21.9      if ((saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA) {
   21.10          SDL_SetAlpha(surface, 0, 0);
   21.11      }
    22.1 --- a/test/testoverlay.c	Sat Aug 18 01:44:21 2007 +0000
    22.2 +++ b/test/testoverlay.c	Sat Aug 18 05:39:09 2007 +0000
    22.3 @@ -487,8 +487,6 @@
    22.4          format.Gloss = 0;
    22.5          format.Bloss = 0;
    22.6          format.Aloss = 8;
    22.7 -        format.colorkey = 0;
    22.8 -        format.alpha = 0;
    22.9  
   22.10          newsurf = SDL_ConvertSurface(pic, &format, SDL_SWSURFACE);
   22.11          if (!newsurf) {
    23.1 --- a/test/testoverlay2.c	Sat Aug 18 01:44:21 2007 +0000
    23.2 +++ b/test/testoverlay2.c	Sat Aug 18 05:39:09 2007 +0000
    23.3 @@ -521,8 +521,6 @@
    23.4              format.Gloss = 0;
    23.5              format.Bloss = 0;
    23.6              format.Aloss = 8;
    23.7 -            format.colorkey = 0;
    23.8 -            format.alpha = 0;
    23.9  
   23.10              newsurf =
   23.11                  SDL_ConvertSurface(MooseFrame[i], &format, SDL_SWSURFACE);