Work in progress: merging new texture features into SDL blit system
authorSam Lantinga <slouken@libsdl.org>
Fri, 17 Aug 2007 06:21:58 +0000
changeset 2262bee005ace1bf
parent 2261 c20476d7d7b3
child 2263 900c35d8e8fd
Work in progress: merging new texture features into SDL blit system
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_auto.h
src/video/SDL_blit_copy.c
src/video/SDL_rendercopy.c
src/video/SDL_rendercopy.h
src/video/SDL_renderer_sw.c
src/video/dummy/SDL_nullrender.c
src/video/sdlgenblit.pl
     1.1 --- a/src/video/SDL_RLEaccel.c	Fri Aug 17 03:22:03 2007 +0000
     1.2 +++ b/src/video/SDL_RLEaccel.c	Fri Aug 17 06:21:58 2007 +0000
     1.3 @@ -906,7 +906,7 @@
     1.4      }
     1.5  
     1.6      alpha = (src->flags & SDL_SRCALPHA) == SDL_SRCALPHA
     1.7 -        ? (src->map->cmod >> 24) : 255;
     1.8 +        ? src->map->info.a : 255;
     1.9      /* if left or right edge clipping needed, call clip blit */
    1.10      if (srcrect->x || srcrect->w != src->w) {
    1.11          RLEClipBlit(w, srcbuf, dst, dstbuf, srcrect, alpha);
    1.12 @@ -1715,7 +1715,7 @@
    1.13      skip = run = 0;
    1.14      dst = rlebuf;
    1.15      rgbmask = ~surface->format->Amask;
    1.16 -    ckey = surface->map->ckey & rgbmask;
    1.17 +    ckey = surface->map->info.colorkey & rgbmask;
    1.18      lastline = dst;
    1.19      getpix = getpixes[bpp - 1];
    1.20      w = surface->w;
    1.21 @@ -1948,7 +1948,7 @@
    1.22                  }
    1.23  
    1.24                  /* fill it with the background colour */
    1.25 -                SDL_FillRect(surface, NULL, surface->map->ckey);
    1.26 +                SDL_FillRect(surface, NULL, surface->map->info.colorkey);
    1.27  
    1.28                  /* now render the encoded surface */
    1.29                  full.x = full.y = 0;
     2.1 --- a/src/video/SDL_blit.c	Fri Aug 17 03:22:03 2007 +0000
     2.2 +++ b/src/video/SDL_blit.c	Fri Aug 17 06:21:58 2007 +0000
     2.3 @@ -61,31 +61,23 @@
     2.4  
     2.5      /* Set up source and destination buffer pointers, and BLIT! */
     2.6      if (okay && srcrect->w && srcrect->h) {
     2.7 -        SDL_BlitInfo info;
     2.8 -        SDL_loblit RunBlit;
     2.9 +        SDL_BlitInfo *info = &src->map->info;
    2.10  
    2.11          /* Set up the blit information */
    2.12 -        info.s_pixels = (Uint8 *) src->pixels +
    2.13 +        info->src = (Uint8 *) src->pixels +
    2.14              (Uint16) srcrect->y * src->pitch +
    2.15 -            (Uint16) srcrect->x * src->format->BytesPerPixel;
    2.16 -        info.s_width = srcrect->w;
    2.17 -        info.s_height = srcrect->h;
    2.18 -        info.s_skip = src->pitch - info.s_width * src->format->BytesPerPixel;
    2.19 -        info.d_pixels = (Uint8 *) dst->pixels +
    2.20 +            (Uint16) srcrect->x * info->src_fmt->BytesPerPixel;
    2.21 +        info.src_w = srcrect->w;
    2.22 +        info.src_h = srcrect->h;
    2.23 +        info.dst = (Uint8 *) dst->pixels +
    2.24              (Uint16) dstrect->y * dst->pitch +
    2.25 -            (Uint16) dstrect->x * dst->format->BytesPerPixel;
    2.26 -        info.d_width = dstrect->w;
    2.27 -        info.d_height = dstrect->h;
    2.28 -        info.d_skip = dst->pitch - info.d_width * dst->format->BytesPerPixel;
    2.29 -        info.src = src->format;
    2.30 -        info.table = src->map->table;
    2.31 -        info.dst = dst->format;
    2.32 -        info.ckey = src->map->ckey;
    2.33 -        info.cmod = src->map->cmod;
    2.34 -        RunBlit = (SDL_loblit) src->map->data;
    2.35 +            (Uint16) dstrect->x * info->dst_fmt->BytesPerPixel;
    2.36 +        info.dst_w = dstrect->w;
    2.37 +        info.dst_h = dstrect->h;
    2.38 +        RunBlit = (SDL_BlitFunc) src->map->data;
    2.39  
    2.40          /* Run the actual software blit */
    2.41 -        RunBlit(&info);
    2.42 +        RunBlit(info);
    2.43      }
    2.44  
    2.45      /* We need to unlock the surfaces if they're locked */
    2.46 @@ -124,50 +116,67 @@
    2.47  }
    2.48  #endif /* __MACOSX__ */
    2.49  
    2.50 -static SDL_loblit
    2.51 -SDL_ChooseBlitFunc(SDL_BlitEntry * entries, int count)
    2.52 +static SDL_BlitFunc
    2.53 +SDL_ChooseBlitFunc(Uint32 src_format, Uint32 dst_format, int flags, SDL_BlitEntry * entries)
    2.54  {
    2.55      int i;
    2.56      static Uint32 features = 0xffffffff;
    2.57  
    2.58 +    /* Get the available CPU features */
    2.59      if (features == 0xffffffff) {
    2.60 -        const char *override = SDL_getenv("SDL_BLIT_FEATURES");
    2.61 +        const char *override = SDL_getenv("SDL_BLIT_CPU_FEATURES");
    2.62  
    2.63 -        features = SDL_BLIT_ANY;
    2.64 +        features = SDL_CPU_ANY;
    2.65  
    2.66          /* Allow an override for testing .. */
    2.67          if (override) {
    2.68              SDL_sscanf(override, "%u", &features);
    2.69          } else {
    2.70              if (SDL_HasMMX()) {
    2.71 -                features |= SDL_BLIT_MMX;
    2.72 +                features |= SDL_CPU_MMX;
    2.73 +            }
    2.74 +            if (SDL_Has3DNow()) {
    2.75 +                features |= SDL_CPU_3DNOW;
    2.76              }
    2.77              if (SDL_HasSSE()) {
    2.78 -                features |= SDL_BLIT_SSE;
    2.79 +                features |= SDL_CPU_SSE;
    2.80 +            }
    2.81 +            if (SDL_HasSSE2()) {
    2.82 +                features |= SDL_CPU_SSE2;
    2.83              }
    2.84              if (SDL_HasAltiVec()) {
    2.85                  if (SDL_UseAltivecPrefetch()) {
    2.86 -                    features |= SDL_BLIT_ALTIVEC_PREFETCH;
    2.87 +                    features |= SDL_CPU_ALTIVEC_PREFETCH;
    2.88                  } else {
    2.89 -                    features |= SDL_BLIT_ALTIVEC_NOPREFETCH;
    2.90 +                    features |= SDL_CPU_ALTIVEC_NOPREFETCH;
    2.91                  }
    2.92              }
    2.93          }
    2.94      }
    2.95  
    2.96 -    for (i = count; i > 0; --i) {
    2.97 -        if (features & entries[i].features) {
    2.98 -            return entries[i].blit;
    2.99 +    for (i = 0; entries[i].blit; ++i) {
   2.100 +        if (src_format != entries[i].src_format) {
   2.101 +            continue;
   2.102          }
   2.103 +        if (dst_format != entries[i].dst_format) {
   2.104 +            continue;
   2.105 +        }
   2.106 +        if ((flags & entries[i].flags) != flags) {
   2.107 +            continue;
   2.108 +        }
   2.109 +        if (!(features & entries[i].cpu)) {
   2.110 +            continue;
   2.111 +        }
   2.112 +        return entries[i].func;
   2.113      }
   2.114 -    return entries[0].blit;
   2.115 +    return NULL;
   2.116  }
   2.117  
   2.118  /* Figure out which of many blit routines to set up on a surface */
   2.119  int
   2.120  SDL_CalculateBlit(SDL_Surface * surface)
   2.121  {
   2.122 -    SDL_loblit blit = NULL;
   2.123 +    SDL_BlitFunc blit = NULL;
   2.124      int blit_index;
   2.125  
   2.126      /* Clean everything out to start */
   2.127 @@ -210,6 +219,10 @@
   2.128              }
   2.129          }
   2.130      }
   2.131 +    if (blit == NULL) {
   2.132 +        blit = SDL_ChooseBlitFunc(src_format, dst_format, surface->map->info.flags, SDL_GeneratedBlitFuncTable);
   2.133 +    }
   2.134 +
   2.135      /* Make sure we have a blit function */
   2.136      if (blit == NULL) {
   2.137          SDL_InvalidateMap(surface->map);
     3.1 --- a/src/video/SDL_blit.h	Fri Aug 17 03:22:03 2007 +0000
     3.2 +++ b/src/video/SDL_blit.h	Fri Aug 17 06:21:58 2007 +0000
     3.3 @@ -33,67 +33,74 @@
     3.4  #ifdef __SSE__
     3.5  #include <xmmintrin.h>
     3.6  #endif
     3.7 +#ifdef __SSE2__
     3.8 +#include <emmintrin.h>
     3.9 +#endif
    3.10  
    3.11  #include "SDL_cpuinfo.h"
    3.12  #include "SDL_endian.h"
    3.13  
    3.14 -/* The structure passed to the low level blit functions */
    3.15 -typedef struct
    3.16 -{
    3.17 -    Uint8 *s_pixels;
    3.18 -    int s_width;
    3.19 -    int s_height;
    3.20 -    int s_skip;
    3.21 -    Uint8 *d_pixels;
    3.22 -    int d_width;
    3.23 -    int d_height;
    3.24 -    int d_skip;
    3.25 -    SDL_PixelFormat *src;
    3.26 +/* SDL blit copy flags */
    3.27 +#define SDL_COPY_MODULATE_COLOR     0x0001
    3.28 +#define SDL_COPY_MODULATE_ALPHA     0x0002
    3.29 +#define SDL_COPY_MASK               0x0010
    3.30 +#define SDL_COPY_BLEND              0x0020
    3.31 +#define SDL_COPY_ADD                0x0040
    3.32 +#define SDL_COPY_MOD                0x0080
    3.33 +#define SDL_COPY_COLORKEY           0x0100
    3.34 +#define SDL_COPY_NEAREST            0x0200
    3.35 +
    3.36 +/* SDL blit CPU flags */
    3.37 +#define SDL_CPU_ANY                 0x0000
    3.38 +#define SDL_CPU_MMX                 0x0001
    3.39 +#define SDL_CPU_3DNOW               0x0002
    3.40 +#define SDL_CPU_SSE                 0x0004
    3.41 +#define SDL_CPU_SSE2                0x0008
    3.42 +#define SDL_CPU_ALTIVEC_PREFETCH    0x0010
    3.43 +#define SDL_CPU_ALTIVEC_NOPREFETCH  0x0020
    3.44 +
    3.45 +typedef struct {
    3.46 +    Uint8 *src;
    3.47 +    int src_w, src_h;
    3.48 +    int src_pitch;
    3.49 +    Uint8 *dst;
    3.50 +    int dst_w, dst_h;
    3.51 +    int dst_pitch;
    3.52 +    SDL_PixelFormat *src_fmt;
    3.53 +    SDL_PixelFormat *dst_fmt;
    3.54      Uint8 *table;
    3.55 -    SDL_PixelFormat *dst;
    3.56 -    Uint32 ckey, cmod;
    3.57 +    int flags;
    3.58 +    Uint32 colorkey;
    3.59 +    Uint8 r, g, b, a;
    3.60  } SDL_BlitInfo;
    3.61  
    3.62 -/* The type definition for the low level blit functions */
    3.63 -typedef void (*SDL_loblit) (SDL_BlitInfo * info);
    3.64 +typedef void (SDLCALL * SDL_BlitFunc)(SDL_BlitInfo *info);
    3.65 +
    3.66 +typedef struct {
    3.67 +    Uint32 src_format;
    3.68 +    Uint32 dst_format;
    3.69 +    int flags;
    3.70 +    int cpu;
    3.71 +    SDL_BlitFunc func;
    3.72 +} SDL_BlitFuncEntry;
    3.73  
    3.74  /* Blit mapping definition */
    3.75  typedef struct SDL_BlitMap
    3.76  {
    3.77      SDL_Surface *dst;
    3.78      int identity;
    3.79 -    Uint8 *table;
    3.80      SDL_blit blit;
    3.81      void *data;
    3.82 -    Uint32 ckey;                /* colorkey */
    3.83 -    Uint32 cmod;                /* ARGB modulation */
    3.84 +    SDL_BlitInfo info;
    3.85  
    3.86      /* the version count matches the destination; mismatch indicates
    3.87         an invalid mapping */
    3.88      unsigned int format_version;
    3.89  } SDL_BlitMap;
    3.90  
    3.91 -#define SDL_BLIT_ANY                0x00000000
    3.92 -#define SDL_BLIT_MMX                0x00000001
    3.93 -#define SDL_BLIT_SSE                0x00000002
    3.94 -#define SDL_BLIT_ALTIVEC_PREFETCH   0x00000004
    3.95 -#define SDL_BLIT_ALTIVEC_NOPREFETCH 0x00000008
    3.96 -
    3.97 -typedef struct SDL_BlitEntry
    3.98 -{
    3.99 -    Uint32 features;
   3.100 -    SDL_loblit blit;
   3.101 -} SDL_BlitEntry;
   3.102 -
   3.103  /* Functions found in SDL_blit.c */
   3.104  extern int SDL_CalculateBlit(SDL_Surface * surface);
   3.105  
   3.106 -/* Functions found in SDL_blit_{0,1,N,A}.c */
   3.107 -extern SDL_loblit SDL_CalculateBlit0(SDL_Surface * surface, int complex);
   3.108 -extern SDL_loblit SDL_CalculateBlit1(SDL_Surface * surface, int complex);
   3.109 -extern SDL_loblit SDL_CalculateBlitN(SDL_Surface * surface, int complex);
   3.110 -extern SDL_loblit SDL_CalculateAlphaBlit(SDL_Surface * surface, int complex);
   3.111 -
   3.112  /*
   3.113   * Useful macros for blitting routines
   3.114   */
     4.1 --- a/src/video/SDL_blit_0.c	Fri Aug 17 03:22:03 2007 +0000
     4.2 +++ b/src/video/SDL_blit_0.c	Fri Aug 17 06:21:58 2007 +0000
     4.3 @@ -35,12 +35,12 @@
     4.4      int srcskip, dstskip;
     4.5  
     4.6      /* Set up some basic variables */
     4.7 -    width = info->d_width;
     4.8 -    height = info->d_height;
     4.9 -    src = info->s_pixels;
    4.10 +    width = info->dst_w;
    4.11 +    height = info->dst_h;
    4.12 +    src = info->src;
    4.13      srcskip = info->s_skip;
    4.14 -    dst = info->d_pixels;
    4.15 -    dstskip = info->d_skip;
    4.16 +    dst = info->dst;
    4.17 +    dstskip = info->dst_pitch;
    4.18      map = info->table;
    4.19      srcskip += width - (width + 7) / 8;
    4.20  
    4.21 @@ -90,12 +90,12 @@
    4.22      int srcskip, dstskip;
    4.23  
    4.24      /* Set up some basic variables */
    4.25 -    width = info->d_width;
    4.26 -    height = info->d_height;
    4.27 -    src = info->s_pixels;
    4.28 +    width = info->dst_w;
    4.29 +    height = info->dst_h;
    4.30 +    src = info->src;
    4.31      srcskip = info->s_skip;
    4.32 -    dst = (Uint16 *) info->d_pixels;
    4.33 -    dstskip = info->d_skip / 2;
    4.34 +    dst = (Uint16 *) info->dst;
    4.35 +    dstskip = info->dst_pitch / 2;
    4.36      map = (Uint16 *) info->table;
    4.37      srcskip += width - (width + 7) / 8;
    4.38  
    4.39 @@ -125,12 +125,12 @@
    4.40      int srcskip, dstskip;
    4.41  
    4.42      /* Set up some basic variables */
    4.43 -    width = info->d_width;
    4.44 -    height = info->d_height;
    4.45 -    src = info->s_pixels;
    4.46 +    width = info->dst_w;
    4.47 +    height = info->dst_h;
    4.48 +    src = info->src;
    4.49      srcskip = info->s_skip;
    4.50 -    dst = info->d_pixels;
    4.51 -    dstskip = info->d_skip;
    4.52 +    dst = info->dst;
    4.53 +    dstskip = info->dst_pitch;
    4.54      map = info->table;
    4.55      srcskip += width - (width + 7) / 8;
    4.56  
    4.57 @@ -164,12 +164,12 @@
    4.58      int c;
    4.59  
    4.60      /* Set up some basic variables */
    4.61 -    width = info->d_width;
    4.62 -    height = info->d_height;
    4.63 -    src = info->s_pixels;
    4.64 +    width = info->dst_w;
    4.65 +    height = info->dst_h;
    4.66 +    src = info->src;
    4.67      srcskip = info->s_skip;
    4.68 -    dst = (Uint32 *) info->d_pixels;
    4.69 -    dstskip = info->d_skip / 4;
    4.70 +    dst = (Uint32 *) info->dst;
    4.71 +    dstskip = info->dst_pitch / 4;
    4.72      map = (Uint32 *) info->table;
    4.73      srcskip += width - (width + 7) / 8;
    4.74  
    4.75 @@ -194,12 +194,12 @@
    4.76  static void
    4.77  BlitBto1Key(SDL_BlitInfo * info)
    4.78  {
    4.79 -    int width = info->d_width;
    4.80 -    int height = info->d_height;
    4.81 -    Uint8 *src = info->s_pixels;
    4.82 -    Uint8 *dst = info->d_pixels;
    4.83 +    int width = info->dst_w;
    4.84 +    int height = info->dst_h;
    4.85 +    Uint8 *src = info->src;
    4.86 +    Uint8 *dst = info->dst;
    4.87      int srcskip = info->s_skip;
    4.88 -    int dstskip = info->d_skip;
    4.89 +    int dstskip = info->dst_pitch;
    4.90      Uint32 ckey = info->ckey;
    4.91      Uint8 *palmap = info->table;
    4.92      int c;
    4.93 @@ -247,12 +247,12 @@
    4.94  static void
    4.95  BlitBto2Key(SDL_BlitInfo * info)
    4.96  {
    4.97 -    int width = info->d_width;
    4.98 -    int height = info->d_height;
    4.99 -    Uint8 *src = info->s_pixels;
   4.100 -    Uint16 *dstp = (Uint16 *) info->d_pixels;
   4.101 +    int width = info->dst_w;
   4.102 +    int height = info->dst_h;
   4.103 +    Uint8 *src = info->src;
   4.104 +    Uint16 *dstp = (Uint16 *) info->dst;
   4.105      int srcskip = info->s_skip;
   4.106 -    int dstskip = info->d_skip;
   4.107 +    int dstskip = info->dst_pitch;
   4.108      Uint32 ckey = info->ckey;
   4.109      Uint8 *palmap = info->table;
   4.110      int c;
   4.111 @@ -282,12 +282,12 @@
   4.112  static void
   4.113  BlitBto3Key(SDL_BlitInfo * info)
   4.114  {
   4.115 -    int width = info->d_width;
   4.116 -    int height = info->d_height;
   4.117 -    Uint8 *src = info->s_pixels;
   4.118 -    Uint8 *dst = info->d_pixels;
   4.119 +    int width = info->dst_w;
   4.120 +    int height = info->dst_h;
   4.121 +    Uint8 *src = info->src;
   4.122 +    Uint8 *dst = info->dst;
   4.123      int srcskip = info->s_skip;
   4.124 -    int dstskip = info->d_skip;
   4.125 +    int dstskip = info->dst_pitch;
   4.126      Uint32 ckey = info->ckey;
   4.127      Uint8 *palmap = info->table;
   4.128      int c;
   4.129 @@ -316,12 +316,12 @@
   4.130  static void
   4.131  BlitBto4Key(SDL_BlitInfo * info)
   4.132  {
   4.133 -    int width = info->d_width;
   4.134 -    int height = info->d_height;
   4.135 -    Uint8 *src = info->s_pixels;
   4.136 -    Uint32 *dstp = (Uint32 *) info->d_pixels;
   4.137 +    int width = info->dst_w;
   4.138 +    int height = info->dst_h;
   4.139 +    Uint8 *src = info->src;
   4.140 +    Uint32 *dstp = (Uint32 *) info->dst;
   4.141      int srcskip = info->s_skip;
   4.142 -    int dstskip = info->d_skip;
   4.143 +    int dstskip = info->dst_pitch;
   4.144      Uint32 ckey = info->ckey;
   4.145      Uint8 *palmap = info->table;
   4.146      int c;
   4.147 @@ -351,12 +351,12 @@
   4.148  static void
   4.149  BlitBtoNAlpha(SDL_BlitInfo * info)
   4.150  {
   4.151 -    int width = info->d_width;
   4.152 -    int height = info->d_height;
   4.153 -    Uint8 *src = info->s_pixels;
   4.154 -    Uint8 *dst = info->d_pixels;
   4.155 +    int width = info->dst_w;
   4.156 +    int height = info->dst_h;
   4.157 +    Uint8 *src = info->src;
   4.158 +    Uint8 *dst = info->dst;
   4.159      int srcskip = info->s_skip;
   4.160 -    int dstskip = info->d_skip;
   4.161 +    int dstskip = info->dst_pitch;
   4.162      const SDL_Color *srcpal = info->src->palette->colors;
   4.163      SDL_PixelFormat *dstfmt = info->dst;
   4.164      int dstbpp;
   4.165 @@ -396,12 +396,12 @@
   4.166  static void
   4.167  BlitBtoNAlphaKey(SDL_BlitInfo * info)
   4.168  {
   4.169 -    int width = info->d_width;
   4.170 -    int height = info->d_height;
   4.171 -    Uint8 *src = info->s_pixels;
   4.172 -    Uint8 *dst = info->d_pixels;
   4.173 +    int width = info->dst_w;
   4.174 +    int height = info->dst_h;
   4.175 +    Uint8 *src = info->src;
   4.176 +    Uint8 *dst = info->dst;
   4.177      int srcskip = info->s_skip;
   4.178 -    int dstskip = info->d_skip;
   4.179 +    int dstskip = info->dst_pitch;
   4.180      SDL_PixelFormat *srcfmt = info->src;
   4.181      SDL_PixelFormat *dstfmt = info->dst;
   4.182      const SDL_Color *srcpal = srcfmt->palette->colors;
     5.1 --- a/src/video/SDL_blit_1.c	Fri Aug 17 03:22:03 2007 +0000
     5.2 +++ b/src/video/SDL_blit_1.c	Fri Aug 17 06:21:58 2007 +0000
     5.3 @@ -39,12 +39,12 @@
     5.4      int srcskip, dstskip;
     5.5  
     5.6      /* Set up some basic variables */
     5.7 -    width = info->d_width;
     5.8 -    height = info->d_height;
     5.9 -    src = info->s_pixels;
    5.10 +    width = info->dst_w;
    5.11 +    height = info->dst_h;
    5.12 +    src = info->src;
    5.13      srcskip = info->s_skip;
    5.14 -    dst = info->d_pixels;
    5.15 -    dstskip = info->d_skip;
    5.16 +    dst = info->dst;
    5.17 +    dstskip = info->dst_pitch;
    5.18      map = info->table;
    5.19  
    5.20      while (height--) {
    5.21 @@ -90,12 +90,12 @@
    5.22      int srcskip, dstskip;
    5.23  
    5.24      /* Set up some basic variables */
    5.25 -    width = info->d_width;
    5.26 -    height = info->d_height;
    5.27 -    src = info->s_pixels;
    5.28 +    width = info->dst_w;
    5.29 +    height = info->dst_h;
    5.30 +    src = info->src;
    5.31      srcskip = info->s_skip;
    5.32 -    dst = info->d_pixels;
    5.33 -    dstskip = info->d_skip;
    5.34 +    dst = info->dst;
    5.35 +    dstskip = info->dst_pitch;
    5.36      map = (Uint16 *) info->table;
    5.37  
    5.38  #ifdef USE_DUFFS_LOOP
    5.39 @@ -196,12 +196,12 @@
    5.40      int srcskip, dstskip;
    5.41  
    5.42      /* Set up some basic variables */
    5.43 -    width = info->d_width;
    5.44 -    height = info->d_height;
    5.45 -    src = info->s_pixels;
    5.46 +    width = info->dst_w;
    5.47 +    height = info->dst_h;
    5.48 +    src = info->src;
    5.49      srcskip = info->s_skip;
    5.50 -    dst = info->d_pixels;
    5.51 -    dstskip = info->d_skip;
    5.52 +    dst = info->dst;
    5.53 +    dstskip = info->dst_pitch;
    5.54      map = info->table;
    5.55  
    5.56      while (height--) {
    5.57 @@ -244,12 +244,12 @@
    5.58      int srcskip, dstskip;
    5.59  
    5.60      /* Set up some basic variables */
    5.61 -    width = info->d_width;
    5.62 -    height = info->d_height;
    5.63 -    src = info->s_pixels;
    5.64 +    width = info->dst_w;
    5.65 +    height = info->dst_h;
    5.66 +    src = info->src;
    5.67      srcskip = info->s_skip;
    5.68 -    dst = (Uint32 *) info->d_pixels;
    5.69 -    dstskip = info->d_skip / 4;
    5.70 +    dst = (Uint32 *) info->dst;
    5.71 +    dstskip = info->dst_pitch / 4;
    5.72      map = (Uint32 *) info->table;
    5.73  
    5.74      while (height--) {
    5.75 @@ -283,12 +283,12 @@
    5.76  static void
    5.77  Blit1to1Key(SDL_BlitInfo * info)
    5.78  {
    5.79 -    int width = info->d_width;
    5.80 -    int height = info->d_height;
    5.81 -    Uint8 *src = info->s_pixels;
    5.82 +    int width = info->dst_w;
    5.83 +    int height = info->dst_h;
    5.84 +    Uint8 *src = info->src;
    5.85      int srcskip = info->s_skip;
    5.86 -    Uint8 *dst = info->d_pixels;
    5.87 -    int dstskip = info->d_skip;
    5.88 +    Uint8 *dst = info->dst;
    5.89 +    int dstskip = info->dst_pitch;
    5.90      Uint8 *palmap = info->table;
    5.91      Uint32 ckey = info->ckey;
    5.92  
    5.93 @@ -330,12 +330,12 @@
    5.94  static void
    5.95  Blit1to2Key(SDL_BlitInfo * info)
    5.96  {
    5.97 -    int width = info->d_width;
    5.98 -    int height = info->d_height;
    5.99 -    Uint8 *src = info->s_pixels;
   5.100 +    int width = info->dst_w;
   5.101 +    int height = info->dst_h;
   5.102 +    Uint8 *src = info->src;
   5.103      int srcskip = info->s_skip;
   5.104 -    Uint16 *dstp = (Uint16 *) info->d_pixels;
   5.105 -    int dstskip = info->d_skip;
   5.106 +    Uint16 *dstp = (Uint16 *) info->dst;
   5.107 +    int dstskip = info->dst_pitch;
   5.108      Uint16 *palmap = (Uint16 *) info->table;
   5.109      Uint32 ckey = info->ckey;
   5.110  
   5.111 @@ -362,12 +362,12 @@
   5.112  static void
   5.113  Blit1to3Key(SDL_BlitInfo * info)
   5.114  {
   5.115 -    int width = info->d_width;
   5.116 -    int height = info->d_height;
   5.117 -    Uint8 *src = info->s_pixels;
   5.118 +    int width = info->dst_w;
   5.119 +    int height = info->dst_h;
   5.120 +    Uint8 *src = info->src;
   5.121      int srcskip = info->s_skip;
   5.122 -    Uint8 *dst = info->d_pixels;
   5.123 -    int dstskip = info->d_skip;
   5.124 +    Uint8 *dst = info->dst;
   5.125 +    int dstskip = info->dst_pitch;
   5.126      Uint8 *palmap = info->table;
   5.127      Uint32 ckey = info->ckey;
   5.128      int o;
   5.129 @@ -395,12 +395,12 @@
   5.130  static void
   5.131  Blit1to4Key(SDL_BlitInfo * info)
   5.132  {
   5.133 -    int width = info->d_width;
   5.134 -    int height = info->d_height;
   5.135 -    Uint8 *src = info->s_pixels;
   5.136 +    int width = info->dst_w;
   5.137 +    int height = info->dst_h;
   5.138 +    Uint8 *src = info->src;
   5.139      int srcskip = info->s_skip;
   5.140 -    Uint32 *dstp = (Uint32 *) info->d_pixels;
   5.141 -    int dstskip = info->d_skip;
   5.142 +    Uint32 *dstp = (Uint32 *) info->dst;
   5.143 +    int dstskip = info->dst_pitch;
   5.144      Uint32 *palmap = (Uint32 *) info->table;
   5.145      Uint32 ckey = info->ckey;
   5.146  
   5.147 @@ -427,12 +427,12 @@
   5.148  static void
   5.149  Blit1toNAlpha(SDL_BlitInfo * info)
   5.150  {
   5.151 -    int width = info->d_width;
   5.152 -    int height = info->d_height;
   5.153 -    Uint8 *src = info->s_pixels;
   5.154 +    int width = info->dst_w;
   5.155 +    int height = info->dst_h;
   5.156 +    Uint8 *src = info->src;
   5.157      int srcskip = info->s_skip;
   5.158 -    Uint8 *dst = info->d_pixels;
   5.159 -    int dstskip = info->d_skip;
   5.160 +    Uint8 *dst = info->dst;
   5.161 +    int dstskip = info->dst_pitch;
   5.162      SDL_PixelFormat *dstfmt = info->dst;
   5.163      const SDL_Color *srcpal = info->src->palette->colors;
   5.164      int dstbpp;
   5.165 @@ -468,12 +468,12 @@
   5.166  static void
   5.167  Blit1toNAlphaKey(SDL_BlitInfo * info)
   5.168  {
   5.169 -    int width = info->d_width;
   5.170 -    int height = info->d_height;
   5.171 -    Uint8 *src = info->s_pixels;
   5.172 +    int width = info->dst_w;
   5.173 +    int height = info->dst_h;
   5.174 +    Uint8 *src = info->src;
   5.175      int srcskip = info->s_skip;
   5.176 -    Uint8 *dst = info->d_pixels;
   5.177 -    int dstskip = info->d_skip;
   5.178 +    Uint8 *dst = info->dst;
   5.179 +    int dstskip = info->dst_pitch;
   5.180      SDL_PixelFormat *srcfmt = info->src;
   5.181      SDL_PixelFormat *dstfmt = info->dst;
   5.182      const SDL_Color *srcpal = info->src->palette->colors;
     6.1 --- a/src/video/SDL_blit_A.c	Fri Aug 17 03:22:03 2007 +0000
     6.2 +++ b/src/video/SDL_blit_A.c	Fri Aug 17 06:21:58 2007 +0000
     6.3 @@ -30,12 +30,12 @@
     6.4  static void
     6.5  BlitNto1SurfaceAlpha(SDL_BlitInfo * info)
     6.6  {
     6.7 -    int width = info->d_width;
     6.8 -    int height = info->d_height;
     6.9 -    Uint8 *src = info->s_pixels;
    6.10 +    int width = info->dst_w;
    6.11 +    int height = info->dst_h;
    6.12 +    Uint8 *src = info->src;
    6.13      int srcskip = info->s_skip;
    6.14 -    Uint8 *dst = info->d_pixels;
    6.15 -    int dstskip = info->d_skip;
    6.16 +    Uint8 *dst = info->dst;
    6.17 +    int dstskip = info->dst_pitch;
    6.18      Uint8 *palmap = info->table;
    6.19      SDL_PixelFormat *srcfmt = info->src;
    6.20      SDL_PixelFormat *dstfmt = info->dst;
    6.21 @@ -86,12 +86,12 @@
    6.22  static void
    6.23  BlitNto1PixelAlpha(SDL_BlitInfo * info)
    6.24  {
    6.25 -    int width = info->d_width;
    6.26 -    int height = info->d_height;
    6.27 -    Uint8 *src = info->s_pixels;
    6.28 +    int width = info->dst_w;
    6.29 +    int height = info->dst_h;
    6.30 +    Uint8 *src = info->src;
    6.31      int srcskip = info->s_skip;
    6.32 -    Uint8 *dst = info->d_pixels;
    6.33 -    int dstskip = info->d_skip;
    6.34 +    Uint8 *dst = info->dst;
    6.35 +    int dstskip = info->dst_pitch;
    6.36      Uint8 *palmap = info->table;
    6.37      SDL_PixelFormat *srcfmt = info->src;
    6.38      SDL_PixelFormat *dstfmt = info->dst;
    6.39 @@ -142,12 +142,12 @@
    6.40  static void
    6.41  BlitNto1SurfaceAlphaKey(SDL_BlitInfo * info)
    6.42  {
    6.43 -    int width = info->d_width;
    6.44 -    int height = info->d_height;
    6.45 -    Uint8 *src = info->s_pixels;
    6.46 +    int width = info->dst_w;
    6.47 +    int height = info->dst_h;
    6.48 +    Uint8 *src = info->src;
    6.49      int srcskip = info->s_skip;
    6.50 -    Uint8 *dst = info->d_pixels;
    6.51 -    int dstskip = info->d_skip;
    6.52 +    Uint8 *dst = info->dst;
    6.53 +    int dstskip = info->dst_pitch;
    6.54      Uint8 *palmap = info->table;
    6.55      SDL_PixelFormat *srcfmt = info->src;
    6.56      SDL_PixelFormat *dstfmt = info->dst;
    6.57 @@ -203,12 +203,12 @@
    6.58  static void
    6.59  BlitRGBtoRGBSurfaceAlpha128MMX(SDL_BlitInfo * info)
    6.60  {
    6.61 -    int width = info->d_width;
    6.62 -    int height = info->d_height;
    6.63 -    Uint32 *srcp = (Uint32 *) info->s_pixels;
    6.64 +    int width = info->dst_w;
    6.65 +    int height = info->dst_h;
    6.66 +    Uint32 *srcp = (Uint32 *) info->src;
    6.67      int srcskip = info->s_skip >> 2;
    6.68 -    Uint32 *dstp = (Uint32 *) info->d_pixels;
    6.69 -    int dstskip = info->d_skip >> 2;
    6.70 +    Uint32 *dstp = (Uint32 *) info->dst;
    6.71 +    int dstskip = info->dst_pitch >> 2;
    6.72      Uint32 dalpha = info->dst->Amask;
    6.73  
    6.74      __m64 src1, src2, dst1, dst2, lmask, hmask, dsta;
    6.75 @@ -267,12 +267,12 @@
    6.76          /* only call a128 version when R,G,B occupy lower bits */
    6.77          BlitRGBtoRGBSurfaceAlpha128MMX(info);
    6.78      } else {
    6.79 -        int width = info->d_width;
    6.80 -        int height = info->d_height;
    6.81 -        Uint32 *srcp = (Uint32 *) info->s_pixels;
    6.82 +        int width = info->dst_w;
    6.83 +        int height = info->dst_h;
    6.84 +        Uint32 *srcp = (Uint32 *) info->src;
    6.85          int srcskip = info->s_skip >> 2;
    6.86 -        Uint32 *dstp = (Uint32 *) info->d_pixels;
    6.87 -        int dstskip = info->d_skip >> 2;
    6.88 +        Uint32 *dstp = (Uint32 *) info->dst;
    6.89 +        int dstskip = info->dst_pitch >> 2;
    6.90          Uint32 dalpha = df->Amask;
    6.91          Uint32 amult;
    6.92  
    6.93 @@ -356,12 +356,12 @@
    6.94  static void
    6.95  BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo * info)
    6.96  {
    6.97 -    int width = info->d_width;
    6.98 -    int height = info->d_height;
    6.99 -    Uint32 *srcp = (Uint32 *) info->s_pixels;
   6.100 +    int width = info->dst_w;
   6.101 +    int height = info->dst_h;
   6.102 +    Uint32 *srcp = (Uint32 *) info->src;
   6.103      int srcskip = info->s_skip >> 2;
   6.104 -    Uint32 *dstp = (Uint32 *) info->d_pixels;
   6.105 -    int dstskip = info->d_skip >> 2;
   6.106 +    Uint32 *dstp = (Uint32 *) info->dst;
   6.107 +    int dstskip = info->dst_pitch >> 2;
   6.108      SDL_PixelFormat *sf = info->src;
   6.109      Uint32 chanmask = sf->Rmask | sf->Gmask | sf->Bmask;
   6.110      Uint32 amask = sf->Amask;
   6.111 @@ -542,11 +542,11 @@
   6.112  static void
   6.113  Blit32to565PixelAlphaAltivec(SDL_BlitInfo * info)
   6.114  {
   6.115 -    int height = info->d_height;
   6.116 -    Uint8 *src = (Uint8 *) info->s_pixels;
   6.117 +    int height = info->dst_h;
   6.118 +    Uint8 *src = (Uint8 *) info->src;
   6.119      int srcskip = info->s_skip;
   6.120 -    Uint8 *dst = (Uint8 *) info->d_pixels;
   6.121 -    int dstskip = info->d_skip;
   6.122 +    Uint8 *dst = (Uint8 *) info->dst;
   6.123 +    int dstskip = info->dst_pitch;
   6.124      SDL_PixelFormat *srcfmt = info->src;
   6.125  
   6.126      vector unsigned char v0 = vec_splat_u8(0);
   6.127 @@ -617,7 +617,7 @@
   6.128          vector unsigned char valigner;
   6.129          vector unsigned char vsrc;
   6.130          vector unsigned char voverflow;
   6.131 -        int width = info->d_width;
   6.132 +        int width = info->dst_w;
   6.133  
   6.134  #define ONE_PIXEL_BLEND(condition, widthvar) \
   6.135          while (condition) { \
   6.136 @@ -718,11 +718,11 @@
   6.137  static void
   6.138  Blit32to32SurfaceAlphaKeyAltivec(SDL_BlitInfo * info)
   6.139  {
   6.140 -    int height = info->d_height;
   6.141 -    Uint32 *srcp = (Uint32 *) info->s_pixels;
   6.142 +    int height = info->dst_h;
   6.143 +    Uint32 *srcp = (Uint32 *) info->src;
   6.144      int srcskip = info->s_skip >> 2;
   6.145 -    Uint32 *dstp = (Uint32 *) info->d_pixels;
   6.146 -    int dstskip = info->d_skip >> 2;
   6.147 +    Uint32 *dstp = (Uint32 *) info->dst;
   6.148 +    int dstskip = info->dst_pitch >> 2;
   6.149      SDL_PixelFormat *srcfmt = info->src;
   6.150      SDL_PixelFormat *dstfmt = info->dst;
   6.151      unsigned sA = (info->cmod >> 24);
   6.152 @@ -766,7 +766,7 @@
   6.153      vrgbmask = vec_splat(vrgbmask, 0);
   6.154  
   6.155      while (height--) {
   6.156 -        int width = info->d_width;
   6.157 +        int width = info->dst_w;
   6.158  #define ONE_PIXEL_BLEND(condition, widthvar) \
   6.159          while (condition) { \
   6.160              Uint32 Pixel; \
   6.161 @@ -844,12 +844,12 @@
   6.162  static void
   6.163  Blit32to32PixelAlphaAltivec(SDL_BlitInfo * info)
   6.164  {
   6.165 -    int width = info->d_width;
   6.166 -    int height = info->d_height;
   6.167 -    Uint32 *srcp = (Uint32 *) info->s_pixels;
   6.168 +    int width = info->dst_w;
   6.169 +    int height = info->dst_h;
   6.170 +    Uint32 *srcp = (Uint32 *) info->src;
   6.171      int srcskip = info->s_skip >> 2;
   6.172 -    Uint32 *dstp = (Uint32 *) info->d_pixels;
   6.173 -    int dstskip = info->d_skip >> 2;
   6.174 +    Uint32 *dstp = (Uint32 *) info->dst;
   6.175 +    int dstskip = info->dst_pitch >> 2;
   6.176      SDL_PixelFormat *srcfmt = info->src;
   6.177      SDL_PixelFormat *dstfmt = info->dst;
   6.178      vector unsigned char mergePermute;
   6.179 @@ -875,7 +875,7 @@
   6.180      vsdstPermute = calc_swizzle32(dstfmt, NULL);
   6.181  
   6.182      while (height--) {
   6.183 -        width = info->d_width;
   6.184 +        width = info->dst_w;
   6.185  #define ONE_PIXEL_BLEND(condition, widthvar) while ((condition)) { \
   6.186              Uint32 Pixel; \
   6.187              unsigned sR, sG, sB, dR, dG, dB, sA, dA; \
   6.188 @@ -942,12 +942,12 @@
   6.189  static void
   6.190  BlitRGBtoRGBPixelAlphaAltivec(SDL_BlitInfo * info)
   6.191  {
   6.192 -    int width = info->d_width;
   6.193 -    int height = info->d_height;
   6.194 -    Uint32 *srcp = (Uint32 *) info->s_pixels;
   6.195 +    int width = info->dst_w;
   6.196 +    int height = info->dst_h;
   6.197 +    Uint32 *srcp = (Uint32 *) info->src;
   6.198      int srcskip = info->s_skip >> 2;
   6.199 -    Uint32 *dstp = (Uint32 *) info->d_pixels;
   6.200 -    int dstskip = info->d_skip >> 2;
   6.201 +    Uint32 *dstp = (Uint32 *) info->dst;
   6.202 +    int dstskip = info->dst_pitch >> 2;
   6.203      vector unsigned char mergePermute;
   6.204      vector unsigned char valphaPermute;
   6.205      vector unsigned char valphamask;
   6.206 @@ -965,7 +965,7 @@
   6.207  
   6.208      vpixelmask = vec_nor(valphamask, v0);
   6.209      while (height--) {
   6.210 -        width = info->d_width;
   6.211 +        width = info->dst_w;
   6.212  #define ONE_PIXEL_BLEND(condition, widthvar) \
   6.213          while ((condition)) { \
   6.214              Uint32 dalpha; \
   6.215 @@ -1040,11 +1040,11 @@
   6.216  Blit32to32SurfaceAlphaAltivec(SDL_BlitInfo * info)
   6.217  {
   6.218      /* XXX : 6 */
   6.219 -    int height = info->d_height;
   6.220 -    Uint32 *srcp = (Uint32 *) info->s_pixels;
   6.221 +    int height = info->dst_h;
   6.222 +    Uint32 *srcp = (Uint32 *) info->src;
   6.223      int srcskip = info->s_skip >> 2;
   6.224 -    Uint32 *dstp = (Uint32 *) info->d_pixels;
   6.225 -    int dstskip = info->d_skip >> 2;
   6.226 +    Uint32 *dstp = (Uint32 *) info->dst;
   6.227 +    int dstskip = info->dst_pitch >> 2;
   6.228      SDL_PixelFormat *srcfmt = info->src;
   6.229      SDL_PixelFormat *dstfmt = info->dst;
   6.230      unsigned sA = (info->cmod >> 24);
   6.231 @@ -1076,7 +1076,7 @@
   6.232      vbits = (vector unsigned char) vec_splat_s8(-1);
   6.233  
   6.234      while (height--) {
   6.235 -        int width = info->d_width;
   6.236 +        int width = info->dst_w;
   6.237  #define ONE_PIXEL_BLEND(condition, widthvar) while ((condition)) { \
   6.238              Uint32 Pixel; \
   6.239              unsigned sR, sG, sB, dR, dG, dB; \
   6.240 @@ -1137,11 +1137,11 @@
   6.241  BlitRGBtoRGBSurfaceAlphaAltivec(SDL_BlitInfo * info)
   6.242  {
   6.243      unsigned alpha = (info->cmod >> 24);
   6.244 -    int height = info->d_height;
   6.245 -    Uint32 *srcp = (Uint32 *) info->s_pixels;
   6.246 +    int height = info->dst_h;
   6.247 +    Uint32 *srcp = (Uint32 *) info->src;
   6.248      int srcskip = info->s_skip >> 2;
   6.249 -    Uint32 *dstp = (Uint32 *) info->d_pixels;
   6.250 -    int dstskip = info->d_skip >> 2;
   6.251 +    Uint32 *dstp = (Uint32 *) info->dst;
   6.252 +    int dstskip = info->dst_pitch >> 2;
   6.253      vector unsigned char mergePermute;
   6.254      vector unsigned char valpha;
   6.255      vector unsigned char valphamask;
   6.256 @@ -1160,7 +1160,7 @@
   6.257      valpha = vec_splat(valpha, 0);
   6.258  
   6.259      while (height--) {
   6.260 -        int width = info->d_width;
   6.261 +        int width = info->dst_w;
   6.262  #define ONE_PIXEL_BLEND(condition, widthvar) while ((condition)) { \
   6.263              Uint32 s = *srcp; \
   6.264              Uint32 d = *dstp; \
   6.265 @@ -1224,12 +1224,12 @@
   6.266  static void
   6.267  BlitRGBtoRGBSurfaceAlpha128(SDL_BlitInfo * info)
   6.268  {
   6.269 -    int width = info->d_width;
   6.270 -    int height = info->d_height;
   6.271 -    Uint32 *srcp = (Uint32 *) info->s_pixels;
   6.272 +    int width = info->dst_w;
   6.273 +    int height = info->dst_h;
   6.274 +    Uint32 *srcp = (Uint32 *) info->src;
   6.275      int srcskip = info->s_skip >> 2;
   6.276 -    Uint32 *dstp = (Uint32 *) info->d_pixels;
   6.277 -    int dstskip = info->d_skip >> 2;
   6.278 +    Uint32 *dstp = (Uint32 *) info->dst;
   6.279 +    int dstskip = info->dst_pitch >> 2;
   6.280  
   6.281      while (height--) {
   6.282  	    /* *INDENT-OFF* */
   6.283 @@ -1253,12 +1253,12 @@
   6.284      if (alpha == 128) {
   6.285          BlitRGBtoRGBSurfaceAlpha128(info);
   6.286      } else {
   6.287 -        int width = info->d_width;
   6.288 -        int height = info->d_height;
   6.289 -        Uint32 *srcp = (Uint32 *) info->s_pixels;
   6.290 +        int width = info->dst_w;
   6.291 +        int height = info->dst_h;
   6.292 +        Uint32 *srcp = (Uint32 *) info->src;
   6.293          int srcskip = info->s_skip >> 2;
   6.294 -        Uint32 *dstp = (Uint32 *) info->d_pixels;
   6.295 -        int dstskip = info->d_skip >> 2;
   6.296 +        Uint32 *dstp = (Uint32 *) info->dst;
   6.297 +        int dstskip = info->dst_pitch >> 2;
   6.298          Uint32 s;
   6.299          Uint32 d;
   6.300          Uint32 s1;
   6.301 @@ -1321,12 +1321,12 @@
   6.302  static void
   6.303  BlitRGBtoRGBPixelAlpha(SDL_BlitInfo * info)
   6.304  {
   6.305 -    int width = info->d_width;
   6.306 -    int height = info->d_height;
   6.307 -    Uint32 *srcp = (Uint32 *) info->s_pixels;
   6.308 +    int width = info->dst_w;
   6.309 +    int height = info->dst_h;
   6.310 +    Uint32 *srcp = (Uint32 *) info->src;
   6.311      int srcskip = info->s_skip >> 2;
   6.312 -    Uint32 *dstp = (Uint32 *) info->d_pixels;
   6.313 -    int dstskip = info->d_skip >> 2;
   6.314 +    Uint32 *dstp = (Uint32 *) info->dst;
   6.315 +    int dstskip = info->dst_pitch >> 2;
   6.316  
   6.317      while (height--) {
   6.318  	    /* *INDENT-OFF* */
   6.319 @@ -1374,12 +1374,12 @@
   6.320  static void
   6.321  BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo * info)
   6.322  {
   6.323 -    int width = info->d_width;
   6.324 -    int height = info->d_height;
   6.325 -    Uint32 *srcp = (Uint32 *) info->s_pixels;
   6.326 +    int width = info->dst_w;
   6.327 +    int height = info->dst_h;
   6.328 +    Uint32 *srcp = (Uint32 *) info->src;
   6.329      int srcskip = info->s_skip >> 2;
   6.330 -    Uint32 *dstp = (Uint32 *) info->d_pixels;
   6.331 -    int dstskip = info->d_skip >> 2;
   6.332 +    Uint32 *dstp = (Uint32 *) info->dst;
   6.333 +    int dstskip = info->dst_pitch >> 2;
   6.334      SDL_PixelFormat *sf = info->src;
   6.335      Uint32 chanmask = sf->Rmask | sf->Gmask | sf->Bmask;
   6.336      Uint32 amask = sf->Amask;
   6.337 @@ -1456,12 +1456,12 @@
   6.338  static void
   6.339  Blit16to16SurfaceAlpha128(SDL_BlitInfo * info, Uint16 mask)
   6.340  {
   6.341 -    int width = info->d_width;
   6.342 -    int height = info->d_height;
   6.343 -    Uint16 *srcp = (Uint16 *) info->s_pixels;
   6.344 +    int width = info->dst_w;
   6.345 +    int height = info->dst_h;
   6.346 +    Uint16 *srcp = (Uint16 *) info->src;
   6.347      int srcskip = info->s_skip >> 1;
   6.348 -    Uint16 *dstp = (Uint16 *) info->d_pixels;
   6.349 -    int dstskip = info->d_skip >> 1;
   6.350 +    Uint16 *dstp = (Uint16 *) info->dst;
   6.351 +    int dstskip = info->dst_pitch >> 1;
   6.352  
   6.353      while (height--) {
   6.354          if (((uintptr_t) srcp ^ (uintptr_t) dstp) & 2) {
   6.355 @@ -1562,12 +1562,12 @@
   6.356      if (alpha == 128) {
   6.357          Blit16to16SurfaceAlpha128(info, 0xf7de);
   6.358      } else {
   6.359 -        int width = info->d_width;
   6.360 -        int height = info->d_height;
   6.361 -        Uint16 *srcp = (Uint16 *) info->s_pixels;
   6.362 +        int width = info->dst_w;
   6.363 +        int height = info->dst_h;
   6.364 +        Uint16 *srcp = (Uint16 *) info->src;
   6.365          int srcskip = info->s_skip >> 1;
   6.366 -        Uint16 *dstp = (Uint16 *) info->d_pixels;
   6.367 -        int dstskip = info->d_skip >> 1;
   6.368 +        Uint16 *dstp = (Uint16 *) info->dst;
   6.369 +        int dstskip = info->dst_pitch >> 1;
   6.370          Uint32 s, d;
   6.371  
   6.372          __m64 src1, dst1, src2, dst2, gmask, bmask, mm_res, mm_alpha;
   6.373 @@ -1699,12 +1699,12 @@
   6.374      if (alpha == 128) {
   6.375          Blit16to16SurfaceAlpha128(info, 0xfbde);
   6.376      } else {
   6.377 -        int width = info->d_width;
   6.378 -        int height = info->d_height;
   6.379 -        Uint16 *srcp = (Uint16 *) info->s_pixels;
   6.380 +        int width = info->dst_w;
   6.381 +        int height = info->dst_h;
   6.382 +        Uint16 *srcp = (Uint16 *) info->src;
   6.383          int srcskip = info->s_skip >> 1;
   6.384 -        Uint16 *dstp = (Uint16 *) info->d_pixels;
   6.385 -        int dstskip = info->d_skip >> 1;
   6.386 +        Uint16 *dstp = (Uint16 *) info->dst;
   6.387 +        int dstskip = info->dst_pitch >> 1;
   6.388          Uint32 s, d;
   6.389  
   6.390          __m64 src1, dst1, src2, dst2, rmask, gmask, bmask, mm_res, mm_alpha;
   6.391 @@ -1839,12 +1839,12 @@
   6.392      if (alpha == 128) {
   6.393          Blit16to16SurfaceAlpha128(info, 0xf7de);
   6.394      } else {
   6.395 -        int width = info->d_width;
   6.396 -        int height = info->d_height;
   6.397 -        Uint16 *srcp = (Uint16 *) info->s_pixels;
   6.398 +        int width = info->dst_w;
   6.399 +        int height = info->dst_h;
   6.400 +        Uint16 *srcp = (Uint16 *) info->src;
   6.401          int srcskip = info->s_skip >> 1;
   6.402 -        Uint16 *dstp = (Uint16 *) info->d_pixels;
   6.403 -        int dstskip = info->d_skip >> 1;
   6.404 +        Uint16 *dstp = (Uint16 *) info->dst;
   6.405 +        int dstskip = info->dst_pitch >> 1;
   6.406          alpha >>= 3;            /* downscale alpha to 5 bits */
   6.407  
   6.408          while (height--) {
   6.409 @@ -1878,12 +1878,12 @@
   6.410      if (alpha == 128) {
   6.411          Blit16to16SurfaceAlpha128(info, 0xfbde);
   6.412      } else {
   6.413 -        int width = info->d_width;
   6.414 -        int height = info->d_height;
   6.415 -        Uint16 *srcp = (Uint16 *) info->s_pixels;
   6.416 +        int width = info->dst_w;
   6.417 +        int height = info->dst_h;
   6.418 +        Uint16 *srcp = (Uint16 *) info->src;
   6.419          int srcskip = info->s_skip >> 1;
   6.420 -        Uint16 *dstp = (Uint16 *) info->d_pixels;
   6.421 -        int dstskip = info->d_skip >> 1;
   6.422 +        Uint16 *dstp = (Uint16 *) info->dst;
   6.423 +        int dstskip = info->dst_pitch >> 1;
   6.424          alpha >>= 3;            /* downscale alpha to 5 bits */
   6.425  
   6.426          while (height--) {
   6.427 @@ -1913,12 +1913,12 @@
   6.428  static void
   6.429  BlitARGBto565PixelAlpha(SDL_BlitInfo * info)
   6.430  {
   6.431 -    int width = info->d_width;
   6.432 -    int height = info->d_height;
   6.433 -    Uint32 *srcp = (Uint32 *) info->s_pixels;
   6.434 +    int width = info->dst_w;
   6.435 +    int height = info->dst_h;
   6.436 +    Uint32 *srcp = (Uint32 *) info->src;
   6.437      int srcskip = info->s_skip >> 2;
   6.438 -    Uint16 *dstp = (Uint16 *) info->d_pixels;
   6.439 -    int dstskip = info->d_skip >> 1;
   6.440 +    Uint16 *dstp = (Uint16 *) info->dst;
   6.441 +    int dstskip = info->dst_pitch >> 1;
   6.442  
   6.443      while (height--) {
   6.444  	    /* *INDENT-OFF* */
   6.445 @@ -1959,12 +1959,12 @@
   6.446  static void
   6.447  BlitARGBto555PixelAlpha(SDL_BlitInfo * info)
   6.448  {
   6.449 -    int width = info->d_width;
   6.450 -    int height = info->d_height;
   6.451 -    Uint32 *srcp = (Uint32 *) info->s_pixels;
   6.452 +    int width = info->dst_w;
   6.453 +    int height = info->dst_h;
   6.454 +    Uint32 *srcp = (Uint32 *) info->src;
   6.455      int srcskip = info->s_skip >> 2;
   6.456 -    Uint16 *dstp = (Uint16 *) info->d_pixels;
   6.457 -    int dstskip = info->d_skip >> 1;
   6.458 +    Uint16 *dstp = (Uint16 *) info->dst;
   6.459 +    int dstskip = info->dst_pitch >> 1;
   6.460  
   6.461      while (height--) {
   6.462  	    /* *INDENT-OFF* */
   6.463 @@ -2006,12 +2006,12 @@
   6.464  static void
   6.465  BlitNtoNSurfaceAlpha(SDL_BlitInfo * info)
   6.466  {
   6.467 -    int width = info->d_width;
   6.468 -    int height = info->d_height;
   6.469 -    Uint8 *src = info->s_pixels;
   6.470 +    int width = info->dst_w;
   6.471 +    int height = info->dst_h;
   6.472 +    Uint8 *src = info->src;
   6.473      int srcskip = info->s_skip;
   6.474 -    Uint8 *dst = info->d_pixels;
   6.475 -    int dstskip = info->d_skip;
   6.476 +    Uint8 *dst = info->dst;
   6.477 +    int dstskip = info->dst_pitch;
   6.478      SDL_PixelFormat *srcfmt = info->src;
   6.479      SDL_PixelFormat *dstfmt = info->dst;
   6.480      int srcbpp = srcfmt->BytesPerPixel;
   6.481 @@ -2050,12 +2050,12 @@
   6.482  static void
   6.483  BlitNtoNSurfaceAlphaKey(SDL_BlitInfo * info)
   6.484  {
   6.485 -    int width = info->d_width;
   6.486 -    int height = info->d_height;
   6.487 -    Uint8 *src = info->s_pixels;
   6.488 +    int width = info->dst_w;
   6.489 +    int height = info->dst_h;
   6.490 +    Uint8 *src = info->src;
   6.491      int srcskip = info->s_skip;
   6.492 -    Uint8 *dst = info->d_pixels;
   6.493 -    int dstskip = info->d_skip;
   6.494 +    Uint8 *dst = info->dst;
   6.495 +    int dstskip = info->dst_pitch;
   6.496      SDL_PixelFormat *srcfmt = info->src;
   6.497      SDL_PixelFormat *dstfmt = info->dst;
   6.498      Uint32 ckey = info->ckey;
   6.499 @@ -2096,12 +2096,12 @@
   6.500  static void
   6.501  BlitNtoNPixelAlpha(SDL_BlitInfo * info)
   6.502  {
   6.503 -    int width = info->d_width;
   6.504 -    int height = info->d_height;
   6.505 -    Uint8 *src = info->s_pixels;
   6.506 +    int width = info->dst_w;
   6.507 +    int height = info->dst_h;
   6.508 +    Uint8 *src = info->src;
   6.509      int srcskip = info->s_skip;
   6.510 -    Uint8 *dst = info->d_pixels;
   6.511 -    int dstskip = info->d_skip;
   6.512 +    Uint8 *dst = info->dst;
   6.513 +    int dstskip = info->dst_pitch;
   6.514      SDL_PixelFormat *srcfmt = info->src;
   6.515      SDL_PixelFormat *dstfmt = info->dst;
   6.516  
     7.1 --- a/src/video/SDL_blit_N.c	Fri Aug 17 03:22:03 2007 +0000
     7.2 +++ b/src/video/SDL_blit_N.c	Fri Aug 17 06:21:58 2007 +0000
     7.3 @@ -158,11 +158,11 @@
     7.4  static void
     7.5  Blit_RGB888_RGB565Altivec(SDL_BlitInfo * info)
     7.6  {
     7.7 -    int height = info->d_height;
     7.8 -    Uint8 *src = (Uint8 *) info->s_pixels;
     7.9 +    int height = info->dst_h;
    7.10 +    Uint8 *src = (Uint8 *) info->src;
    7.11      int srcskip = info->s_skip;
    7.12 -    Uint8 *dst = (Uint8 *) info->d_pixels;
    7.13 -    int dstskip = info->d_skip;
    7.14 +    Uint8 *dst = (Uint8 *) info->dst;
    7.15 +    int dstskip = info->dst_pitch;
    7.16      SDL_PixelFormat *srcfmt = info->src;
    7.17      vector unsigned char valpha = vec_splat_u8(0);
    7.18      vector unsigned char vpermute = calc_swizzle32(srcfmt, NULL);
    7.19 @@ -186,7 +186,7 @@
    7.20          vector unsigned char voverflow;
    7.21          vector unsigned char vsrc;
    7.22  
    7.23 -        int width = info->d_width;
    7.24 +        int width = info->dst_w;
    7.25          int extrawidth;
    7.26  
    7.27          /* do scalar until we can align... */
    7.28 @@ -262,11 +262,11 @@
    7.29  static void
    7.30  Blit_RGB565_32Altivec(SDL_BlitInfo * info)
    7.31  {
    7.32 -    int height = info->d_height;
    7.33 -    Uint8 *src = (Uint8 *) info->s_pixels;
    7.34 +    int height = info->dst_h;
    7.35 +    Uint8 *src = (Uint8 *) info->src;
    7.36      int srcskip = info->s_skip;
    7.37 -    Uint8 *dst = (Uint8 *) info->d_pixels;
    7.38 -    int dstskip = info->d_skip;
    7.39 +    Uint8 *dst = (Uint8 *) info->dst;
    7.40 +    int dstskip = info->dst_pitch;
    7.41      SDL_PixelFormat *srcfmt = info->src;
    7.42      SDL_PixelFormat *dstfmt = info->dst;
    7.43      unsigned alpha;
    7.44 @@ -336,7 +336,7 @@
    7.45          vector unsigned char voverflow;
    7.46          vector unsigned char vsrc;
    7.47  
    7.48 -        int width = info->d_width;
    7.49 +        int width = info->dst_w;
    7.50          int extrawidth;
    7.51  
    7.52          /* do scalar until we can align... */
    7.53 @@ -410,11 +410,11 @@
    7.54  static void
    7.55  Blit_RGB555_32Altivec(SDL_BlitInfo * info)
    7.56  {
    7.57 -    int height = info->d_height;
    7.58 -    Uint8 *src = (Uint8 *) info->s_pixels;
    7.59 +    int height = info->dst_h;
    7.60 +    Uint8 *src = (Uint8 *) info->src;
    7.61      int srcskip = info->s_skip;
    7.62 -    Uint8 *dst = (Uint8 *) info->d_pixels;
    7.63 -    int dstskip = info->d_skip;
    7.64 +    Uint8 *dst = (Uint8 *) info->dst;
    7.65 +    int dstskip = info->dst_pitch;
    7.66      SDL_PixelFormat *srcfmt = info->src;
    7.67      SDL_PixelFormat *dstfmt = info->dst;
    7.68      unsigned alpha;
    7.69 @@ -484,7 +484,7 @@
    7.70          vector unsigned char voverflow;
    7.71          vector unsigned char vsrc;
    7.72  
    7.73 -        int width = info->d_width;
    7.74 +        int width = info->dst_w;
    7.75          int extrawidth;
    7.76  
    7.77          /* do scalar until we can align... */
    7.78 @@ -559,11 +559,11 @@
    7.79  static void
    7.80  Blit32to32KeyAltivec(SDL_BlitInfo * info)
    7.81  {
    7.82 -    int height = info->d_height;
    7.83 -    Uint32 *srcp = (Uint32 *) info->s_pixels;
    7.84 +    int height = info->dst_h;
    7.85 +    Uint32 *srcp = (Uint32 *) info->src;
    7.86      int srcskip = info->s_skip;
    7.87 -    Uint32 *dstp = (Uint32 *) info->d_pixels;
    7.88 -    int dstskip = info->d_skip;
    7.89 +    Uint32 *dstp = (Uint32 *) info->dst;
    7.90 +    int dstskip = info->dst_pitch;
    7.91      SDL_PixelFormat *srcfmt = info->src;
    7.92      int srcbpp = srcfmt->BytesPerPixel;
    7.93      SDL_PixelFormat *dstfmt = info->dst;
    7.94 @@ -578,7 +578,7 @@
    7.95      vector unsigned int vckey;
    7.96      vector unsigned int vrgbmask;
    7.97      vpermute = calc_swizzle32(srcfmt, dstfmt);
    7.98 -    if (info->d_width < 16) {
    7.99 +    if (info->dst_w < 16) {
   7.100          if (copy_alpha) {
   7.101              BlitNtoNKeyCopyAlpha(info);
   7.102          } else {
   7.103 @@ -631,7 +631,7 @@
   7.104                  widthvar--; \
   7.105              } \
   7.106          }
   7.107 -        int width = info->d_width;
   7.108 +        int width = info->dst_w;
   7.109          ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width);
   7.110          assert(width > 0);
   7.111          if (width > 0) {
   7.112 @@ -677,11 +677,11 @@
   7.113  static void
   7.114  ConvertAltivec32to32_noprefetch(SDL_BlitInfo * info)
   7.115  {
   7.116 -    int height = info->d_height;
   7.117 -    Uint32 *src = (Uint32 *) info->s_pixels;
   7.118 +    int height = info->dst_h;
   7.119 +    Uint32 *src = (Uint32 *) info->src;
   7.120      int srcskip = info->s_skip;
   7.121 -    Uint32 *dst = (Uint32 *) info->d_pixels;
   7.122 -    int dstskip = info->d_skip;
   7.123 +    Uint32 *dst = (Uint32 *) info->dst;
   7.124 +    int dstskip = info->dst_pitch;
   7.125      SDL_PixelFormat *srcfmt = info->src;
   7.126      SDL_PixelFormat *dstfmt = info->dst;
   7.127      vector unsigned int vzero = vec_splat_u32(0);
   7.128 @@ -704,7 +704,7 @@
   7.129          Uint32 bits;
   7.130          Uint8 r, g, b, a;
   7.131  
   7.132 -        int width = info->d_width;
   7.133 +        int width = info->dst_w;
   7.134          int extrawidth;
   7.135  
   7.136          /* do scalar until we can align... */
   7.137 @@ -756,11 +756,11 @@
   7.138      const int scalar_dst_lead = sizeof(Uint32) * 4;
   7.139      const int vector_dst_lead = sizeof(Uint32) * 16;
   7.140  
   7.141 -    int height = info->d_height;
   7.142 -    Uint32 *src = (Uint32 *) info->s_pixels;
   7.143 +    int height = info->dst_h;
   7.144 +    Uint32 *src = (Uint32 *) info->src;
   7.145      int srcskip = info->s_skip;
   7.146 -    Uint32 *dst = (Uint32 *) info->d_pixels;
   7.147 -    int dstskip = info->d_skip;
   7.148 +    Uint32 *dst = (Uint32 *) info->dst;
   7.149 +    int dstskip = info->dst_pitch;
   7.150      SDL_PixelFormat *srcfmt = info->src;
   7.151      SDL_PixelFormat *dstfmt = info->dst;
   7.152      vector unsigned int vzero = vec_splat_u32(0);
   7.153 @@ -783,7 +783,7 @@
   7.154          Uint32 bits;
   7.155          Uint8 r, g, b, a;
   7.156  
   7.157 -        int width = info->d_width;
   7.158 +        int width = info->dst_w;
   7.159          int extrawidth;
   7.160  
   7.161          /* do scalar until we can align... */
   7.162 @@ -898,12 +898,12 @@
   7.163      int srcskip, dstskip;
   7.164  
   7.165      /* Set up some basic variables */
   7.166 -    width = info->d_width;
   7.167 -    height = info->d_height;
   7.168 -    src = (Uint32 *) info->s_pixels;
   7.169 +    width = info->dst_w;
   7.170 +    height = info->dst_h;
   7.171 +    src = (Uint32 *) info->src;
   7.172      srcskip = info->s_skip / 4;
   7.173 -    dst = info->d_pixels;
   7.174 -    dstskip = info->d_skip;
   7.175 +    dst = info->dst;
   7.176 +    dstskip = info->dst_pitch;
   7.177      map = info->table;
   7.178  
   7.179      if (map == NULL) {
   7.180 @@ -1015,12 +1015,12 @@
   7.181      int srcskip, dstskip;
   7.182  
   7.183      /* Set up some basic variables */
   7.184 -    width = info->d_width;
   7.185 -    height = info->d_height;
   7.186 -    src = (Uint32 *) info->s_pixels;
   7.187 +    width = info->dst_w;
   7.188 +    height = info->dst_h;
   7.189 +    src = (Uint32 *) info->src;
   7.190      srcskip = info->s_skip / 4;
   7.191 -    dst = (Uint16 *) info->d_pixels;
   7.192 -    dstskip = info->d_skip / 2;
   7.193 +    dst = (Uint16 *) info->dst;
   7.194 +    dstskip = info->dst_pitch / 2;
   7.195  
   7.196  #ifdef USE_DUFFS_LOOP
   7.197      while (height--) {
   7.198 @@ -1139,12 +1139,12 @@
   7.199      int srcskip, dstskip;
   7.200  
   7.201      /* Set up some basic variables */
   7.202 -    width = info->d_width;
   7.203 -    height = info->d_height;
   7.204 -    src = (Uint32 *) info->s_pixels;
   7.205 +    width = info->dst_w;
   7.206 +    height = info->dst_h;
   7.207 +    src = (Uint32 *) info->src;
   7.208      srcskip = info->s_skip / 4;
   7.209 -    dst = (Uint16 *) info->d_pixels;
   7.210 -    dstskip = info->d_skip / 2;
   7.211 +    dst = (Uint16 *) info->dst;
   7.212 +    dstskip = info->dst_pitch / 2;
   7.213  
   7.214  #ifdef USE_DUFFS_LOOP
   7.215      while (height--) {
   7.216 @@ -1252,12 +1252,12 @@
   7.217      int srcskip, dstskip;
   7.218  
   7.219      /* Set up some basic variables */
   7.220 -    width = info->d_width;
   7.221 -    height = info->d_height;
   7.222 -    src = (Uint8 *) info->s_pixels;
   7.223 +    width = info->dst_w;
   7.224 +    height = info->dst_h;
   7.225 +    src = (Uint8 *) info->src;
   7.226      srcskip = info->s_skip;
   7.227 -    dst = (Uint32 *) info->d_pixels;
   7.228 -    dstskip = info->d_skip / 4;
   7.229 +    dst = (Uint32 *) info->dst;
   7.230 +    dstskip = info->dst_pitch / 4;
   7.231  
   7.232  #ifdef USE_DUFFS_LOOP
   7.233      while (height--) {
   7.234 @@ -1874,12 +1874,12 @@
   7.235      int srcskip, dstskip;
   7.236  
   7.237      /* Set up some basic variables */
   7.238 -    width = info->d_width;
   7.239 -    height = info->d_height;
   7.240 -    src = (Uint32 *) info->s_pixels;
   7.241 +    width = info->dst_w;
   7.242 +    height = info->dst_h;
   7.243 +    src = (Uint32 *) info->src;
   7.244      srcskip = info->s_skip / 4;
   7.245 -    dst = info->d_pixels;
   7.246 -    dstskip = info->d_skip;
   7.247 +    dst = info->dst;
   7.248 +    dstskip = info->dst_pitch;
   7.249      map = info->table;
   7.250  
   7.251  #ifdef USE_DUFFS_LOOP
   7.252 @@ -1947,12 +1947,12 @@
   7.253      SDL_PixelFormat *srcfmt;
   7.254  
   7.255      /* Set up some basic variables */
   7.256 -    width = info->d_width;
   7.257 -    height = info->d_height;
   7.258 -    src = info->s_pixels;
   7.259 +    width = info->dst_w;
   7.260 +    height = info->dst_h;
   7.261 +    src = info->src;
   7.262      srcskip = info->s_skip;
   7.263 -    dst = info->d_pixels;
   7.264 -    dstskip = info->d_skip;
   7.265 +    dst = info->dst;
   7.266 +    dstskip = info->dst_pitch;
   7.267      map = info->table;
   7.268      srcfmt = info->src;
   7.269      srcbpp = srcfmt->BytesPerPixel;
   7.270 @@ -2028,12 +2028,12 @@
   7.271  static void
   7.272  Blit4to4MaskAlpha(SDL_BlitInfo * info)
   7.273  {
   7.274 -    int width = info->d_width;
   7.275 -    int height = info->d_height;
   7.276 -    Uint32 *src = (Uint32 *) info->s_pixels;
   7.277 +    int width = info->dst_w;
   7.278 +    int height = info->dst_h;
   7.279 +    Uint32 *src = (Uint32 *) info->src;
   7.280      int srcskip = info->s_skip;
   7.281 -    Uint32 *dst = (Uint32 *) info->d_pixels;
   7.282 -    int dstskip = info->d_skip;
   7.283 +    Uint32 *dst = (Uint32 *) info->dst;
   7.284 +    int dstskip = info->dst_pitch;
   7.285      SDL_PixelFormat *srcfmt = info->src;
   7.286      SDL_PixelFormat *dstfmt = info->dst;
   7.287  
   7.288 @@ -2077,12 +2077,12 @@
   7.289  static void
   7.290  BlitNtoN(SDL_BlitInfo * info)
   7.291  {
   7.292 -    int width = info->d_width;
   7.293 -    int height = info->d_height;
   7.294 -    Uint8 *src = info->s_pixels;
   7.295 +    int width = info->dst_w;
   7.296 +    int height = info->dst_h;
   7.297 +    Uint8 *src = info->src;
   7.298      int srcskip = info->s_skip;
   7.299 -    Uint8 *dst = info->d_pixels;
   7.300 -    int dstskip = info->d_skip;
   7.301 +    Uint8 *dst = info->dst;
   7.302 +    int dstskip = info->dst_pitch;
   7.303      SDL_PixelFormat *srcfmt = info->src;
   7.304      int srcbpp = srcfmt->BytesPerPixel;
   7.305      SDL_PixelFormat *dstfmt = info->dst;
   7.306 @@ -2112,12 +2112,12 @@
   7.307  static void
   7.308  BlitNtoNCopyAlpha(SDL_BlitInfo * info)
   7.309  {
   7.310 -    int width = info->d_width;
   7.311 -    int height = info->d_height;
   7.312 -    Uint8 *src = info->s_pixels;
   7.313 +    int width = info->dst_w;
   7.314 +    int height = info->dst_h;
   7.315 +    Uint8 *src = info->src;
   7.316      int srcskip = info->s_skip;
   7.317 -    Uint8 *dst = info->d_pixels;
   7.318 -    int dstskip = info->d_skip;
   7.319 +    Uint8 *dst = info->dst;
   7.320 +    int dstskip = info->dst_pitch;
   7.321      SDL_PixelFormat *srcfmt = info->src;
   7.322      int srcbpp = srcfmt->BytesPerPixel;
   7.323      SDL_PixelFormat *dstfmt = info->dst;
   7.324 @@ -2142,12 +2142,12 @@
   7.325  static void
   7.326  BlitNto1Key(SDL_BlitInfo * info)
   7.327  {
   7.328 -    int width = info->d_width;
   7.329 -    int height = info->d_height;
   7.330 -    Uint8 *src = info->s_pixels;
   7.331 +    int width = info->dst_w;
   7.332 +    int height = info->dst_h;
   7.333 +    Uint8 *src = info->src;
   7.334      int srcskip = info->s_skip;
   7.335 -    Uint8 *dst = info->d_pixels;
   7.336 -    int dstskip = info->d_skip;
   7.337 +    Uint8 *dst = info->dst;
   7.338 +    int dstskip = info->dst_pitch;
   7.339      SDL_PixelFormat *srcfmt = info->src;
   7.340      const Uint8 *palmap = info->table;
   7.341      Uint32 ckey = info->ckey;
   7.342 @@ -2208,12 +2208,12 @@
   7.343  static void
   7.344  Blit2to2Key(SDL_BlitInfo * info)
   7.345  {
   7.346 -    int width = info->d_width;
   7.347 -    int height = info->d_height;
   7.348 -    Uint16 *srcp = (Uint16 *) info->s_pixels;
   7.349 +    int width = info->dst_w;
   7.350 +    int height = info->dst_h;
   7.351 +    Uint16 *srcp = (Uint16 *) info->src;
   7.352      int srcskip = info->s_skip;
   7.353 -    Uint16 *dstp = (Uint16 *) info->d_pixels;
   7.354 -    int dstskip = info->d_skip;
   7.355 +    Uint16 *dstp = (Uint16 *) info->dst;
   7.356 +    int dstskip = info->dst_pitch;
   7.357      Uint32 ckey = info->ckey;
   7.358      Uint32 rgbmask = ~info->src->Amask;
   7.359  
   7.360 @@ -2242,12 +2242,12 @@
   7.361  static void
   7.362  BlitNtoNKey(SDL_BlitInfo * info)
   7.363  {
   7.364 -    int width = info->d_width;
   7.365 -    int height = info->d_height;
   7.366 -    Uint8 *src = info->s_pixels;
   7.367 +    int width = info->dst_w;
   7.368 +    int height = info->dst_h;
   7.369 +    Uint8 *src = info->src;
   7.370      int srcskip = info->s_skip;
   7.371 -    Uint8 *dst = info->d_pixels;
   7.372 -    int dstskip = info->d_skip;
   7.373 +    Uint8 *dst = info->dst;
   7.374 +    int dstskip = info->dst_pitch;
   7.375      Uint32 ckey = info->ckey;
   7.376      SDL_PixelFormat *srcfmt = info->src;
   7.377      SDL_PixelFormat *dstfmt = info->dst;
   7.378 @@ -2285,12 +2285,12 @@
   7.379  static void
   7.380  BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info)
   7.381  {
   7.382 -    int width = info->d_width;
   7.383 -    int height = info->d_height;
   7.384 -    Uint8 *src = info->s_pixels;
   7.385 +    int width = info->dst_w;
   7.386 +    int height = info->dst_h;
   7.387 +    Uint8 *src = info->src;
   7.388      int srcskip = info->s_skip;
   7.389 -    Uint8 *dst = info->d_pixels;
   7.390 -    int dstskip = info->d_skip;
   7.391 +    Uint8 *dst = info->dst;
   7.392 +    int dstskip = info->dst_pitch;
   7.393      Uint32 ckey = info->ckey;
   7.394      SDL_PixelFormat *srcfmt = info->src;
   7.395      SDL_PixelFormat *dstfmt = info->dst;
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/src/video/SDL_blit_auto.c	Fri Aug 17 06:21:58 2007 +0000
     8.3 @@ -0,0 +1,5357 @@
     8.4 +/* DO NOT EDIT!  This file is generated by sdlgenblit.pl */
     8.5 +/*
     8.6 +    SDL - Simple DirectMedia Layer
     8.7 +    Copyright (C) 1997-2006 Sam Lantinga
     8.8 +
     8.9 +    This library is free software; you can redistribute it and/or
    8.10 +    modify it under the terms of the GNU Lesser General Public
    8.11 +    License as published by the Free Software Foundation; either
    8.12 +    version 2.1 of the License, or (at your option) any later version.
    8.13 +
    8.14 +    This library is distributed in the hope that it will be useful,
    8.15 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.16 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    8.17 +    Lesser General Public License for more details.
    8.18 +
    8.19 +    You should have received a copy of the GNU Lesser General Public
    8.20 +    License along with this library; if not, write to the Free Software
    8.21 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    8.22 +
    8.23 +    Sam Lantinga
    8.24 +    slouken@libsdl.org
    8.25 +*/
    8.26 +#include "SDL_config.h"
    8.27 +
    8.28 +/* *INDENT-OFF* */
    8.29 +
    8.30 +#include "SDL_video.h"
    8.31 +#include "SDL_blit.h"
    8.32 +#include "SDL_blit_auto.h"
    8.33 +
    8.34 +static SDL_BlitFuncEntry _SDL_GeneratedBlitFuncTable[] = {
    8.35 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Scale },
    8.36 +    { 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 },
    8.37 +    { 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 },
    8.38 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate },
    8.39 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Scale },
    8.40 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Blend },
    8.41 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale },
    8.42 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Scale },
    8.43 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend },
    8.44 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Blend_Scale },
    8.45 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate },
    8.46 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Scale },
    8.47 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend },
    8.48 +    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale },
    8.49 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Scale },
    8.50 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend },
    8.51 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Blend_Scale },
    8.52 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate },
    8.53 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Scale },
    8.54 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Blend },
    8.55 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale },
    8.56 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Scale },
    8.57 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend },
    8.58 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Blend_Scale },
    8.59 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate },
    8.60 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Scale },
    8.61 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend },
    8.62 +    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale },
    8.63 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Scale },
    8.64 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend },
    8.65 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Blend_Scale },
    8.66 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate },
    8.67 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Scale },
    8.68 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Blend },
    8.69 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale },
    8.70 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Scale },
    8.71 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend },
    8.72 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Blend_Scale },
    8.73 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate },
    8.74 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Scale },
    8.75 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend },
    8.76 +    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale },
    8.77 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Scale },
    8.78 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend },
    8.79 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Blend_Scale },
    8.80 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate },
    8.81 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Scale },
    8.82 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Blend },
    8.83 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale },
    8.84 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Scale },
    8.85 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend },
    8.86 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Blend_Scale },
    8.87 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate },
    8.88 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Scale },
    8.89 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend },
    8.90 +    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale },
    8.91 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Scale },
    8.92 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend },
    8.93 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Blend_Scale },
    8.94 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate },
    8.95 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Scale },
    8.96 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Blend },
    8.97 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale },
    8.98 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Scale },
    8.99 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend },
   8.100 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Blend_Scale },
   8.101 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate },
   8.102 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Scale },
   8.103 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend },
   8.104 +    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale },
   8.105 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Scale },
   8.106 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend },
   8.107 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Blend_Scale },
   8.108 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate },
   8.109 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Scale },
   8.110 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Blend },
   8.111 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale },
   8.112 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Scale },
   8.113 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend },
   8.114 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Blend_Scale },
   8.115 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate },
   8.116 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Scale },
   8.117 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend },
   8.118 +    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale },
   8.119 +    { 0, 0, 0, 0, NULL }
   8.120 +};
   8.121 +
   8.122 +SDL_BlitFuncEntry *SDL_GeneratedBlitFuncTable = _SDL_GeneratedBlitFuncTable;
   8.123 +
   8.124 +void SDL_Blit_RGB888_RGB888_Scale(SDL_BlitInfo *info)
   8.125 +{
   8.126 +    const int flags = info->flags;
   8.127 +    int srcy, srcx;
   8.128 +    int posy, posx;
   8.129 +    int incy, incx;
   8.130 +
   8.131 +    srcy = 0;
   8.132 +    posy = 0;
   8.133 +    incy = (info->src_h << 16) / info->dst_h;
   8.134 +    incx = (info->src_w << 16) / info->dst_w;
   8.135 +
   8.136 +    while (info->dst_h--) {
   8.137 +        Uint32 *src;
   8.138 +        Uint32 *dst = (Uint32 *)info->dst;
   8.139 +        int n = info->dst_w;
   8.140 +        srcx = -1;
   8.141 +        posx = 0x10000L;
   8.142 +        while (posy >= 0x10000L) {
   8.143 +            ++srcy;
   8.144 +            posy -= 0x10000L;
   8.145 +        }
   8.146 +        while (n--) {
   8.147 +            if (posx >= 0x10000L) {
   8.148 +                while (posx >= 0x10000L) {
   8.149 +                    ++srcx;
   8.150 +                    posx -= 0x10000L;
   8.151 +                }
   8.152 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
   8.153 +            }
   8.154 +            *dst = *src;
   8.155 +            posx += incx;
   8.156 +            ++dst;
   8.157 +        }
   8.158 +        posy += incy;
   8.159 +        info->dst += info->dst_pitch;
   8.160 +    }
   8.161 +}
   8.162 +
   8.163 +void SDL_Blit_RGB888_RGB888_Blend(SDL_BlitInfo *info)
   8.164 +{
   8.165 +    const int flags = info->flags;
   8.166 +    Uint32 srcpixel;
   8.167 +    Uint32 srcR, srcG, srcB, srcA;
   8.168 +    Uint32 dstpixel;
   8.169 +    Uint32 dstR, dstG, dstB, dstA;
   8.170 +
   8.171 +    while (info->dst_h--) {
   8.172 +        Uint32 *src = (Uint32 *)info->src;
   8.173 +        Uint32 *dst = (Uint32 *)info->dst;
   8.174 +        int n = info->dst_w;
   8.175 +        while (n--) {
   8.176 +            srcpixel = *src;
   8.177 +            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
   8.178 +            dstpixel = *dst;
   8.179 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
   8.180 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
   8.181 +                /* This goes away if we ever use premultiplied alpha */
   8.182 +                if (srcA < 255) {
   8.183 +                    srcR = (srcR * srcA) / 255;
   8.184 +                    srcG = (srcG * srcA) / 255;
   8.185 +                    srcB = (srcB * srcA) / 255;
   8.186 +                }
   8.187 +            }
   8.188 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
   8.189 +            case SDL_COPY_MASK:
   8.190 +                if (srcA) {
   8.191 +                    dstR = srcR;
   8.192 +                    dstG = srcG;
   8.193 +                    dstB = srcB;
   8.194 +                }
   8.195 +                break;
   8.196 +            case SDL_COPY_BLEND:
   8.197 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
   8.198 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
   8.199 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
   8.200 +                break;
   8.201 +            case SDL_COPY_ADD:
   8.202 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
   8.203 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
   8.204 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
   8.205 +                break;
   8.206 +            case SDL_COPY_MOD:
   8.207 +                dstR = (srcR * dstR) / 255;
   8.208 +                dstG = (srcG * dstG) / 255;
   8.209 +                dstB = (srcB * dstB) / 255;
   8.210 +                break;
   8.211 +            }
   8.212 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
   8.213 +            *dst = dstpixel;
   8.214 +            ++src;
   8.215 +            ++dst;
   8.216 +        }
   8.217 +        info->src += info->src_pitch;
   8.218 +        info->dst += info->dst_pitch;
   8.219 +    }
   8.220 +}
   8.221 +
   8.222 +void SDL_Blit_RGB888_RGB888_Blend_Scale(SDL_BlitInfo *info)
   8.223 +{
   8.224 +    const int flags = info->flags;
   8.225 +    Uint32 srcpixel;
   8.226 +    Uint32 srcR, srcG, srcB, srcA;
   8.227 +    Uint32 dstpixel;
   8.228 +    Uint32 dstR, dstG, dstB, dstA;
   8.229 +    int srcy, srcx;
   8.230 +    int posy, posx;
   8.231 +    int incy, incx;
   8.232 +
   8.233 +    srcy = 0;
   8.234 +    posy = 0;
   8.235 +    incy = (info->src_h << 16) / info->dst_h;
   8.236 +    incx = (info->src_w << 16) / info->dst_w;
   8.237 +
   8.238 +    while (info->dst_h--) {
   8.239 +        Uint32 *src;
   8.240 +        Uint32 *dst = (Uint32 *)info->dst;
   8.241 +        int n = info->dst_w;
   8.242 +        srcx = -1;
   8.243 +        posx = 0x10000L;
   8.244 +        while (posy >= 0x10000L) {
   8.245 +            ++srcy;
   8.246 +            posy -= 0x10000L;
   8.247 +        }
   8.248 +        while (n--) {
   8.249 +            if (posx >= 0x10000L) {
   8.250 +                while (posx >= 0x10000L) {
   8.251 +                    ++srcx;
   8.252 +                    posx -= 0x10000L;
   8.253 +                }
   8.254 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
   8.255 +            }
   8.256 +            srcpixel = *src;
   8.257 +            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
   8.258 +            dstpixel = *dst;
   8.259 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
   8.260 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
   8.261 +                /* This goes away if we ever use premultiplied alpha */
   8.262 +                if (srcA < 255) {
   8.263 +                    srcR = (srcR * srcA) / 255;
   8.264 +                    srcG = (srcG * srcA) / 255;
   8.265 +                    srcB = (srcB * srcA) / 255;
   8.266 +                }
   8.267 +            }
   8.268 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
   8.269 +            case SDL_COPY_MASK:
   8.270 +                if (srcA) {
   8.271 +                    dstR = srcR;
   8.272 +                    dstG = srcG;
   8.273 +                    dstB = srcB;
   8.274 +                }
   8.275 +                break;
   8.276 +            case SDL_COPY_BLEND:
   8.277 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
   8.278 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
   8.279 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
   8.280 +                break;
   8.281 +            case SDL_COPY_ADD:
   8.282 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
   8.283 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
   8.284 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
   8.285 +                break;
   8.286 +            case SDL_COPY_MOD:
   8.287 +                dstR = (srcR * dstR) / 255;
   8.288 +                dstG = (srcG * dstG) / 255;
   8.289 +                dstB = (srcB * dstB) / 255;
   8.290 +                break;
   8.291 +            }
   8.292 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
   8.293 +            *dst = dstpixel;
   8.294 +            posx += incx;
   8.295 +            ++dst;
   8.296 +        }
   8.297 +        posy += incy;
   8.298 +        info->dst += info->dst_pitch;
   8.299 +    }
   8.300 +}
   8.301 +
   8.302 +void SDL_Blit_RGB888_RGB888_Modulate(SDL_BlitInfo *info)
   8.303 +{
   8.304 +    const int flags = info->flags;
   8.305 +    const Uint32 modulateR = info->r;
   8.306 +    const Uint32 modulateG = info->g;
   8.307 +    const Uint32 modulateB = info->b;
   8.308 +    const Uint32 modulateA = info->a;
   8.309 +    Uint32 pixel;
   8.310 +    Uint32 R, G, B, A;
   8.311 +
   8.312 +    while (info->dst_h--) {
   8.313 +        Uint32 *src = (Uint32 *)info->src;
   8.314 +        Uint32 *dst = (Uint32 *)info->dst;
   8.315 +        int n = info->dst_w;
   8.316 +        while (n--) {
   8.317 +            pixel = *src;
   8.318 +            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
   8.319 +            if (flags & SDL_COPY_MODULATE_COLOR) {
   8.320 +                R = (R * modulateR) / 255;
   8.321 +                G = (G * modulateG) / 255;
   8.322 +                B = (B * modulateB) / 255;
   8.323 +            }
   8.324 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
   8.325 +                A = (A * modulateA) / 255;
   8.326 +            }
   8.327 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
   8.328 +            *dst = pixel;
   8.329 +            ++src;
   8.330 +            ++dst;
   8.331 +        }
   8.332 +        info->src += info->src_pitch;
   8.333 +        info->dst += info->dst_pitch;
   8.334 +    }
   8.335 +}
   8.336 +
   8.337 +void SDL_Blit_RGB888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
   8.338 +{
   8.339 +    const int flags = info->flags;
   8.340 +    const Uint32 modulateR = info->r;
   8.341 +    const Uint32 modulateG = info->g;
   8.342 +    const Uint32 modulateB = info->b;
   8.343 +    const Uint32 modulateA = info->a;
   8.344 +    Uint32 pixel;
   8.345 +    Uint32 R, G, B, A;
   8.346 +    int srcy, srcx;
   8.347 +    int posy, posx;
   8.348 +    int incy, incx;
   8.349 +
   8.350 +    srcy = 0;
   8.351 +    posy = 0;
   8.352 +    incy = (info->src_h << 16) / info->dst_h;
   8.353 +    incx = (info->src_w << 16) / info->dst_w;
   8.354 +
   8.355 +    while (info->dst_h--) {
   8.356 +        Uint32 *src;
   8.357 +        Uint32 *dst = (Uint32 *)info->dst;
   8.358 +        int n = info->dst_w;
   8.359 +        srcx = -1;
   8.360 +        posx = 0x10000L;
   8.361 +        while (posy >= 0x10000L) {
   8.362 +            ++srcy;
   8.363 +            posy -= 0x10000L;
   8.364 +        }
   8.365 +        while (n--) {
   8.366 +            if (posx >= 0x10000L) {
   8.367 +                while (posx >= 0x10000L) {
   8.368 +                    ++srcx;
   8.369 +                    posx -= 0x10000L;
   8.370 +                }
   8.371 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
   8.372 +            }
   8.373 +            pixel = *src;
   8.374 +            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
   8.375 +            if (flags & SDL_COPY_MODULATE_COLOR) {
   8.376 +                R = (R * modulateR) / 255;
   8.377 +                G = (G * modulateG) / 255;
   8.378 +                B = (B * modulateB) / 255;
   8.379 +            }
   8.380 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
   8.381 +                A = (A * modulateA) / 255;
   8.382 +            }
   8.383 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
   8.384 +            *dst = pixel;
   8.385 +            posx += incx;
   8.386 +            ++dst;
   8.387 +        }
   8.388 +        posy += incy;
   8.389 +        info->dst += info->dst_pitch;
   8.390 +    }
   8.391 +}
   8.392 +
   8.393 +void SDL_Blit_RGB888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
   8.394 +{
   8.395 +    const int flags = info->flags;
   8.396 +    const Uint32 modulateR = info->r;
   8.397 +    const Uint32 modulateG = info->g;
   8.398 +    const Uint32 modulateB = info->b;
   8.399 +    const Uint32 modulateA = info->a;
   8.400 +    Uint32 srcpixel;
   8.401 +    Uint32 srcR, srcG, srcB, srcA;
   8.402 +    Uint32 dstpixel;
   8.403 +    Uint32 dstR, dstG, dstB, dstA;
   8.404 +
   8.405 +    while (info->dst_h--) {
   8.406 +        Uint32 *src = (Uint32 *)info->src;
   8.407 +        Uint32 *dst = (Uint32 *)info->dst;
   8.408 +        int n = info->dst_w;
   8.409 +        while (n--) {
   8.410 +            srcpixel = *src;
   8.411 +            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
   8.412 +            dstpixel = *dst;
   8.413 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
   8.414 +            if (flags & SDL_COPY_MODULATE_COLOR) {
   8.415 +                srcR = (srcR * modulateR) / 255;
   8.416 +                srcG = (srcG * modulateG) / 255;
   8.417 +                srcB = (srcB * modulateB) / 255;
   8.418 +            }
   8.419 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
   8.420 +                srcA = (srcA * modulateA) / 255;
   8.421 +            }
   8.422 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
   8.423 +                /* This goes away if we ever use premultiplied alpha */
   8.424 +                if (srcA < 255) {
   8.425 +                    srcR = (srcR * srcA) / 255;
   8.426 +                    srcG = (srcG * srcA) / 255;
   8.427 +                    srcB = (srcB * srcA) / 255;
   8.428 +                }
   8.429 +            }
   8.430 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
   8.431 +            case SDL_COPY_MASK:
   8.432 +                if (srcA) {
   8.433 +                    dstR = srcR;
   8.434 +                    dstG = srcG;
   8.435 +                    dstB = srcB;
   8.436 +                }
   8.437 +                break;
   8.438 +            case SDL_COPY_BLEND:
   8.439 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
   8.440 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
   8.441 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
   8.442 +                break;
   8.443 +            case SDL_COPY_ADD:
   8.444 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
   8.445 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
   8.446 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
   8.447 +                break;
   8.448 +            case SDL_COPY_MOD:
   8.449 +                dstR = (srcR * dstR) / 255;
   8.450 +                dstG = (srcG * dstG) / 255;
   8.451 +                dstB = (srcB * dstB) / 255;
   8.452 +                break;
   8.453 +            }
   8.454 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
   8.455 +            *dst = dstpixel;
   8.456 +            ++src;
   8.457 +            ++dst;
   8.458 +        }
   8.459 +        info->src += info->src_pitch;
   8.460 +        info->dst += info->dst_pitch;
   8.461 +    }
   8.462 +}
   8.463 +
   8.464 +void SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
   8.465 +{
   8.466 +    const int flags = info->flags;
   8.467 +    const Uint32 modulateR = info->r;
   8.468 +    const Uint32 modulateG = info->g;
   8.469 +    const Uint32 modulateB = info->b;
   8.470 +    const Uint32 modulateA = info->a;
   8.471 +    Uint32 srcpixel;
   8.472 +    Uint32 srcR, srcG, srcB, srcA;
   8.473 +    Uint32 dstpixel;
   8.474 +    Uint32 dstR, dstG, dstB, dstA;
   8.475 +    int srcy, srcx;
   8.476 +    int posy, posx;
   8.477 +    int incy, incx;
   8.478 +
   8.479 +    srcy = 0;
   8.480 +    posy = 0;
   8.481 +    incy = (info->src_h << 16) / info->dst_h;
   8.482 +    incx = (info->src_w << 16) / info->dst_w;
   8.483 +
   8.484 +    while (info->dst_h--) {
   8.485 +        Uint32 *src;
   8.486 +        Uint32 *dst = (Uint32 *)info->dst;
   8.487 +        int n = info->dst_w;
   8.488 +        srcx = -1;
   8.489 +        posx = 0x10000L;
   8.490 +        while (posy >= 0x10000L) {
   8.491 +            ++srcy;
   8.492 +            posy -= 0x10000L;
   8.493 +        }
   8.494 +        while (n--) {
   8.495 +            if (posx >= 0x10000L) {
   8.496 +                while (posx >= 0x10000L) {
   8.497 +                    ++srcx;
   8.498 +                    posx -= 0x10000L;
   8.499 +                }
   8.500 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
   8.501 +            }
   8.502 +            srcpixel = *src;
   8.503 +            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
   8.504 +            dstpixel = *dst;
   8.505 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
   8.506 +            if (flags & SDL_COPY_MODULATE_COLOR) {
   8.507 +                srcR = (srcR * modulateR) / 255;
   8.508 +                srcG = (srcG * modulateG) / 255;
   8.509 +                srcB = (srcB * modulateB) / 255;
   8.510 +            }
   8.511 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
   8.512 +                srcA = (srcA * modulateA) / 255;
   8.513 +            }
   8.514 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
   8.515 +                /* This goes away if we ever use premultiplied alpha */
   8.516 +                if (srcA < 255) {
   8.517 +                    srcR = (srcR * srcA) / 255;
   8.518 +                    srcG = (srcG * srcA) / 255;
   8.519 +                    srcB = (srcB * srcA) / 255;
   8.520 +                }
   8.521 +            }
   8.522 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
   8.523 +            case SDL_COPY_MASK:
   8.524 +                if (srcA) {
   8.525 +                    dstR = srcR;
   8.526 +                    dstG = srcG;
   8.527 +                    dstB = srcB;
   8.528 +                }
   8.529 +                break;
   8.530 +            case SDL_COPY_BLEND:
   8.531 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
   8.532 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
   8.533 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
   8.534 +                break;
   8.535 +            case SDL_COPY_ADD:
   8.536 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
   8.537 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
   8.538 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
   8.539 +                break;
   8.540 +            case SDL_COPY_MOD:
   8.541 +                dstR = (srcR * dstR) / 255;
   8.542 +                dstG = (srcG * dstG) / 255;
   8.543 +                dstB = (srcB * dstB) / 255;
   8.544 +                break;
   8.545 +            }
   8.546 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
   8.547 +            *dst = dstpixel;
   8.548 +            posx += incx;
   8.549 +            ++dst;
   8.550 +        }
   8.551 +        posy += incy;
   8.552 +        info->dst += info->dst_pitch;
   8.553 +    }
   8.554 +}
   8.555 +
   8.556 +void SDL_Blit_RGB888_BGR888_Scale(SDL_BlitInfo *info)
   8.557 +{
   8.558 +    const int flags = info->flags;
   8.559 +    Uint32 pixel;
   8.560 +    Uint32 R, G, B, A;
   8.561 +    int srcy, srcx;
   8.562 +    int posy, posx;
   8.563 +    int incy, incx;
   8.564 +
   8.565 +    srcy = 0;
   8.566 +    posy = 0;
   8.567 +    incy = (info->src_h << 16) / info->dst_h;
   8.568 +    incx = (info->src_w << 16) / info->dst_w;
   8.569 +
   8.570 +    while (info->dst_h--) {
   8.571 +        Uint32 *src;
   8.572 +        Uint32 *dst = (Uint32 *)info->dst;
   8.573 +        int n = info->dst_w;
   8.574 +        srcx = -1;
   8.575 +        posx = 0x10000L;
   8.576 +        while (posy >= 0x10000L) {
   8.577 +            ++srcy;
   8.578 +            posy -= 0x10000L;
   8.579 +        }
   8.580 +        while (n--) {
   8.581 +            if (posx >= 0x10000L) {
   8.582 +                while (posx >= 0x10000L) {
   8.583 +                    ++srcx;
   8.584 +                    posx -= 0x10000L;
   8.585 +                }
   8.586 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
   8.587 +            }
   8.588 +            pixel = *src;
   8.589 +            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
   8.590 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
   8.591 +            *dst = pixel;
   8.592 +            posx += incx;
   8.593 +            ++dst;
   8.594 +        }
   8.595 +        posy += incy;
   8.596 +        info->dst += info->dst_pitch;
   8.597 +    }
   8.598 +}
   8.599 +
   8.600 +void SDL_Blit_RGB888_BGR888_Blend(SDL_BlitInfo *info)
   8.601 +{
   8.602 +    const int flags = info->flags;
   8.603 +    Uint32 srcpixel;
   8.604 +    Uint32 srcR, srcG, srcB, srcA;
   8.605 +    Uint32 dstpixel;
   8.606 +    Uint32 dstR, dstG, dstB, dstA;
   8.607 +
   8.608 +    while (info->dst_h--) {
   8.609 +        Uint32 *src = (Uint32 *)info->src;
   8.610 +        Uint32 *dst = (Uint32 *)info->dst;
   8.611 +        int n = info->dst_w;
   8.612 +        while (n--) {
   8.613 +            srcpixel = *src;
   8.614 +            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
   8.615 +            dstpixel = *dst;
   8.616 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
   8.617 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
   8.618 +                /* This goes away if we ever use premultiplied alpha */
   8.619 +                if (srcA < 255) {
   8.620 +                    srcR = (srcR * srcA) / 255;
   8.621 +                    srcG = (srcG * srcA) / 255;
   8.622 +                    srcB = (srcB * srcA) / 255;
   8.623 +                }
   8.624 +            }
   8.625 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
   8.626 +            case SDL_COPY_MASK:
   8.627 +                if (srcA) {
   8.628 +                    dstR = srcR;
   8.629 +                    dstG = srcG;
   8.630 +                    dstB = srcB;
   8.631 +                }
   8.632 +                break;
   8.633 +            case SDL_COPY_BLEND:
   8.634 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
   8.635 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
   8.636 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
   8.637 +                break;
   8.638 +            case SDL_COPY_ADD:
   8.639 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
   8.640 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
   8.641 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
   8.642 +                break;
   8.643 +            case SDL_COPY_MOD:
   8.644 +                dstR = (srcR * dstR) / 255;
   8.645 +                dstG = (srcG * dstG) / 255;
   8.646 +                dstB = (srcB * dstB) / 255;
   8.647 +                break;
   8.648 +            }
   8.649 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
   8.650 +            *dst = dstpixel;
   8.651 +            ++src;
   8.652 +            ++dst;
   8.653 +        }
   8.654 +        info->src += info->src_pitch;
   8.655 +        info->dst += info->dst_pitch;
   8.656 +    }
   8.657 +}
   8.658 +
   8.659 +void SDL_Blit_RGB888_BGR888_Blend_Scale(SDL_BlitInfo *info)
   8.660 +{
   8.661 +    const int flags = info->flags;
   8.662 +    Uint32 srcpixel;
   8.663 +    Uint32 srcR, srcG, srcB, srcA;
   8.664 +    Uint32 dstpixel;
   8.665 +    Uint32 dstR, dstG, dstB, dstA;
   8.666 +    int srcy, srcx;
   8.667 +    int posy, posx;
   8.668 +    int incy, incx;
   8.669 +
   8.670 +    srcy = 0;
   8.671 +    posy = 0;
   8.672 +    incy = (info->src_h << 16) / info->dst_h;
   8.673 +    incx = (info->src_w << 16) / info->dst_w;
   8.674 +
   8.675 +    while (info->dst_h--) {
   8.676 +        Uint32 *src;
   8.677 +        Uint32 *dst = (Uint32 *)info->dst;
   8.678 +        int n = info->dst_w;
   8.679 +        srcx = -1;
   8.680 +        posx = 0x10000L;
   8.681 +        while (posy >= 0x10000L) {
   8.682 +            ++srcy;
   8.683 +            posy -= 0x10000L;
   8.684 +        }
   8.685 +        while (n--) {
   8.686 +            if (posx >= 0x10000L) {
   8.687 +                while (posx >= 0x10000L) {
   8.688 +                    ++srcx;
   8.689 +                    posx -= 0x10000L;
   8.690 +                }
   8.691 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
   8.692 +            }
   8.693 +            srcpixel = *src;
   8.694 +            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
   8.695 +            dstpixel = *dst;
   8.696 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
   8.697 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
   8.698 +                /* This goes away if we ever use premultiplied alpha */
   8.699 +                if (srcA < 255) {
   8.700 +                    srcR = (srcR * srcA) / 255;
   8.701 +                    srcG = (srcG * srcA) / 255;
   8.702 +                    srcB = (srcB * srcA) / 255;
   8.703 +                }
   8.704 +            }
   8.705 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
   8.706 +            case SDL_COPY_MASK:
   8.707 +                if (srcA) {
   8.708 +                    dstR = srcR;
   8.709 +                    dstG = srcG;
   8.710 +                    dstB = srcB;
   8.711 +                }
   8.712 +                break;
   8.713 +            case SDL_COPY_BLEND:
   8.714 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
   8.715 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
   8.716 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
   8.717 +                break;
   8.718 +            case SDL_COPY_ADD:
   8.719 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
   8.720 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
   8.721 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
   8.722 +                break;
   8.723 +            case SDL_COPY_MOD:
   8.724 +                dstR = (srcR * dstR) / 255;
   8.725 +                dstG = (srcG * dstG) / 255;
   8.726 +                dstB = (srcB * dstB) / 255;
   8.727 +                break;
   8.728 +            }
   8.729 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
   8.730 +            *dst = dstpixel;
   8.731 +            posx += incx;
   8.732 +            ++dst;
   8.733 +        }
   8.734 +        posy += incy;
   8.735 +        info->dst += info->dst_pitch;
   8.736 +    }
   8.737 +}
   8.738 +
   8.739 +void SDL_Blit_RGB888_BGR888_Modulate(SDL_BlitInfo *info)
   8.740 +{
   8.741 +    const int flags = info->flags;
   8.742 +    const Uint32 modulateR = info->r;
   8.743 +    const Uint32 modulateG = info->g;
   8.744 +    const Uint32 modulateB = info->b;
   8.745 +    const Uint32 modulateA = info->a;
   8.746 +    Uint32 pixel;
   8.747 +    Uint32 R, G, B, A;
   8.748 +
   8.749 +    while (info->dst_h--) {
   8.750 +        Uint32 *src = (Uint32 *)info->src;
   8.751 +        Uint32 *dst = (Uint32 *)info->dst;
   8.752 +        int n = info->dst_w;
   8.753 +        while (n--) {
   8.754 +            pixel = *src;
   8.755 +            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
   8.756 +            if (flags & SDL_COPY_MODULATE_COLOR) {
   8.757 +                R = (R * modulateR) / 255;
   8.758 +                G = (G * modulateG) / 255;
   8.759 +                B = (B * modulateB) / 255;
   8.760 +            }
   8.761 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
   8.762 +                A = (A * modulateA) / 255;
   8.763 +            }
   8.764 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
   8.765 +            *dst = pixel;
   8.766 +            ++src;
   8.767 +            ++dst;
   8.768 +        }
   8.769 +        info->src += info->src_pitch;
   8.770 +        info->dst += info->dst_pitch;
   8.771 +    }
   8.772 +}
   8.773 +
   8.774 +void SDL_Blit_RGB888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
   8.775 +{
   8.776 +    const int flags = info->flags;
   8.777 +    const Uint32 modulateR = info->r;
   8.778 +    const Uint32 modulateG = info->g;
   8.779 +    const Uint32 modulateB = info->b;
   8.780 +    const Uint32 modulateA = info->a;
   8.781 +    Uint32 pixel;
   8.782 +    Uint32 R, G, B, A;
   8.783 +    int srcy, srcx;
   8.784 +    int posy, posx;
   8.785 +    int incy, incx;
   8.786 +
   8.787 +    srcy = 0;
   8.788 +    posy = 0;
   8.789 +    incy = (info->src_h << 16) / info->dst_h;
   8.790 +    incx = (info->src_w << 16) / info->dst_w;
   8.791 +
   8.792 +    while (info->dst_h--) {
   8.793 +        Uint32 *src;
   8.794 +        Uint32 *dst = (Uint32 *)info->dst;
   8.795 +        int n = info->dst_w;
   8.796 +        srcx = -1;
   8.797 +        posx = 0x10000L;
   8.798 +        while (posy >= 0x10000L) {
   8.799 +            ++srcy;
   8.800 +            posy -= 0x10000L;
   8.801 +        }
   8.802 +        while (n--) {
   8.803 +            if (posx >= 0x10000L) {
   8.804 +                while (posx >= 0x10000L) {
   8.805 +                    ++srcx;
   8.806 +                    posx -= 0x10000L;
   8.807 +                }
   8.808 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
   8.809 +            }
   8.810 +            pixel = *src;
   8.811 +            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
   8.812 +            if (flags & SDL_COPY_MODULATE_COLOR) {
   8.813 +                R = (R * modulateR) / 255;
   8.814 +                G = (G * modulateG) / 255;
   8.815 +                B = (B * modulateB) / 255;
   8.816 +            }
   8.817 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
   8.818 +                A = (A * modulateA) / 255;
   8.819 +            }
   8.820 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
   8.821 +            *dst = pixel;
   8.822 +            posx += incx;
   8.823 +            ++dst;
   8.824 +        }
   8.825 +        posy += incy;
   8.826 +        info->dst += info->dst_pitch;
   8.827 +    }
   8.828 +}
   8.829 +
   8.830 +void SDL_Blit_RGB888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
   8.831 +{
   8.832 +    const int flags = info->flags;
   8.833 +    const Uint32 modulateR = info->r;
   8.834 +    const Uint32 modulateG = info->g;
   8.835 +    const Uint32 modulateB = info->b;
   8.836 +    const Uint32 modulateA = info->a;
   8.837 +    Uint32 srcpixel;
   8.838 +    Uint32 srcR, srcG, srcB, srcA;
   8.839 +    Uint32 dstpixel;
   8.840 +    Uint32 dstR, dstG, dstB, dstA;
   8.841 +
   8.842 +    while (info->dst_h--) {
   8.843 +        Uint32 *src = (Uint32 *)info->src;
   8.844 +        Uint32 *dst = (Uint32 *)info->dst;
   8.845 +        int n = info->dst_w;
   8.846 +        while (n--) {
   8.847 +            srcpixel = *src;
   8.848 +            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
   8.849 +            dstpixel = *dst;
   8.850 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
   8.851 +            if (flags & SDL_COPY_MODULATE_COLOR) {
   8.852 +                srcR = (srcR * modulateR) / 255;
   8.853 +                srcG = (srcG * modulateG) / 255;
   8.854 +                srcB = (srcB * modulateB) / 255;
   8.855 +            }
   8.856 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
   8.857 +                srcA = (srcA * modulateA) / 255;
   8.858 +            }
   8.859 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
   8.860 +                /* This goes away if we ever use premultiplied alpha */
   8.861 +                if (srcA < 255) {
   8.862 +                    srcR = (srcR * srcA) / 255;
   8.863 +                    srcG = (srcG * srcA) / 255;
   8.864 +                    srcB = (srcB * srcA) / 255;
   8.865 +                }
   8.866 +            }
   8.867 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
   8.868 +            case SDL_COPY_MASK:
   8.869 +                if (srcA) {
   8.870 +                    dstR = srcR;
   8.871 +                    dstG = srcG;
   8.872 +                    dstB = srcB;
   8.873 +                }
   8.874 +                break;
   8.875 +            case SDL_COPY_BLEND:
   8.876 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
   8.877 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
   8.878 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
   8.879 +                break;
   8.880 +            case SDL_COPY_ADD:
   8.881 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
   8.882 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
   8.883 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
   8.884 +                break;
   8.885 +            case SDL_COPY_MOD:
   8.886 +                dstR = (srcR * dstR) / 255;
   8.887 +                dstG = (srcG * dstG) / 255;
   8.888 +                dstB = (srcB * dstB) / 255;
   8.889 +                break;
   8.890 +            }
   8.891 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
   8.892 +            *dst = dstpixel;
   8.893 +            ++src;
   8.894 +            ++dst;
   8.895 +        }
   8.896 +        info->src += info->src_pitch;
   8.897 +        info->dst += info->dst_pitch;
   8.898 +    }
   8.899 +}
   8.900 +
   8.901 +void SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
   8.902 +{
   8.903 +    const int flags = info->flags;
   8.904 +    const Uint32 modulateR = info->r;
   8.905 +    const Uint32 modulateG = info->g;
   8.906 +    const Uint32 modulateB = info->b;
   8.907 +    const Uint32 modulateA = info->a;
   8.908 +    Uint32 srcpixel;
   8.909 +    Uint32 srcR, srcG, srcB, srcA;
   8.910 +    Uint32 dstpixel;
   8.911 +    Uint32 dstR, dstG, dstB, dstA;
   8.912 +    int srcy, srcx;
   8.913 +    int posy, posx;
   8.914 +    int incy, incx;
   8.915 +
   8.916 +    srcy = 0;
   8.917 +    posy = 0;
   8.918 +    incy = (info->src_h << 16) / info->dst_h;
   8.919 +    incx = (info->src_w << 16) / info->dst_w;
   8.920 +
   8.921 +    while (info->dst_h--) {
   8.922 +        Uint32 *src;
   8.923 +        Uint32 *dst = (Uint32 *)info->dst;
   8.924 +        int n = info->dst_w;
   8.925 +        srcx = -1;
   8.926 +        posx = 0x10000L;
   8.927 +        while (posy >= 0x10000L) {
   8.928 +            ++srcy;
   8.929 +            posy -= 0x10000L;
   8.930 +        }
   8.931 +        while (n--) {
   8.932 +            if (posx >= 0x10000L) {
   8.933 +                while (posx >= 0x10000L) {
   8.934 +                    ++srcx;
   8.935 +                    posx -= 0x10000L;
   8.936 +                }
   8.937 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
   8.938 +            }
   8.939 +            srcpixel = *src;
   8.940 +            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
   8.941 +            dstpixel = *dst;
   8.942 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
   8.943 +            if (flags & SDL_COPY_MODULATE_COLOR) {
   8.944 +                srcR = (srcR * modulateR) / 255;
   8.945 +                srcG = (srcG * modulateG) / 255;
   8.946 +                srcB = (srcB * modulateB) / 255;
   8.947 +            }
   8.948 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
   8.949 +                srcA = (srcA * modulateA) / 255;
   8.950 +            }
   8.951 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
   8.952 +                /* This goes away if we ever use premultiplied alpha */
   8.953 +                if (srcA < 255) {
   8.954 +                    srcR = (srcR * srcA) / 255;
   8.955 +                    srcG = (srcG * srcA) / 255;
   8.956 +                    srcB = (srcB * srcA) / 255;
   8.957 +                }
   8.958 +            }
   8.959 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
   8.960 +            case SDL_COPY_MASK:
   8.961 +                if (srcA) {
   8.962 +                    dstR = srcR;
   8.963 +                    dstG = srcG;
   8.964 +                    dstB = srcB;
   8.965 +                }
   8.966 +                break;
   8.967 +            case SDL_COPY_BLEND:
   8.968 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
   8.969 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
   8.970 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
   8.971 +                break;
   8.972 +            case SDL_COPY_ADD:
   8.973 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
   8.974 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
   8.975 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
   8.976 +                break;
   8.977 +            case SDL_COPY_MOD:
   8.978 +                dstR = (srcR * dstR) / 255;
   8.979 +                dstG = (srcG * dstG) / 255;
   8.980 +                dstB = (srcB * dstB) / 255;
   8.981 +                break;
   8.982 +            }
   8.983 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
   8.984 +            *dst = dstpixel;
   8.985 +            posx += incx;
   8.986 +            ++dst;
   8.987 +        }
   8.988 +        posy += incy;
   8.989 +        info->dst += info->dst_pitch;
   8.990 +    }
   8.991 +}
   8.992 +
   8.993 +void SDL_Blit_BGR888_RGB888_Scale(SDL_BlitInfo *info)
   8.994 +{
   8.995 +    const int flags = info->flags;
   8.996 +    Uint32 pixel;
   8.997 +    Uint32 R, G, B, A;
   8.998 +    int srcy, srcx;
   8.999 +    int posy, posx;
  8.1000 +    int incy, incx;
  8.1001 +
  8.1002 +    srcy = 0;
  8.1003 +    posy = 0;
  8.1004 +    incy = (info->src_h << 16) / info->dst_h;
  8.1005 +    incx = (info->src_w << 16) / info->dst_w;
  8.1006 +
  8.1007 +    while (info->dst_h--) {
  8.1008 +        Uint32 *src;
  8.1009 +        Uint32 *dst = (Uint32 *)info->dst;
  8.1010 +        int n = info->dst_w;
  8.1011 +        srcx = -1;
  8.1012 +        posx = 0x10000L;
  8.1013 +        while (posy >= 0x10000L) {
  8.1014 +            ++srcy;
  8.1015 +            posy -= 0x10000L;
  8.1016 +        }
  8.1017 +        while (n--) {
  8.1018 +            if (posx >= 0x10000L) {
  8.1019 +                while (posx >= 0x10000L) {
  8.1020 +                    ++srcx;
  8.1021 +                    posx -= 0x10000L;
  8.1022 +                }
  8.1023 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.1024 +            }
  8.1025 +            pixel = *src;
  8.1026 +            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
  8.1027 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  8.1028 +            *dst = pixel;
  8.1029 +            posx += incx;
  8.1030 +            ++dst;
  8.1031 +        }
  8.1032 +        posy += incy;
  8.1033 +        info->dst += info->dst_pitch;
  8.1034 +    }
  8.1035 +}
  8.1036 +
  8.1037 +void SDL_Blit_BGR888_RGB888_Blend(SDL_BlitInfo *info)
  8.1038 +{
  8.1039 +    const int flags = info->flags;
  8.1040 +    Uint32 srcpixel;
  8.1041 +    Uint32 srcR, srcG, srcB, srcA;
  8.1042 +    Uint32 dstpixel;
  8.1043 +    Uint32 dstR, dstG, dstB, dstA;
  8.1044 +
  8.1045 +    while (info->dst_h--) {
  8.1046 +        Uint32 *src = (Uint32 *)info->src;
  8.1047 +        Uint32 *dst = (Uint32 *)info->dst;
  8.1048 +        int n = info->dst_w;
  8.1049 +        while (n--) {
  8.1050 +            srcpixel = *src;
  8.1051 +            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
  8.1052 +            dstpixel = *dst;
  8.1053 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.1054 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.1055 +                /* This goes away if we ever use premultiplied alpha */
  8.1056 +                if (srcA < 255) {
  8.1057 +                    srcR = (srcR * srcA) / 255;
  8.1058 +                    srcG = (srcG * srcA) / 255;
  8.1059 +                    srcB = (srcB * srcA) / 255;
  8.1060 +                }
  8.1061 +            }
  8.1062 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.1063 +            case SDL_COPY_MASK:
  8.1064 +                if (srcA) {
  8.1065 +                    dstR = srcR;
  8.1066 +                    dstG = srcG;
  8.1067 +                    dstB = srcB;
  8.1068 +                }
  8.1069 +                break;
  8.1070 +            case SDL_COPY_BLEND:
  8.1071 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.1072 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.1073 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.1074 +                break;
  8.1075 +            case SDL_COPY_ADD:
  8.1076 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.1077 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.1078 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.1079 +                break;
  8.1080 +            case SDL_COPY_MOD:
  8.1081 +                dstR = (srcR * dstR) / 255;
  8.1082 +                dstG = (srcG * dstG) / 255;
  8.1083 +                dstB = (srcB * dstB) / 255;
  8.1084 +                break;
  8.1085 +            }
  8.1086 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.1087 +            *dst = dstpixel;
  8.1088 +            ++src;
  8.1089 +            ++dst;
  8.1090 +        }
  8.1091 +        info->src += info->src_pitch;
  8.1092 +        info->dst += info->dst_pitch;
  8.1093 +    }
  8.1094 +}
  8.1095 +
  8.1096 +void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info)
  8.1097 +{
  8.1098 +    const int flags = info->flags;
  8.1099 +    Uint32 srcpixel;
  8.1100 +    Uint32 srcR, srcG, srcB, srcA;
  8.1101 +    Uint32 dstpixel;
  8.1102 +    Uint32 dstR, dstG, dstB, dstA;
  8.1103 +    int srcy, srcx;
  8.1104 +    int posy, posx;
  8.1105 +    int incy, incx;
  8.1106 +
  8.1107 +    srcy = 0;
  8.1108 +    posy = 0;
  8.1109 +    incy = (info->src_h << 16) / info->dst_h;
  8.1110 +    incx = (info->src_w << 16) / info->dst_w;
  8.1111 +
  8.1112 +    while (info->dst_h--) {
  8.1113 +        Uint32 *src;
  8.1114 +        Uint32 *dst = (Uint32 *)info->dst;
  8.1115 +        int n = info->dst_w;
  8.1116 +        srcx = -1;
  8.1117 +        posx = 0x10000L;
  8.1118 +        while (posy >= 0x10000L) {
  8.1119 +            ++srcy;
  8.1120 +            posy -= 0x10000L;
  8.1121 +        }
  8.1122 +        while (n--) {
  8.1123 +            if (posx >= 0x10000L) {
  8.1124 +                while (posx >= 0x10000L) {
  8.1125 +                    ++srcx;
  8.1126 +                    posx -= 0x10000L;
  8.1127 +                }
  8.1128 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.1129 +            }
  8.1130 +            srcpixel = *src;
  8.1131 +            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
  8.1132 +            dstpixel = *dst;
  8.1133 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.1134 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.1135 +                /* This goes away if we ever use premultiplied alpha */
  8.1136 +                if (srcA < 255) {
  8.1137 +                    srcR = (srcR * srcA) / 255;
  8.1138 +                    srcG = (srcG * srcA) / 255;
  8.1139 +                    srcB = (srcB * srcA) / 255;
  8.1140 +                }
  8.1141 +            }
  8.1142 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.1143 +            case SDL_COPY_MASK:
  8.1144 +                if (srcA) {
  8.1145 +                    dstR = srcR;
  8.1146 +                    dstG = srcG;
  8.1147 +                    dstB = srcB;
  8.1148 +                }
  8.1149 +                break;
  8.1150 +            case SDL_COPY_BLEND:
  8.1151 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.1152 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.1153 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.1154 +                break;
  8.1155 +            case SDL_COPY_ADD:
  8.1156 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.1157 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.1158 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.1159 +                break;
  8.1160 +            case SDL_COPY_MOD:
  8.1161 +                dstR = (srcR * dstR) / 255;
  8.1162 +                dstG = (srcG * dstG) / 255;
  8.1163 +                dstB = (srcB * dstB) / 255;
  8.1164 +                break;
  8.1165 +            }
  8.1166 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.1167 +            *dst = dstpixel;
  8.1168 +            posx += incx;
  8.1169 +            ++dst;
  8.1170 +        }
  8.1171 +        posy += incy;
  8.1172 +        info->dst += info->dst_pitch;
  8.1173 +    }
  8.1174 +}
  8.1175 +
  8.1176 +void SDL_Blit_BGR888_RGB888_Modulate(SDL_BlitInfo *info)
  8.1177 +{
  8.1178 +    const int flags = info->flags;
  8.1179 +    const Uint32 modulateR = info->r;
  8.1180 +    const Uint32 modulateG = info->g;
  8.1181 +    const Uint32 modulateB = info->b;
  8.1182 +    const Uint32 modulateA = info->a;
  8.1183 +    Uint32 pixel;
  8.1184 +    Uint32 R, G, B, A;
  8.1185 +
  8.1186 +    while (info->dst_h--) {
  8.1187 +        Uint32 *src = (Uint32 *)info->src;
  8.1188 +        Uint32 *dst = (Uint32 *)info->dst;
  8.1189 +        int n = info->dst_w;
  8.1190 +        while (n--) {
  8.1191 +            pixel = *src;
  8.1192 +            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
  8.1193 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.1194 +                R = (R * modulateR) / 255;
  8.1195 +                G = (G * modulateG) / 255;
  8.1196 +                B = (B * modulateB) / 255;
  8.1197 +            }
  8.1198 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.1199 +                A = (A * modulateA) / 255;
  8.1200 +            }
  8.1201 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  8.1202 +            *dst = pixel;
  8.1203 +            ++src;
  8.1204 +            ++dst;
  8.1205 +        }
  8.1206 +        info->src += info->src_pitch;
  8.1207 +        info->dst += info->dst_pitch;
  8.1208 +    }
  8.1209 +}
  8.1210 +
  8.1211 +void SDL_Blit_BGR888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
  8.1212 +{
  8.1213 +    const int flags = info->flags;
  8.1214 +    const Uint32 modulateR = info->r;
  8.1215 +    const Uint32 modulateG = info->g;
  8.1216 +    const Uint32 modulateB = info->b;
  8.1217 +    const Uint32 modulateA = info->a;
  8.1218 +    Uint32 pixel;
  8.1219 +    Uint32 R, G, B, A;
  8.1220 +    int srcy, srcx;
  8.1221 +    int posy, posx;
  8.1222 +    int incy, incx;
  8.1223 +
  8.1224 +    srcy = 0;
  8.1225 +    posy = 0;
  8.1226 +    incy = (info->src_h << 16) / info->dst_h;
  8.1227 +    incx = (info->src_w << 16) / info->dst_w;
  8.1228 +
  8.1229 +    while (info->dst_h--) {
  8.1230 +        Uint32 *src;
  8.1231 +        Uint32 *dst = (Uint32 *)info->dst;
  8.1232 +        int n = info->dst_w;
  8.1233 +        srcx = -1;
  8.1234 +        posx = 0x10000L;
  8.1235 +        while (posy >= 0x10000L) {
  8.1236 +            ++srcy;
  8.1237 +            posy -= 0x10000L;
  8.1238 +        }
  8.1239 +        while (n--) {
  8.1240 +            if (posx >= 0x10000L) {
  8.1241 +                while (posx >= 0x10000L) {
  8.1242 +                    ++srcx;
  8.1243 +                    posx -= 0x10000L;
  8.1244 +                }
  8.1245 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.1246 +            }
  8.1247 +            pixel = *src;
  8.1248 +            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
  8.1249 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.1250 +                R = (R * modulateR) / 255;
  8.1251 +                G = (G * modulateG) / 255;
  8.1252 +                B = (B * modulateB) / 255;
  8.1253 +            }
  8.1254 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.1255 +                A = (A * modulateA) / 255;
  8.1256 +            }
  8.1257 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  8.1258 +            *dst = pixel;
  8.1259 +            posx += incx;
  8.1260 +            ++dst;
  8.1261 +        }
  8.1262 +        posy += incy;
  8.1263 +        info->dst += info->dst_pitch;
  8.1264 +    }
  8.1265 +}
  8.1266 +
  8.1267 +void SDL_Blit_BGR888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
  8.1268 +{
  8.1269 +    const int flags = info->flags;
  8.1270 +    const Uint32 modulateR = info->r;
  8.1271 +    const Uint32 modulateG = info->g;
  8.1272 +    const Uint32 modulateB = info->b;
  8.1273 +    const Uint32 modulateA = info->a;
  8.1274 +    Uint32 srcpixel;
  8.1275 +    Uint32 srcR, srcG, srcB, srcA;
  8.1276 +    Uint32 dstpixel;
  8.1277 +    Uint32 dstR, dstG, dstB, dstA;
  8.1278 +
  8.1279 +    while (info->dst_h--) {
  8.1280 +        Uint32 *src = (Uint32 *)info->src;
  8.1281 +        Uint32 *dst = (Uint32 *)info->dst;
  8.1282 +        int n = info->dst_w;
  8.1283 +        while (n--) {
  8.1284 +            srcpixel = *src;
  8.1285 +            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
  8.1286 +            dstpixel = *dst;
  8.1287 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.1288 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.1289 +                srcR = (srcR * modulateR) / 255;
  8.1290 +                srcG = (srcG * modulateG) / 255;
  8.1291 +                srcB = (srcB * modulateB) / 255;
  8.1292 +            }
  8.1293 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.1294 +                srcA = (srcA * modulateA) / 255;
  8.1295 +            }
  8.1296 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.1297 +                /* This goes away if we ever use premultiplied alpha */
  8.1298 +                if (srcA < 255) {
  8.1299 +                    srcR = (srcR * srcA) / 255;
  8.1300 +                    srcG = (srcG * srcA) / 255;
  8.1301 +                    srcB = (srcB * srcA) / 255;
  8.1302 +                }
  8.1303 +            }
  8.1304 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.1305 +            case SDL_COPY_MASK:
  8.1306 +                if (srcA) {
  8.1307 +                    dstR = srcR;
  8.1308 +                    dstG = srcG;
  8.1309 +                    dstB = srcB;
  8.1310 +                }
  8.1311 +                break;
  8.1312 +            case SDL_COPY_BLEND:
  8.1313 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.1314 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.1315 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.1316 +                break;
  8.1317 +            case SDL_COPY_ADD:
  8.1318 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.1319 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.1320 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.1321 +                break;
  8.1322 +            case SDL_COPY_MOD:
  8.1323 +                dstR = (srcR * dstR) / 255;
  8.1324 +                dstG = (srcG * dstG) / 255;
  8.1325 +                dstB = (srcB * dstB) / 255;
  8.1326 +                break;
  8.1327 +            }
  8.1328 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.1329 +            *dst = dstpixel;
  8.1330 +            ++src;
  8.1331 +            ++dst;
  8.1332 +        }
  8.1333 +        info->src += info->src_pitch;
  8.1334 +        info->dst += info->dst_pitch;
  8.1335 +    }
  8.1336 +}
  8.1337 +
  8.1338 +void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  8.1339 +{
  8.1340 +    const int flags = info->flags;
  8.1341 +    const Uint32 modulateR = info->r;
  8.1342 +    const Uint32 modulateG = info->g;
  8.1343 +    const Uint32 modulateB = info->b;
  8.1344 +    const Uint32 modulateA = info->a;
  8.1345 +    Uint32 srcpixel;
  8.1346 +    Uint32 srcR, srcG, srcB, srcA;
  8.1347 +    Uint32 dstpixel;
  8.1348 +    Uint32 dstR, dstG, dstB, dstA;
  8.1349 +    int srcy, srcx;
  8.1350 +    int posy, posx;
  8.1351 +    int incy, incx;
  8.1352 +
  8.1353 +    srcy = 0;
  8.1354 +    posy = 0;
  8.1355 +    incy = (info->src_h << 16) / info->dst_h;
  8.1356 +    incx = (info->src_w << 16) / info->dst_w;
  8.1357 +
  8.1358 +    while (info->dst_h--) {
  8.1359 +        Uint32 *src;
  8.1360 +        Uint32 *dst = (Uint32 *)info->dst;
  8.1361 +        int n = info->dst_w;
  8.1362 +        srcx = -1;
  8.1363 +        posx = 0x10000L;
  8.1364 +        while (posy >= 0x10000L) {
  8.1365 +            ++srcy;
  8.1366 +            posy -= 0x10000L;
  8.1367 +        }
  8.1368 +        while (n--) {
  8.1369 +            if (posx >= 0x10000L) {
  8.1370 +                while (posx >= 0x10000L) {
  8.1371 +                    ++srcx;
  8.1372 +                    posx -= 0x10000L;
  8.1373 +                }
  8.1374 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.1375 +            }
  8.1376 +            srcpixel = *src;
  8.1377 +            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
  8.1378 +            dstpixel = *dst;
  8.1379 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.1380 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.1381 +                srcR = (srcR * modulateR) / 255;
  8.1382 +                srcG = (srcG * modulateG) / 255;
  8.1383 +                srcB = (srcB * modulateB) / 255;
  8.1384 +            }
  8.1385 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.1386 +                srcA = (srcA * modulateA) / 255;
  8.1387 +            }
  8.1388 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.1389 +                /* This goes away if we ever use premultiplied alpha */
  8.1390 +                if (srcA < 255) {
  8.1391 +                    srcR = (srcR * srcA) / 255;
  8.1392 +                    srcG = (srcG * srcA) / 255;
  8.1393 +                    srcB = (srcB * srcA) / 255;
  8.1394 +                }
  8.1395 +            }
  8.1396 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.1397 +            case SDL_COPY_MASK:
  8.1398 +                if (srcA) {
  8.1399 +                    dstR = srcR;
  8.1400 +                    dstG = srcG;
  8.1401 +                    dstB = srcB;
  8.1402 +                }
  8.1403 +                break;
  8.1404 +            case SDL_COPY_BLEND:
  8.1405 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.1406 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.1407 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.1408 +                break;
  8.1409 +            case SDL_COPY_ADD:
  8.1410 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.1411 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.1412 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.1413 +                break;
  8.1414 +            case SDL_COPY_MOD:
  8.1415 +                dstR = (srcR * dstR) / 255;
  8.1416 +                dstG = (srcG * dstG) / 255;
  8.1417 +                dstB = (srcB * dstB) / 255;
  8.1418 +                break;
  8.1419 +            }
  8.1420 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.1421 +            *dst = dstpixel;
  8.1422 +            posx += incx;
  8.1423 +            ++dst;
  8.1424 +        }
  8.1425 +        posy += incy;
  8.1426 +        info->dst += info->dst_pitch;
  8.1427 +    }
  8.1428 +}
  8.1429 +
  8.1430 +void SDL_Blit_BGR888_BGR888_Scale(SDL_BlitInfo *info)
  8.1431 +{
  8.1432 +    const int flags = info->flags;
  8.1433 +    int srcy, srcx;
  8.1434 +    int posy, posx;
  8.1435 +    int incy, incx;
  8.1436 +
  8.1437 +    srcy = 0;
  8.1438 +    posy = 0;
  8.1439 +    incy = (info->src_h << 16) / info->dst_h;
  8.1440 +    incx = (info->src_w << 16) / info->dst_w;
  8.1441 +
  8.1442 +    while (info->dst_h--) {
  8.1443 +        Uint32 *src;
  8.1444 +        Uint32 *dst = (Uint32 *)info->dst;
  8.1445 +        int n = info->dst_w;
  8.1446 +        srcx = -1;
  8.1447 +        posx = 0x10000L;
  8.1448 +        while (posy >= 0x10000L) {
  8.1449 +            ++srcy;
  8.1450 +            posy -= 0x10000L;
  8.1451 +        }
  8.1452 +        while (n--) {
  8.1453 +            if (posx >= 0x10000L) {
  8.1454 +                while (posx >= 0x10000L) {
  8.1455 +                    ++srcx;
  8.1456 +                    posx -= 0x10000L;
  8.1457 +                }
  8.1458 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.1459 +            }
  8.1460 +            *dst = *src;
  8.1461 +            posx += incx;
  8.1462 +            ++dst;
  8.1463 +        }
  8.1464 +        posy += incy;
  8.1465 +        info->dst += info->dst_pitch;
  8.1466 +    }
  8.1467 +}
  8.1468 +
  8.1469 +void SDL_Blit_BGR888_BGR888_Blend(SDL_BlitInfo *info)
  8.1470 +{
  8.1471 +    const int flags = info->flags;
  8.1472 +    Uint32 srcpixel;
  8.1473 +    Uint32 srcR, srcG, srcB, srcA;
  8.1474 +    Uint32 dstpixel;
  8.1475 +    Uint32 dstR, dstG, dstB, dstA;
  8.1476 +
  8.1477 +    while (info->dst_h--) {
  8.1478 +        Uint32 *src = (Uint32 *)info->src;
  8.1479 +        Uint32 *dst = (Uint32 *)info->dst;
  8.1480 +        int n = info->dst_w;
  8.1481 +        while (n--) {
  8.1482 +            srcpixel = *src;
  8.1483 +            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
  8.1484 +            dstpixel = *dst;
  8.1485 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.1486 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.1487 +                /* This goes away if we ever use premultiplied alpha */
  8.1488 +                if (srcA < 255) {
  8.1489 +                    srcR = (srcR * srcA) / 255;
  8.1490 +                    srcG = (srcG * srcA) / 255;
  8.1491 +                    srcB = (srcB * srcA) / 255;
  8.1492 +                }
  8.1493 +            }
  8.1494 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.1495 +            case SDL_COPY_MASK:
  8.1496 +                if (srcA) {
  8.1497 +                    dstR = srcR;
  8.1498 +                    dstG = srcG;
  8.1499 +                    dstB = srcB;
  8.1500 +                }
  8.1501 +                break;
  8.1502 +            case SDL_COPY_BLEND:
  8.1503 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.1504 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.1505 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.1506 +                break;
  8.1507 +            case SDL_COPY_ADD:
  8.1508 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.1509 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.1510 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.1511 +                break;
  8.1512 +            case SDL_COPY_MOD:
  8.1513 +                dstR = (srcR * dstR) / 255;
  8.1514 +                dstG = (srcG * dstG) / 255;
  8.1515 +                dstB = (srcB * dstB) / 255;
  8.1516 +                break;
  8.1517 +            }
  8.1518 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.1519 +            *dst = dstpixel;
  8.1520 +            ++src;
  8.1521 +            ++dst;
  8.1522 +        }
  8.1523 +        info->src += info->src_pitch;
  8.1524 +        info->dst += info->dst_pitch;
  8.1525 +    }
  8.1526 +}
  8.1527 +
  8.1528 +void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info)
  8.1529 +{
  8.1530 +    const int flags = info->flags;
  8.1531 +    Uint32 srcpixel;
  8.1532 +    Uint32 srcR, srcG, srcB, srcA;
  8.1533 +    Uint32 dstpixel;
  8.1534 +    Uint32 dstR, dstG, dstB, dstA;
  8.1535 +    int srcy, srcx;
  8.1536 +    int posy, posx;
  8.1537 +    int incy, incx;
  8.1538 +
  8.1539 +    srcy = 0;
  8.1540 +    posy = 0;
  8.1541 +    incy = (info->src_h << 16) / info->dst_h;
  8.1542 +    incx = (info->src_w << 16) / info->dst_w;
  8.1543 +
  8.1544 +    while (info->dst_h--) {
  8.1545 +        Uint32 *src;
  8.1546 +        Uint32 *dst = (Uint32 *)info->dst;
  8.1547 +        int n = info->dst_w;
  8.1548 +        srcx = -1;
  8.1549 +        posx = 0x10000L;
  8.1550 +        while (posy >= 0x10000L) {
  8.1551 +            ++srcy;
  8.1552 +            posy -= 0x10000L;
  8.1553 +        }
  8.1554 +        while (n--) {
  8.1555 +            if (posx >= 0x10000L) {
  8.1556 +                while (posx >= 0x10000L) {
  8.1557 +                    ++srcx;
  8.1558 +                    posx -= 0x10000L;
  8.1559 +                }
  8.1560 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.1561 +            }
  8.1562 +            srcpixel = *src;
  8.1563 +            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
  8.1564 +            dstpixel = *dst;
  8.1565 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.1566 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.1567 +                /* This goes away if we ever use premultiplied alpha */
  8.1568 +                if (srcA < 255) {
  8.1569 +                    srcR = (srcR * srcA) / 255;
  8.1570 +                    srcG = (srcG * srcA) / 255;
  8.1571 +                    srcB = (srcB * srcA) / 255;
  8.1572 +                }
  8.1573 +            }
  8.1574 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.1575 +            case SDL_COPY_MASK:
  8.1576 +                if (srcA) {
  8.1577 +                    dstR = srcR;
  8.1578 +                    dstG = srcG;
  8.1579 +                    dstB = srcB;
  8.1580 +                }
  8.1581 +                break;
  8.1582 +            case SDL_COPY_BLEND:
  8.1583 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.1584 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.1585 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.1586 +                break;
  8.1587 +            case SDL_COPY_ADD:
  8.1588 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.1589 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.1590 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.1591 +                break;
  8.1592 +            case SDL_COPY_MOD:
  8.1593 +                dstR = (srcR * dstR) / 255;
  8.1594 +                dstG = (srcG * dstG) / 255;
  8.1595 +                dstB = (srcB * dstB) / 255;
  8.1596 +                break;
  8.1597 +            }
  8.1598 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.1599 +            *dst = dstpixel;
  8.1600 +            posx += incx;
  8.1601 +            ++dst;
  8.1602 +        }
  8.1603 +        posy += incy;
  8.1604 +        info->dst += info->dst_pitch;
  8.1605 +    }
  8.1606 +}
  8.1607 +
  8.1608 +void SDL_Blit_BGR888_BGR888_Modulate(SDL_BlitInfo *info)
  8.1609 +{
  8.1610 +    const int flags = info->flags;
  8.1611 +    const Uint32 modulateR = info->r;
  8.1612 +    const Uint32 modulateG = info->g;
  8.1613 +    const Uint32 modulateB = info->b;
  8.1614 +    const Uint32 modulateA = info->a;
  8.1615 +    Uint32 pixel;
  8.1616 +    Uint32 R, G, B, A;
  8.1617 +
  8.1618 +    while (info->dst_h--) {
  8.1619 +        Uint32 *src = (Uint32 *)info->src;
  8.1620 +        Uint32 *dst = (Uint32 *)info->dst;
  8.1621 +        int n = info->dst_w;
  8.1622 +        while (n--) {
  8.1623 +            pixel = *src;
  8.1624 +            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
  8.1625 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.1626 +                R = (R * modulateR) / 255;
  8.1627 +                G = (G * modulateG) / 255;
  8.1628 +                B = (B * modulateB) / 255;
  8.1629 +            }
  8.1630 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.1631 +                A = (A * modulateA) / 255;
  8.1632 +            }
  8.1633 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  8.1634 +            *dst = pixel;
  8.1635 +            ++src;
  8.1636 +            ++dst;
  8.1637 +        }
  8.1638 +        info->src += info->src_pitch;
  8.1639 +        info->dst += info->dst_pitch;
  8.1640 +    }
  8.1641 +}
  8.1642 +
  8.1643 +void SDL_Blit_BGR888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
  8.1644 +{
  8.1645 +    const int flags = info->flags;
  8.1646 +    const Uint32 modulateR = info->r;
  8.1647 +    const Uint32 modulateG = info->g;
  8.1648 +    const Uint32 modulateB = info->b;
  8.1649 +    const Uint32 modulateA = info->a;
  8.1650 +    Uint32 pixel;
  8.1651 +    Uint32 R, G, B, A;
  8.1652 +    int srcy, srcx;
  8.1653 +    int posy, posx;
  8.1654 +    int incy, incx;
  8.1655 +
  8.1656 +    srcy = 0;
  8.1657 +    posy = 0;
  8.1658 +    incy = (info->src_h << 16) / info->dst_h;
  8.1659 +    incx = (info->src_w << 16) / info->dst_w;
  8.1660 +
  8.1661 +    while (info->dst_h--) {
  8.1662 +        Uint32 *src;
  8.1663 +        Uint32 *dst = (Uint32 *)info->dst;
  8.1664 +        int n = info->dst_w;
  8.1665 +        srcx = -1;
  8.1666 +        posx = 0x10000L;
  8.1667 +        while (posy >= 0x10000L) {
  8.1668 +            ++srcy;
  8.1669 +            posy -= 0x10000L;
  8.1670 +        }
  8.1671 +        while (n--) {
  8.1672 +            if (posx >= 0x10000L) {
  8.1673 +                while (posx >= 0x10000L) {
  8.1674 +                    ++srcx;
  8.1675 +                    posx -= 0x10000L;
  8.1676 +                }
  8.1677 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.1678 +            }
  8.1679 +            pixel = *src;
  8.1680 +            B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel; A = 0xFF;
  8.1681 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.1682 +                R = (R * modulateR) / 255;
  8.1683 +                G = (G * modulateG) / 255;
  8.1684 +                B = (B * modulateB) / 255;
  8.1685 +            }
  8.1686 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.1687 +                A = (A * modulateA) / 255;
  8.1688 +            }
  8.1689 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  8.1690 +            *dst = pixel;
  8.1691 +            posx += incx;
  8.1692 +            ++dst;
  8.1693 +        }
  8.1694 +        posy += incy;
  8.1695 +        info->dst += info->dst_pitch;
  8.1696 +    }
  8.1697 +}
  8.1698 +
  8.1699 +void SDL_Blit_BGR888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
  8.1700 +{
  8.1701 +    const int flags = info->flags;
  8.1702 +    const Uint32 modulateR = info->r;
  8.1703 +    const Uint32 modulateG = info->g;
  8.1704 +    const Uint32 modulateB = info->b;
  8.1705 +    const Uint32 modulateA = info->a;
  8.1706 +    Uint32 srcpixel;
  8.1707 +    Uint32 srcR, srcG, srcB, srcA;
  8.1708 +    Uint32 dstpixel;
  8.1709 +    Uint32 dstR, dstG, dstB, dstA;
  8.1710 +
  8.1711 +    while (info->dst_h--) {
  8.1712 +        Uint32 *src = (Uint32 *)info->src;
  8.1713 +        Uint32 *dst = (Uint32 *)info->dst;
  8.1714 +        int n = info->dst_w;
  8.1715 +        while (n--) {
  8.1716 +            srcpixel = *src;
  8.1717 +            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
  8.1718 +            dstpixel = *dst;
  8.1719 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.1720 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.1721 +                srcR = (srcR * modulateR) / 255;
  8.1722 +                srcG = (srcG * modulateG) / 255;
  8.1723 +                srcB = (srcB * modulateB) / 255;
  8.1724 +            }
  8.1725 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.1726 +                srcA = (srcA * modulateA) / 255;
  8.1727 +            }
  8.1728 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.1729 +                /* This goes away if we ever use premultiplied alpha */
  8.1730 +                if (srcA < 255) {
  8.1731 +                    srcR = (srcR * srcA) / 255;
  8.1732 +                    srcG = (srcG * srcA) / 255;
  8.1733 +                    srcB = (srcB * srcA) / 255;
  8.1734 +                }
  8.1735 +            }
  8.1736 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.1737 +            case SDL_COPY_MASK:
  8.1738 +                if (srcA) {
  8.1739 +                    dstR = srcR;
  8.1740 +                    dstG = srcG;
  8.1741 +                    dstB = srcB;
  8.1742 +                }
  8.1743 +                break;
  8.1744 +            case SDL_COPY_BLEND:
  8.1745 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.1746 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.1747 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.1748 +                break;
  8.1749 +            case SDL_COPY_ADD:
  8.1750 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.1751 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.1752 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.1753 +                break;
  8.1754 +            case SDL_COPY_MOD:
  8.1755 +                dstR = (srcR * dstR) / 255;
  8.1756 +                dstG = (srcG * dstG) / 255;
  8.1757 +                dstB = (srcB * dstB) / 255;
  8.1758 +                break;
  8.1759 +            }
  8.1760 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.1761 +            *dst = dstpixel;
  8.1762 +            ++src;
  8.1763 +            ++dst;
  8.1764 +        }
  8.1765 +        info->src += info->src_pitch;
  8.1766 +        info->dst += info->dst_pitch;
  8.1767 +    }
  8.1768 +}
  8.1769 +
  8.1770 +void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  8.1771 +{
  8.1772 +    const int flags = info->flags;
  8.1773 +    const Uint32 modulateR = info->r;
  8.1774 +    const Uint32 modulateG = info->g;
  8.1775 +    const Uint32 modulateB = info->b;
  8.1776 +    const Uint32 modulateA = info->a;
  8.1777 +    Uint32 srcpixel;
  8.1778 +    Uint32 srcR, srcG, srcB, srcA;
  8.1779 +    Uint32 dstpixel;
  8.1780 +    Uint32 dstR, dstG, dstB, dstA;
  8.1781 +    int srcy, srcx;
  8.1782 +    int posy, posx;
  8.1783 +    int incy, incx;
  8.1784 +
  8.1785 +    srcy = 0;
  8.1786 +    posy = 0;
  8.1787 +    incy = (info->src_h << 16) / info->dst_h;
  8.1788 +    incx = (info->src_w << 16) / info->dst_w;
  8.1789 +
  8.1790 +    while (info->dst_h--) {
  8.1791 +        Uint32 *src;
  8.1792 +        Uint32 *dst = (Uint32 *)info->dst;
  8.1793 +        int n = info->dst_w;
  8.1794 +        srcx = -1;
  8.1795 +        posx = 0x10000L;
  8.1796 +        while (posy >= 0x10000L) {
  8.1797 +            ++srcy;
  8.1798 +            posy -= 0x10000L;
  8.1799 +        }
  8.1800 +        while (n--) {
  8.1801 +            if (posx >= 0x10000L) {
  8.1802 +                while (posx >= 0x10000L) {
  8.1803 +                    ++srcx;
  8.1804 +                    posx -= 0x10000L;
  8.1805 +                }
  8.1806 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.1807 +            }
  8.1808 +            srcpixel = *src;
  8.1809 +            srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel; srcA = 0xFF;
  8.1810 +            dstpixel = *dst;
  8.1811 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.1812 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.1813 +                srcR = (srcR * modulateR) / 255;
  8.1814 +                srcG = (srcG * modulateG) / 255;
  8.1815 +                srcB = (srcB * modulateB) / 255;
  8.1816 +            }
  8.1817 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.1818 +                srcA = (srcA * modulateA) / 255;
  8.1819 +            }
  8.1820 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.1821 +                /* This goes away if we ever use premultiplied alpha */
  8.1822 +                if (srcA < 255) {
  8.1823 +                    srcR = (srcR * srcA) / 255;
  8.1824 +                    srcG = (srcG * srcA) / 255;
  8.1825 +                    srcB = (srcB * srcA) / 255;
  8.1826 +                }
  8.1827 +            }
  8.1828 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.1829 +            case SDL_COPY_MASK:
  8.1830 +                if (srcA) {
  8.1831 +                    dstR = srcR;
  8.1832 +                    dstG = srcG;
  8.1833 +                    dstB = srcB;
  8.1834 +                }
  8.1835 +                break;
  8.1836 +            case SDL_COPY_BLEND:
  8.1837 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.1838 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.1839 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.1840 +                break;
  8.1841 +            case SDL_COPY_ADD:
  8.1842 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.1843 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.1844 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.1845 +                break;
  8.1846 +            case SDL_COPY_MOD:
  8.1847 +                dstR = (srcR * dstR) / 255;
  8.1848 +                dstG = (srcG * dstG) / 255;
  8.1849 +                dstB = (srcB * dstB) / 255;
  8.1850 +                break;
  8.1851 +            }
  8.1852 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.1853 +            *dst = dstpixel;
  8.1854 +            posx += incx;
  8.1855 +            ++dst;
  8.1856 +        }
  8.1857 +        posy += incy;
  8.1858 +        info->dst += info->dst_pitch;
  8.1859 +    }
  8.1860 +}
  8.1861 +
  8.1862 +void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info)
  8.1863 +{
  8.1864 +    const int flags = info->flags;
  8.1865 +    Uint32 pixel;
  8.1866 +    Uint32 R, G, B, A;
  8.1867 +    int srcy, srcx;
  8.1868 +    int posy, posx;
  8.1869 +    int incy, incx;
  8.1870 +
  8.1871 +    srcy = 0;
  8.1872 +    posy = 0;
  8.1873 +    incy = (info->src_h << 16) / info->dst_h;
  8.1874 +    incx = (info->src_w << 16) / info->dst_w;
  8.1875 +
  8.1876 +    while (info->dst_h--) {
  8.1877 +        Uint32 *src;
  8.1878 +        Uint32 *dst = (Uint32 *)info->dst;
  8.1879 +        int n = info->dst_w;
  8.1880 +        srcx = -1;
  8.1881 +        posx = 0x10000L;
  8.1882 +        while (posy >= 0x10000L) {
  8.1883 +            ++srcy;
  8.1884 +            posy -= 0x10000L;
  8.1885 +        }
  8.1886 +        while (n--) {
  8.1887 +            if (posx >= 0x10000L) {
  8.1888 +                while (posx >= 0x10000L) {
  8.1889 +                    ++srcx;
  8.1890 +                    posx -= 0x10000L;
  8.1891 +                }
  8.1892 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.1893 +            }
  8.1894 +            pixel = *src;
  8.1895 +            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
  8.1896 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  8.1897 +            *dst = pixel;
  8.1898 +            posx += incx;
  8.1899 +            ++dst;
  8.1900 +        }
  8.1901 +        posy += incy;
  8.1902 +        info->dst += info->dst_pitch;
  8.1903 +    }
  8.1904 +}
  8.1905 +
  8.1906 +void SDL_Blit_ARGB8888_RGB888_Blend(SDL_BlitInfo *info)
  8.1907 +{
  8.1908 +    const int flags = info->flags;
  8.1909 +    Uint32 srcpixel;
  8.1910 +    Uint32 srcR, srcG, srcB, srcA;
  8.1911 +    Uint32 dstpixel;
  8.1912 +    Uint32 dstR, dstG, dstB, dstA;
  8.1913 +
  8.1914 +    while (info->dst_h--) {
  8.1915 +        Uint32 *src = (Uint32 *)info->src;
  8.1916 +        Uint32 *dst = (Uint32 *)info->dst;
  8.1917 +        int n = info->dst_w;
  8.1918 +        while (n--) {
  8.1919 +            srcpixel = *src;
  8.1920 +            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
  8.1921 +            dstpixel = *dst;
  8.1922 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.1923 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.1924 +                /* This goes away if we ever use premultiplied alpha */
  8.1925 +                if (srcA < 255) {
  8.1926 +                    srcR = (srcR * srcA) / 255;
  8.1927 +                    srcG = (srcG * srcA) / 255;
  8.1928 +                    srcB = (srcB * srcA) / 255;
  8.1929 +                }
  8.1930 +            }
  8.1931 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.1932 +            case SDL_COPY_MASK:
  8.1933 +                if (srcA) {
  8.1934 +                    dstR = srcR;
  8.1935 +                    dstG = srcG;
  8.1936 +                    dstB = srcB;
  8.1937 +                }
  8.1938 +                break;
  8.1939 +            case SDL_COPY_BLEND:
  8.1940 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.1941 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.1942 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.1943 +                break;
  8.1944 +            case SDL_COPY_ADD:
  8.1945 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.1946 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.1947 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.1948 +                break;
  8.1949 +            case SDL_COPY_MOD:
  8.1950 +                dstR = (srcR * dstR) / 255;
  8.1951 +                dstG = (srcG * dstG) / 255;
  8.1952 +                dstB = (srcB * dstB) / 255;
  8.1953 +                break;
  8.1954 +            }
  8.1955 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.1956 +            *dst = dstpixel;
  8.1957 +            ++src;
  8.1958 +            ++dst;
  8.1959 +        }
  8.1960 +        info->src += info->src_pitch;
  8.1961 +        info->dst += info->dst_pitch;
  8.1962 +    }
  8.1963 +}
  8.1964 +
  8.1965 +void SDL_Blit_ARGB8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
  8.1966 +{
  8.1967 +    const int flags = info->flags;
  8.1968 +    Uint32 srcpixel;
  8.1969 +    Uint32 srcR, srcG, srcB, srcA;
  8.1970 +    Uint32 dstpixel;
  8.1971 +    Uint32 dstR, dstG, dstB, dstA;
  8.1972 +    int srcy, srcx;
  8.1973 +    int posy, posx;
  8.1974 +    int incy, incx;
  8.1975 +
  8.1976 +    srcy = 0;
  8.1977 +    posy = 0;
  8.1978 +    incy = (info->src_h << 16) / info->dst_h;
  8.1979 +    incx = (info->src_w << 16) / info->dst_w;
  8.1980 +
  8.1981 +    while (info->dst_h--) {
  8.1982 +        Uint32 *src;
  8.1983 +        Uint32 *dst = (Uint32 *)info->dst;
  8.1984 +        int n = info->dst_w;
  8.1985 +        srcx = -1;
  8.1986 +        posx = 0x10000L;
  8.1987 +        while (posy >= 0x10000L) {
  8.1988 +            ++srcy;
  8.1989 +            posy -= 0x10000L;
  8.1990 +        }
  8.1991 +        while (n--) {
  8.1992 +            if (posx >= 0x10000L) {
  8.1993 +                while (posx >= 0x10000L) {
  8.1994 +                    ++srcx;
  8.1995 +                    posx -= 0x10000L;
  8.1996 +                }
  8.1997 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.1998 +            }
  8.1999 +            srcpixel = *src;
  8.2000 +            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
  8.2001 +            dstpixel = *dst;
  8.2002 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.2003 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.2004 +                /* This goes away if we ever use premultiplied alpha */
  8.2005 +                if (srcA < 255) {
  8.2006 +                    srcR = (srcR * srcA) / 255;
  8.2007 +                    srcG = (srcG * srcA) / 255;
  8.2008 +                    srcB = (srcB * srcA) / 255;
  8.2009 +                }
  8.2010 +            }
  8.2011 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.2012 +            case SDL_COPY_MASK:
  8.2013 +                if (srcA) {
  8.2014 +                    dstR = srcR;
  8.2015 +                    dstG = srcG;
  8.2016 +                    dstB = srcB;
  8.2017 +                }
  8.2018 +                break;
  8.2019 +            case SDL_COPY_BLEND:
  8.2020 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.2021 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.2022 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.2023 +                break;
  8.2024 +            case SDL_COPY_ADD:
  8.2025 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.2026 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.2027 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.2028 +                break;
  8.2029 +            case SDL_COPY_MOD:
  8.2030 +                dstR = (srcR * dstR) / 255;
  8.2031 +                dstG = (srcG * dstG) / 255;
  8.2032 +                dstB = (srcB * dstB) / 255;
  8.2033 +                break;
  8.2034 +            }
  8.2035 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.2036 +            *dst = dstpixel;
  8.2037 +            posx += incx;
  8.2038 +            ++dst;
  8.2039 +        }
  8.2040 +        posy += incy;
  8.2041 +        info->dst += info->dst_pitch;
  8.2042 +    }
  8.2043 +}
  8.2044 +
  8.2045 +void SDL_Blit_ARGB8888_RGB888_Modulate(SDL_BlitInfo *info)
  8.2046 +{
  8.2047 +    const int flags = info->flags;
  8.2048 +    const Uint32 modulateR = info->r;
  8.2049 +    const Uint32 modulateG = info->g;
  8.2050 +    const Uint32 modulateB = info->b;
  8.2051 +    const Uint32 modulateA = info->a;
  8.2052 +    Uint32 pixel;
  8.2053 +    Uint32 R, G, B, A;
  8.2054 +
  8.2055 +    while (info->dst_h--) {
  8.2056 +        Uint32 *src = (Uint32 *)info->src;
  8.2057 +        Uint32 *dst = (Uint32 *)info->dst;
  8.2058 +        int n = info->dst_w;
  8.2059 +        while (n--) {
  8.2060 +            pixel = *src;
  8.2061 +            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
  8.2062 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.2063 +                R = (R * modulateR) / 255;
  8.2064 +                G = (G * modulateG) / 255;
  8.2065 +                B = (B * modulateB) / 255;
  8.2066 +            }
  8.2067 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.2068 +                A = (A * modulateA) / 255;
  8.2069 +            }
  8.2070 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  8.2071 +            *dst = pixel;
  8.2072 +            ++src;
  8.2073 +            ++dst;
  8.2074 +        }
  8.2075 +        info->src += info->src_pitch;
  8.2076 +        info->dst += info->dst_pitch;
  8.2077 +    }
  8.2078 +}
  8.2079 +
  8.2080 +void SDL_Blit_ARGB8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
  8.2081 +{
  8.2082 +    const int flags = info->flags;
  8.2083 +    const Uint32 modulateR = info->r;
  8.2084 +    const Uint32 modulateG = info->g;
  8.2085 +    const Uint32 modulateB = info->b;
  8.2086 +    const Uint32 modulateA = info->a;
  8.2087 +    Uint32 pixel;
  8.2088 +    Uint32 R, G, B, A;
  8.2089 +    int srcy, srcx;
  8.2090 +    int posy, posx;
  8.2091 +    int incy, incx;
  8.2092 +
  8.2093 +    srcy = 0;
  8.2094 +    posy = 0;
  8.2095 +    incy = (info->src_h << 16) / info->dst_h;
  8.2096 +    incx = (info->src_w << 16) / info->dst_w;
  8.2097 +
  8.2098 +    while (info->dst_h--) {
  8.2099 +        Uint32 *src;
  8.2100 +        Uint32 *dst = (Uint32 *)info->dst;
  8.2101 +        int n = info->dst_w;
  8.2102 +        srcx = -1;
  8.2103 +        posx = 0x10000L;
  8.2104 +        while (posy >= 0x10000L) {
  8.2105 +            ++srcy;
  8.2106 +            posy -= 0x10000L;
  8.2107 +        }
  8.2108 +        while (n--) {
  8.2109 +            if (posx >= 0x10000L) {
  8.2110 +                while (posx >= 0x10000L) {
  8.2111 +                    ++srcx;
  8.2112 +                    posx -= 0x10000L;
  8.2113 +                }
  8.2114 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.2115 +            }
  8.2116 +            pixel = *src;
  8.2117 +            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
  8.2118 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.2119 +                R = (R * modulateR) / 255;
  8.2120 +                G = (G * modulateG) / 255;
  8.2121 +                B = (B * modulateB) / 255;
  8.2122 +            }
  8.2123 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.2124 +                A = (A * modulateA) / 255;
  8.2125 +            }
  8.2126 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  8.2127 +            *dst = pixel;
  8.2128 +            posx += incx;
  8.2129 +            ++dst;
  8.2130 +        }
  8.2131 +        posy += incy;
  8.2132 +        info->dst += info->dst_pitch;
  8.2133 +    }
  8.2134 +}
  8.2135 +
  8.2136 +void SDL_Blit_ARGB8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
  8.2137 +{
  8.2138 +    const int flags = info->flags;
  8.2139 +    const Uint32 modulateR = info->r;
  8.2140 +    const Uint32 modulateG = info->g;
  8.2141 +    const Uint32 modulateB = info->b;
  8.2142 +    const Uint32 modulateA = info->a;
  8.2143 +    Uint32 srcpixel;
  8.2144 +    Uint32 srcR, srcG, srcB, srcA;
  8.2145 +    Uint32 dstpixel;
  8.2146 +    Uint32 dstR, dstG, dstB, dstA;
  8.2147 +
  8.2148 +    while (info->dst_h--) {
  8.2149 +        Uint32 *src = (Uint32 *)info->src;
  8.2150 +        Uint32 *dst = (Uint32 *)info->dst;
  8.2151 +        int n = info->dst_w;
  8.2152 +        while (n--) {
  8.2153 +            srcpixel = *src;
  8.2154 +            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
  8.2155 +            dstpixel = *dst;
  8.2156 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.2157 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.2158 +                srcR = (srcR * modulateR) / 255;
  8.2159 +                srcG = (srcG * modulateG) / 255;
  8.2160 +                srcB = (srcB * modulateB) / 255;
  8.2161 +            }
  8.2162 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.2163 +                srcA = (srcA * modulateA) / 255;
  8.2164 +            }
  8.2165 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.2166 +                /* This goes away if we ever use premultiplied alpha */
  8.2167 +                if (srcA < 255) {
  8.2168 +                    srcR = (srcR * srcA) / 255;
  8.2169 +                    srcG = (srcG * srcA) / 255;
  8.2170 +                    srcB = (srcB * srcA) / 255;
  8.2171 +                }
  8.2172 +            }
  8.2173 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.2174 +            case SDL_COPY_MASK:
  8.2175 +                if (srcA) {
  8.2176 +                    dstR = srcR;
  8.2177 +                    dstG = srcG;
  8.2178 +                    dstB = srcB;
  8.2179 +                }
  8.2180 +                break;
  8.2181 +            case SDL_COPY_BLEND:
  8.2182 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.2183 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.2184 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.2185 +                break;
  8.2186 +            case SDL_COPY_ADD:
  8.2187 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.2188 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.2189 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.2190 +                break;
  8.2191 +            case SDL_COPY_MOD:
  8.2192 +                dstR = (srcR * dstR) / 255;
  8.2193 +                dstG = (srcG * dstG) / 255;
  8.2194 +                dstB = (srcB * dstB) / 255;
  8.2195 +                break;
  8.2196 +            }
  8.2197 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.2198 +            *dst = dstpixel;
  8.2199 +            ++src;
  8.2200 +            ++dst;
  8.2201 +        }
  8.2202 +        info->src += info->src_pitch;
  8.2203 +        info->dst += info->dst_pitch;
  8.2204 +    }
  8.2205 +}
  8.2206 +
  8.2207 +void SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  8.2208 +{
  8.2209 +    const int flags = info->flags;
  8.2210 +    const Uint32 modulateR = info->r;
  8.2211 +    const Uint32 modulateG = info->g;
  8.2212 +    const Uint32 modulateB = info->b;
  8.2213 +    const Uint32 modulateA = info->a;
  8.2214 +    Uint32 srcpixel;
  8.2215 +    Uint32 srcR, srcG, srcB, srcA;
  8.2216 +    Uint32 dstpixel;
  8.2217 +    Uint32 dstR, dstG, dstB, dstA;
  8.2218 +    int srcy, srcx;
  8.2219 +    int posy, posx;
  8.2220 +    int incy, incx;
  8.2221 +
  8.2222 +    srcy = 0;
  8.2223 +    posy = 0;
  8.2224 +    incy = (info->src_h << 16) / info->dst_h;
  8.2225 +    incx = (info->src_w << 16) / info->dst_w;
  8.2226 +
  8.2227 +    while (info->dst_h--) {
  8.2228 +        Uint32 *src;
  8.2229 +        Uint32 *dst = (Uint32 *)info->dst;
  8.2230 +        int n = info->dst_w;
  8.2231 +        srcx = -1;
  8.2232 +        posx = 0x10000L;
  8.2233 +        while (posy >= 0x10000L) {
  8.2234 +            ++srcy;
  8.2235 +            posy -= 0x10000L;
  8.2236 +        }
  8.2237 +        while (n--) {
  8.2238 +            if (posx >= 0x10000L) {
  8.2239 +                while (posx >= 0x10000L) {
  8.2240 +                    ++srcx;
  8.2241 +                    posx -= 0x10000L;
  8.2242 +                }
  8.2243 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.2244 +            }
  8.2245 +            srcpixel = *src;
  8.2246 +            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
  8.2247 +            dstpixel = *dst;
  8.2248 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.2249 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.2250 +                srcR = (srcR * modulateR) / 255;
  8.2251 +                srcG = (srcG * modulateG) / 255;
  8.2252 +                srcB = (srcB * modulateB) / 255;
  8.2253 +            }
  8.2254 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.2255 +                srcA = (srcA * modulateA) / 255;
  8.2256 +            }
  8.2257 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.2258 +                /* This goes away if we ever use premultiplied alpha */
  8.2259 +                if (srcA < 255) {
  8.2260 +                    srcR = (srcR * srcA) / 255;
  8.2261 +                    srcG = (srcG * srcA) / 255;
  8.2262 +                    srcB = (srcB * srcA) / 255;
  8.2263 +                }
  8.2264 +            }
  8.2265 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.2266 +            case SDL_COPY_MASK:
  8.2267 +                if (srcA) {
  8.2268 +                    dstR = srcR;
  8.2269 +                    dstG = srcG;
  8.2270 +                    dstB = srcB;
  8.2271 +                }
  8.2272 +                break;
  8.2273 +            case SDL_COPY_BLEND:
  8.2274 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.2275 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.2276 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.2277 +                break;
  8.2278 +            case SDL_COPY_ADD:
  8.2279 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.2280 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.2281 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.2282 +                break;
  8.2283 +            case SDL_COPY_MOD:
  8.2284 +                dstR = (srcR * dstR) / 255;
  8.2285 +                dstG = (srcG * dstG) / 255;
  8.2286 +                dstB = (srcB * dstB) / 255;
  8.2287 +                break;
  8.2288 +            }
  8.2289 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.2290 +            *dst = dstpixel;
  8.2291 +            posx += incx;
  8.2292 +            ++dst;
  8.2293 +        }
  8.2294 +        posy += incy;
  8.2295 +        info->dst += info->dst_pitch;
  8.2296 +    }
  8.2297 +}
  8.2298 +
  8.2299 +void SDL_Blit_ARGB8888_BGR888_Scale(SDL_BlitInfo *info)
  8.2300 +{
  8.2301 +    const int flags = info->flags;
  8.2302 +    Uint32 pixel;
  8.2303 +    Uint32 R, G, B, A;
  8.2304 +    int srcy, srcx;
  8.2305 +    int posy, posx;
  8.2306 +    int incy, incx;
  8.2307 +
  8.2308 +    srcy = 0;
  8.2309 +    posy = 0;
  8.2310 +    incy = (info->src_h << 16) / info->dst_h;
  8.2311 +    incx = (info->src_w << 16) / info->dst_w;
  8.2312 +
  8.2313 +    while (info->dst_h--) {
  8.2314 +        Uint32 *src;
  8.2315 +        Uint32 *dst = (Uint32 *)info->dst;
  8.2316 +        int n = info->dst_w;
  8.2317 +        srcx = -1;
  8.2318 +        posx = 0x10000L;
  8.2319 +        while (posy >= 0x10000L) {
  8.2320 +            ++srcy;
  8.2321 +            posy -= 0x10000L;
  8.2322 +        }
  8.2323 +        while (n--) {
  8.2324 +            if (posx >= 0x10000L) {
  8.2325 +                while (posx >= 0x10000L) {
  8.2326 +                    ++srcx;
  8.2327 +                    posx -= 0x10000L;
  8.2328 +                }
  8.2329 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.2330 +            }
  8.2331 +            pixel = *src;
  8.2332 +            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
  8.2333 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  8.2334 +            *dst = pixel;
  8.2335 +            posx += incx;
  8.2336 +            ++dst;
  8.2337 +        }
  8.2338 +        posy += incy;
  8.2339 +        info->dst += info->dst_pitch;
  8.2340 +    }
  8.2341 +}
  8.2342 +
  8.2343 +void SDL_Blit_ARGB8888_BGR888_Blend(SDL_BlitInfo *info)
  8.2344 +{
  8.2345 +    const int flags = info->flags;
  8.2346 +    Uint32 srcpixel;
  8.2347 +    Uint32 srcR, srcG, srcB, srcA;
  8.2348 +    Uint32 dstpixel;
  8.2349 +    Uint32 dstR, dstG, dstB, dstA;
  8.2350 +
  8.2351 +    while (info->dst_h--) {
  8.2352 +        Uint32 *src = (Uint32 *)info->src;
  8.2353 +        Uint32 *dst = (Uint32 *)info->dst;
  8.2354 +        int n = info->dst_w;
  8.2355 +        while (n--) {
  8.2356 +            srcpixel = *src;
  8.2357 +            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
  8.2358 +            dstpixel = *dst;
  8.2359 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.2360 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.2361 +                /* This goes away if we ever use premultiplied alpha */
  8.2362 +                if (srcA < 255) {
  8.2363 +                    srcR = (srcR * srcA) / 255;
  8.2364 +                    srcG = (srcG * srcA) / 255;
  8.2365 +                    srcB = (srcB * srcA) / 255;
  8.2366 +                }
  8.2367 +            }
  8.2368 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.2369 +            case SDL_COPY_MASK:
  8.2370 +                if (srcA) {
  8.2371 +                    dstR = srcR;
  8.2372 +                    dstG = srcG;
  8.2373 +                    dstB = srcB;
  8.2374 +                }
  8.2375 +                break;
  8.2376 +            case SDL_COPY_BLEND:
  8.2377 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.2378 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.2379 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.2380 +                break;
  8.2381 +            case SDL_COPY_ADD:
  8.2382 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.2383 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.2384 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.2385 +                break;
  8.2386 +            case SDL_COPY_MOD:
  8.2387 +                dstR = (srcR * dstR) / 255;
  8.2388 +                dstG = (srcG * dstG) / 255;
  8.2389 +                dstB = (srcB * dstB) / 255;
  8.2390 +                break;
  8.2391 +            }
  8.2392 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.2393 +            *dst = dstpixel;
  8.2394 +            ++src;
  8.2395 +            ++dst;
  8.2396 +        }
  8.2397 +        info->src += info->src_pitch;
  8.2398 +        info->dst += info->dst_pitch;
  8.2399 +    }
  8.2400 +}
  8.2401 +
  8.2402 +void SDL_Blit_ARGB8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
  8.2403 +{
  8.2404 +    const int flags = info->flags;
  8.2405 +    Uint32 srcpixel;
  8.2406 +    Uint32 srcR, srcG, srcB, srcA;
  8.2407 +    Uint32 dstpixel;
  8.2408 +    Uint32 dstR, dstG, dstB, dstA;
  8.2409 +    int srcy, srcx;
  8.2410 +    int posy, posx;
  8.2411 +    int incy, incx;
  8.2412 +
  8.2413 +    srcy = 0;
  8.2414 +    posy = 0;
  8.2415 +    incy = (info->src_h << 16) / info->dst_h;
  8.2416 +    incx = (info->src_w << 16) / info->dst_w;
  8.2417 +
  8.2418 +    while (info->dst_h--) {
  8.2419 +        Uint32 *src;
  8.2420 +        Uint32 *dst = (Uint32 *)info->dst;
  8.2421 +        int n = info->dst_w;
  8.2422 +        srcx = -1;
  8.2423 +        posx = 0x10000L;
  8.2424 +        while (posy >= 0x10000L) {
  8.2425 +            ++srcy;
  8.2426 +            posy -= 0x10000L;
  8.2427 +        }
  8.2428 +        while (n--) {
  8.2429 +            if (posx >= 0x10000L) {
  8.2430 +                while (posx >= 0x10000L) {
  8.2431 +                    ++srcx;
  8.2432 +                    posx -= 0x10000L;
  8.2433 +                }
  8.2434 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.2435 +            }
  8.2436 +            srcpixel = *src;
  8.2437 +            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
  8.2438 +            dstpixel = *dst;
  8.2439 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.2440 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.2441 +                /* This goes away if we ever use premultiplied alpha */
  8.2442 +                if (srcA < 255) {
  8.2443 +                    srcR = (srcR * srcA) / 255;
  8.2444 +                    srcG = (srcG * srcA) / 255;
  8.2445 +                    srcB = (srcB * srcA) / 255;
  8.2446 +                }
  8.2447 +            }
  8.2448 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.2449 +            case SDL_COPY_MASK:
  8.2450 +                if (srcA) {
  8.2451 +                    dstR = srcR;
  8.2452 +                    dstG = srcG;
  8.2453 +                    dstB = srcB;
  8.2454 +                }
  8.2455 +                break;
  8.2456 +            case SDL_COPY_BLEND:
  8.2457 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.2458 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.2459 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.2460 +                break;
  8.2461 +            case SDL_COPY_ADD:
  8.2462 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.2463 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.2464 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.2465 +                break;
  8.2466 +            case SDL_COPY_MOD:
  8.2467 +                dstR = (srcR * dstR) / 255;
  8.2468 +                dstG = (srcG * dstG) / 255;
  8.2469 +                dstB = (srcB * dstB) / 255;
  8.2470 +                break;
  8.2471 +            }
  8.2472 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.2473 +            *dst = dstpixel;
  8.2474 +            posx += incx;
  8.2475 +            ++dst;
  8.2476 +        }
  8.2477 +        posy += incy;
  8.2478 +        info->dst += info->dst_pitch;
  8.2479 +    }
  8.2480 +}
  8.2481 +
  8.2482 +void SDL_Blit_ARGB8888_BGR888_Modulate(SDL_BlitInfo *info)
  8.2483 +{
  8.2484 +    const int flags = info->flags;
  8.2485 +    const Uint32 modulateR = info->r;
  8.2486 +    const Uint32 modulateG = info->g;
  8.2487 +    const Uint32 modulateB = info->b;
  8.2488 +    const Uint32 modulateA = info->a;
  8.2489 +    Uint32 pixel;
  8.2490 +    Uint32 R, G, B, A;
  8.2491 +
  8.2492 +    while (info->dst_h--) {
  8.2493 +        Uint32 *src = (Uint32 *)info->src;
  8.2494 +        Uint32 *dst = (Uint32 *)info->dst;
  8.2495 +        int n = info->dst_w;
  8.2496 +        while (n--) {
  8.2497 +            pixel = *src;
  8.2498 +            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
  8.2499 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.2500 +                R = (R * modulateR) / 255;
  8.2501 +                G = (G * modulateG) / 255;
  8.2502 +                B = (B * modulateB) / 255;
  8.2503 +            }
  8.2504 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.2505 +                A = (A * modulateA) / 255;
  8.2506 +            }
  8.2507 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  8.2508 +            *dst = pixel;
  8.2509 +            ++src;
  8.2510 +            ++dst;
  8.2511 +        }
  8.2512 +        info->src += info->src_pitch;
  8.2513 +        info->dst += info->dst_pitch;
  8.2514 +    }
  8.2515 +}
  8.2516 +
  8.2517 +void SDL_Blit_ARGB8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
  8.2518 +{
  8.2519 +    const int flags = info->flags;
  8.2520 +    const Uint32 modulateR = info->r;
  8.2521 +    const Uint32 modulateG = info->g;
  8.2522 +    const Uint32 modulateB = info->b;
  8.2523 +    const Uint32 modulateA = info->a;
  8.2524 +    Uint32 pixel;
  8.2525 +    Uint32 R, G, B, A;
  8.2526 +    int srcy, srcx;
  8.2527 +    int posy, posx;
  8.2528 +    int incy, incx;
  8.2529 +
  8.2530 +    srcy = 0;
  8.2531 +    posy = 0;
  8.2532 +    incy = (info->src_h << 16) / info->dst_h;
  8.2533 +    incx = (info->src_w << 16) / info->dst_w;
  8.2534 +
  8.2535 +    while (info->dst_h--) {
  8.2536 +        Uint32 *src;
  8.2537 +        Uint32 *dst = (Uint32 *)info->dst;
  8.2538 +        int n = info->dst_w;
  8.2539 +        srcx = -1;
  8.2540 +        posx = 0x10000L;
  8.2541 +        while (posy >= 0x10000L) {
  8.2542 +            ++srcy;
  8.2543 +            posy -= 0x10000L;
  8.2544 +        }
  8.2545 +        while (n--) {
  8.2546 +            if (posx >= 0x10000L) {
  8.2547 +                while (posx >= 0x10000L) {
  8.2548 +                    ++srcx;
  8.2549 +                    posx -= 0x10000L;
  8.2550 +                }
  8.2551 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.2552 +            }
  8.2553 +            pixel = *src;
  8.2554 +            A = (Uint8)(pixel >> 24); R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel;
  8.2555 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.2556 +                R = (R * modulateR) / 255;
  8.2557 +                G = (G * modulateG) / 255;
  8.2558 +                B = (B * modulateB) / 255;
  8.2559 +            }
  8.2560 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.2561 +                A = (A * modulateA) / 255;
  8.2562 +            }
  8.2563 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  8.2564 +            *dst = pixel;
  8.2565 +            posx += incx;
  8.2566 +            ++dst;
  8.2567 +        }
  8.2568 +        posy += incy;
  8.2569 +        info->dst += info->dst_pitch;
  8.2570 +    }
  8.2571 +}
  8.2572 +
  8.2573 +void SDL_Blit_ARGB8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
  8.2574 +{
  8.2575 +    const int flags = info->flags;
  8.2576 +    const Uint32 modulateR = info->r;
  8.2577 +    const Uint32 modulateG = info->g;
  8.2578 +    const Uint32 modulateB = info->b;
  8.2579 +    const Uint32 modulateA = info->a;
  8.2580 +    Uint32 srcpixel;
  8.2581 +    Uint32 srcR, srcG, srcB, srcA;
  8.2582 +    Uint32 dstpixel;
  8.2583 +    Uint32 dstR, dstG, dstB, dstA;
  8.2584 +
  8.2585 +    while (info->dst_h--) {
  8.2586 +        Uint32 *src = (Uint32 *)info->src;
  8.2587 +        Uint32 *dst = (Uint32 *)info->dst;
  8.2588 +        int n = info->dst_w;
  8.2589 +        while (n--) {
  8.2590 +            srcpixel = *src;
  8.2591 +            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
  8.2592 +            dstpixel = *dst;
  8.2593 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.2594 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.2595 +                srcR = (srcR * modulateR) / 255;
  8.2596 +                srcG = (srcG * modulateG) / 255;
  8.2597 +                srcB = (srcB * modulateB) / 255;
  8.2598 +            }
  8.2599 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.2600 +                srcA = (srcA * modulateA) / 255;
  8.2601 +            }
  8.2602 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.2603 +                /* This goes away if we ever use premultiplied alpha */
  8.2604 +                if (srcA < 255) {
  8.2605 +                    srcR = (srcR * srcA) / 255;
  8.2606 +                    srcG = (srcG * srcA) / 255;
  8.2607 +                    srcB = (srcB * srcA) / 255;
  8.2608 +                }
  8.2609 +            }
  8.2610 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.2611 +            case SDL_COPY_MASK:
  8.2612 +                if (srcA) {
  8.2613 +                    dstR = srcR;
  8.2614 +                    dstG = srcG;
  8.2615 +                    dstB = srcB;
  8.2616 +                }
  8.2617 +                break;
  8.2618 +            case SDL_COPY_BLEND:
  8.2619 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.2620 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.2621 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.2622 +                break;
  8.2623 +            case SDL_COPY_ADD:
  8.2624 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.2625 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.2626 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.2627 +                break;
  8.2628 +            case SDL_COPY_MOD:
  8.2629 +                dstR = (srcR * dstR) / 255;
  8.2630 +                dstG = (srcG * dstG) / 255;
  8.2631 +                dstB = (srcB * dstB) / 255;
  8.2632 +                break;
  8.2633 +            }
  8.2634 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.2635 +            *dst = dstpixel;
  8.2636 +            ++src;
  8.2637 +            ++dst;
  8.2638 +        }
  8.2639 +        info->src += info->src_pitch;
  8.2640 +        info->dst += info->dst_pitch;
  8.2641 +    }
  8.2642 +}
  8.2643 +
  8.2644 +void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  8.2645 +{
  8.2646 +    const int flags = info->flags;
  8.2647 +    const Uint32 modulateR = info->r;
  8.2648 +    const Uint32 modulateG = info->g;
  8.2649 +    const Uint32 modulateB = info->b;
  8.2650 +    const Uint32 modulateA = info->a;
  8.2651 +    Uint32 srcpixel;
  8.2652 +    Uint32 srcR, srcG, srcB, srcA;
  8.2653 +    Uint32 dstpixel;
  8.2654 +    Uint32 dstR, dstG, dstB, dstA;
  8.2655 +    int srcy, srcx;
  8.2656 +    int posy, posx;
  8.2657 +    int incy, incx;
  8.2658 +
  8.2659 +    srcy = 0;
  8.2660 +    posy = 0;
  8.2661 +    incy = (info->src_h << 16) / info->dst_h;
  8.2662 +    incx = (info->src_w << 16) / info->dst_w;
  8.2663 +
  8.2664 +    while (info->dst_h--) {
  8.2665 +        Uint32 *src;
  8.2666 +        Uint32 *dst = (Uint32 *)info->dst;
  8.2667 +        int n = info->dst_w;
  8.2668 +        srcx = -1;
  8.2669 +        posx = 0x10000L;
  8.2670 +        while (posy >= 0x10000L) {
  8.2671 +            ++srcy;
  8.2672 +            posy -= 0x10000L;
  8.2673 +        }
  8.2674 +        while (n--) {
  8.2675 +            if (posx >= 0x10000L) {
  8.2676 +                while (posx >= 0x10000L) {
  8.2677 +                    ++srcx;
  8.2678 +                    posx -= 0x10000L;
  8.2679 +                }
  8.2680 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.2681 +            }
  8.2682 +            srcpixel = *src;
  8.2683 +            srcA = (Uint8)(srcpixel >> 24); srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel;
  8.2684 +            dstpixel = *dst;
  8.2685 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.2686 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.2687 +                srcR = (srcR * modulateR) / 255;
  8.2688 +                srcG = (srcG * modulateG) / 255;
  8.2689 +                srcB = (srcB * modulateB) / 255;
  8.2690 +            }
  8.2691 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.2692 +                srcA = (srcA * modulateA) / 255;
  8.2693 +            }
  8.2694 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.2695 +                /* This goes away if we ever use premultiplied alpha */
  8.2696 +                if (srcA < 255) {
  8.2697 +                    srcR = (srcR * srcA) / 255;
  8.2698 +                    srcG = (srcG * srcA) / 255;
  8.2699 +                    srcB = (srcB * srcA) / 255;
  8.2700 +                }
  8.2701 +            }
  8.2702 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.2703 +            case SDL_COPY_MASK:
  8.2704 +                if (srcA) {
  8.2705 +                    dstR = srcR;
  8.2706 +                    dstG = srcG;
  8.2707 +                    dstB = srcB;
  8.2708 +                }
  8.2709 +                break;
  8.2710 +            case SDL_COPY_BLEND:
  8.2711 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.2712 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.2713 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.2714 +                break;
  8.2715 +            case SDL_COPY_ADD:
  8.2716 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.2717 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.2718 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.2719 +                break;
  8.2720 +            case SDL_COPY_MOD:
  8.2721 +                dstR = (srcR * dstR) / 255;
  8.2722 +                dstG = (srcG * dstG) / 255;
  8.2723 +                dstB = (srcB * dstB) / 255;
  8.2724 +                break;
  8.2725 +            }
  8.2726 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.2727 +            *dst = dstpixel;
  8.2728 +            posx += incx;
  8.2729 +            ++dst;
  8.2730 +        }
  8.2731 +        posy += incy;
  8.2732 +        info->dst += info->dst_pitch;
  8.2733 +    }
  8.2734 +}
  8.2735 +
  8.2736 +void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info)
  8.2737 +{
  8.2738 +    const int flags = info->flags;
  8.2739 +    Uint32 pixel;
  8.2740 +    Uint32 R, G, B, A;
  8.2741 +    int srcy, srcx;
  8.2742 +    int posy, posx;
  8.2743 +    int incy, incx;
  8.2744 +
  8.2745 +    srcy = 0;
  8.2746 +    posy = 0;
  8.2747 +    incy = (info->src_h << 16) / info->dst_h;
  8.2748 +    incx = (info->src_w << 16) / info->dst_w;
  8.2749 +
  8.2750 +    while (info->dst_h--) {
  8.2751 +        Uint32 *src;
  8.2752 +        Uint32 *dst = (Uint32 *)info->dst;
  8.2753 +        int n = info->dst_w;
  8.2754 +        srcx = -1;
  8.2755 +        posx = 0x10000L;
  8.2756 +        while (posy >= 0x10000L) {
  8.2757 +            ++srcy;
  8.2758 +            posy -= 0x10000L;
  8.2759 +        }
  8.2760 +        while (n--) {
  8.2761 +            if (posx >= 0x10000L) {
  8.2762 +                while (posx >= 0x10000L) {
  8.2763 +                    ++srcx;
  8.2764 +                    posx -= 0x10000L;
  8.2765 +                }
  8.2766 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.2767 +            }
  8.2768 +            pixel = *src;
  8.2769 +            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  8.2770 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  8.2771 +            *dst = pixel;
  8.2772 +            posx += incx;
  8.2773 +            ++dst;
  8.2774 +        }
  8.2775 +        posy += incy;
  8.2776 +        info->dst += info->dst_pitch;
  8.2777 +    }
  8.2778 +}
  8.2779 +
  8.2780 +void SDL_Blit_RGBA8888_RGB888_Blend(SDL_BlitInfo *info)
  8.2781 +{
  8.2782 +    const int flags = info->flags;
  8.2783 +    Uint32 srcpixel;
  8.2784 +    Uint32 srcR, srcG, srcB, srcA;
  8.2785 +    Uint32 dstpixel;
  8.2786 +    Uint32 dstR, dstG, dstB, dstA;
  8.2787 +
  8.2788 +    while (info->dst_h--) {
  8.2789 +        Uint32 *src = (Uint32 *)info->src;
  8.2790 +        Uint32 *dst = (Uint32 *)info->dst;
  8.2791 +        int n = info->dst_w;
  8.2792 +        while (n--) {
  8.2793 +            srcpixel = *src;
  8.2794 +            srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  8.2795 +            dstpixel = *dst;
  8.2796 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.2797 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.2798 +                /* This goes away if we ever use premultiplied alpha */
  8.2799 +                if (srcA < 255) {
  8.2800 +                    srcR = (srcR * srcA) / 255;
  8.2801 +                    srcG = (srcG * srcA) / 255;
  8.2802 +                    srcB = (srcB * srcA) / 255;
  8.2803 +                }
  8.2804 +            }
  8.2805 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.2806 +            case SDL_COPY_MASK:
  8.2807 +                if (srcA) {
  8.2808 +                    dstR = srcR;
  8.2809 +                    dstG = srcG;
  8.2810 +                    dstB = srcB;
  8.2811 +                }
  8.2812 +                break;
  8.2813 +            case SDL_COPY_BLEND:
  8.2814 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.2815 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.2816 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.2817 +                break;
  8.2818 +            case SDL_COPY_ADD:
  8.2819 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.2820 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.2821 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.2822 +                break;
  8.2823 +            case SDL_COPY_MOD:
  8.2824 +                dstR = (srcR * dstR) / 255;
  8.2825 +                dstG = (srcG * dstG) / 255;
  8.2826 +                dstB = (srcB * dstB) / 255;
  8.2827 +                break;
  8.2828 +            }
  8.2829 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.2830 +            *dst = dstpixel;
  8.2831 +            ++src;
  8.2832 +            ++dst;
  8.2833 +        }
  8.2834 +        info->src += info->src_pitch;
  8.2835 +        info->dst += info->dst_pitch;
  8.2836 +    }
  8.2837 +}
  8.2838 +
  8.2839 +void SDL_Blit_RGBA8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
  8.2840 +{
  8.2841 +    const int flags = info->flags;
  8.2842 +    Uint32 srcpixel;
  8.2843 +    Uint32 srcR, srcG, srcB, srcA;
  8.2844 +    Uint32 dstpixel;
  8.2845 +    Uint32 dstR, dstG, dstB, dstA;
  8.2846 +    int srcy, srcx;
  8.2847 +    int posy, posx;
  8.2848 +    int incy, incx;
  8.2849 +
  8.2850 +    srcy = 0;
  8.2851 +    posy = 0;
  8.2852 +    incy = (info->src_h << 16) / info->dst_h;
  8.2853 +    incx = (info->src_w << 16) / info->dst_w;
  8.2854 +
  8.2855 +    while (info->dst_h--) {
  8.2856 +        Uint32 *src;
  8.2857 +        Uint32 *dst = (Uint32 *)info->dst;
  8.2858 +        int n = info->dst_w;
  8.2859 +        srcx = -1;
  8.2860 +        posx = 0x10000L;
  8.2861 +        while (posy >= 0x10000L) {
  8.2862 +            ++srcy;
  8.2863 +            posy -= 0x10000L;
  8.2864 +        }
  8.2865 +        while (n--) {
  8.2866 +            if (posx >= 0x10000L) {
  8.2867 +                while (posx >= 0x10000L) {
  8.2868 +                    ++srcx;
  8.2869 +                    posx -= 0x10000L;
  8.2870 +                }
  8.2871 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.2872 +            }
  8.2873 +            srcpixel = *src;
  8.2874 +            srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  8.2875 +            dstpixel = *dst;
  8.2876 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.2877 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.2878 +                /* This goes away if we ever use premultiplied alpha */
  8.2879 +                if (srcA < 255) {
  8.2880 +                    srcR = (srcR * srcA) / 255;
  8.2881 +                    srcG = (srcG * srcA) / 255;
  8.2882 +                    srcB = (srcB * srcA) / 255;
  8.2883 +                }
  8.2884 +            }
  8.2885 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.2886 +            case SDL_COPY_MASK:
  8.2887 +                if (srcA) {
  8.2888 +                    dstR = srcR;
  8.2889 +                    dstG = srcG;
  8.2890 +                    dstB = srcB;
  8.2891 +                }
  8.2892 +                break;
  8.2893 +            case SDL_COPY_BLEND:
  8.2894 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.2895 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.2896 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.2897 +                break;
  8.2898 +            case SDL_COPY_ADD:
  8.2899 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.2900 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.2901 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.2902 +                break;
  8.2903 +            case SDL_COPY_MOD:
  8.2904 +                dstR = (srcR * dstR) / 255;
  8.2905 +                dstG = (srcG * dstG) / 255;
  8.2906 +                dstB = (srcB * dstB) / 255;
  8.2907 +                break;
  8.2908 +            }
  8.2909 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.2910 +            *dst = dstpixel;
  8.2911 +            posx += incx;
  8.2912 +            ++dst;
  8.2913 +        }
  8.2914 +        posy += incy;
  8.2915 +        info->dst += info->dst_pitch;
  8.2916 +    }
  8.2917 +}
  8.2918 +
  8.2919 +void SDL_Blit_RGBA8888_RGB888_Modulate(SDL_BlitInfo *info)
  8.2920 +{
  8.2921 +    const int flags = info->flags;
  8.2922 +    const Uint32 modulateR = info->r;
  8.2923 +    const Uint32 modulateG = info->g;
  8.2924 +    const Uint32 modulateB = info->b;
  8.2925 +    const Uint32 modulateA = info->a;
  8.2926 +    Uint32 pixel;
  8.2927 +    Uint32 R, G, B, A;
  8.2928 +
  8.2929 +    while (info->dst_h--) {
  8.2930 +        Uint32 *src = (Uint32 *)info->src;
  8.2931 +        Uint32 *dst = (Uint32 *)info->dst;
  8.2932 +        int n = info->dst_w;
  8.2933 +        while (n--) {
  8.2934 +            pixel = *src;
  8.2935 +            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  8.2936 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.2937 +                R = (R * modulateR) / 255;
  8.2938 +                G = (G * modulateG) / 255;
  8.2939 +                B = (B * modulateB) / 255;
  8.2940 +            }
  8.2941 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.2942 +                A = (A * modulateA) / 255;
  8.2943 +            }
  8.2944 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  8.2945 +            *dst = pixel;
  8.2946 +            ++src;
  8.2947 +            ++dst;
  8.2948 +        }
  8.2949 +        info->src += info->src_pitch;
  8.2950 +        info->dst += info->dst_pitch;
  8.2951 +    }
  8.2952 +}
  8.2953 +
  8.2954 +void SDL_Blit_RGBA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
  8.2955 +{
  8.2956 +    const int flags = info->flags;
  8.2957 +    const Uint32 modulateR = info->r;
  8.2958 +    const Uint32 modulateG = info->g;
  8.2959 +    const Uint32 modulateB = info->b;
  8.2960 +    const Uint32 modulateA = info->a;
  8.2961 +    Uint32 pixel;
  8.2962 +    Uint32 R, G, B, A;
  8.2963 +    int srcy, srcx;
  8.2964 +    int posy, posx;
  8.2965 +    int incy, incx;
  8.2966 +
  8.2967 +    srcy = 0;
  8.2968 +    posy = 0;
  8.2969 +    incy = (info->src_h << 16) / info->dst_h;
  8.2970 +    incx = (info->src_w << 16) / info->dst_w;
  8.2971 +
  8.2972 +    while (info->dst_h--) {
  8.2973 +        Uint32 *src;
  8.2974 +        Uint32 *dst = (Uint32 *)info->dst;
  8.2975 +        int n = info->dst_w;
  8.2976 +        srcx = -1;
  8.2977 +        posx = 0x10000L;
  8.2978 +        while (posy >= 0x10000L) {
  8.2979 +            ++srcy;
  8.2980 +            posy -= 0x10000L;
  8.2981 +        }
  8.2982 +        while (n--) {
  8.2983 +            if (posx >= 0x10000L) {
  8.2984 +                while (posx >= 0x10000L) {
  8.2985 +                    ++srcx;
  8.2986 +                    posx -= 0x10000L;
  8.2987 +                }
  8.2988 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.2989 +            }
  8.2990 +            pixel = *src;
  8.2991 +            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  8.2992 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.2993 +                R = (R * modulateR) / 255;
  8.2994 +                G = (G * modulateG) / 255;
  8.2995 +                B = (B * modulateB) / 255;
  8.2996 +            }
  8.2997 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.2998 +                A = (A * modulateA) / 255;
  8.2999 +            }
  8.3000 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  8.3001 +            *dst = pixel;
  8.3002 +            posx += incx;
  8.3003 +            ++dst;
  8.3004 +        }
  8.3005 +        posy += incy;
  8.3006 +        info->dst += info->dst_pitch;
  8.3007 +    }
  8.3008 +}
  8.3009 +
  8.3010 +void SDL_Blit_RGBA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
  8.3011 +{
  8.3012 +    const int flags = info->flags;
  8.3013 +    const Uint32 modulateR = info->r;
  8.3014 +    const Uint32 modulateG = info->g;
  8.3015 +    const Uint32 modulateB = info->b;
  8.3016 +    const Uint32 modulateA = info->a;
  8.3017 +    Uint32 srcpixel;
  8.3018 +    Uint32 srcR, srcG, srcB, srcA;
  8.3019 +    Uint32 dstpixel;
  8.3020 +    Uint32 dstR, dstG, dstB, dstA;
  8.3021 +
  8.3022 +    while (info->dst_h--) {
  8.3023 +        Uint32 *src = (Uint32 *)info->src;
  8.3024 +        Uint32 *dst = (Uint32 *)info->dst;
  8.3025 +        int n = info->dst_w;
  8.3026 +        while (n--) {
  8.3027 +            srcpixel = *src;
  8.3028 +            srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  8.3029 +            dstpixel = *dst;
  8.3030 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.3031 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.3032 +                srcR = (srcR * modulateR) / 255;
  8.3033 +                srcG = (srcG * modulateG) / 255;
  8.3034 +                srcB = (srcB * modulateB) / 255;
  8.3035 +            }
  8.3036 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.3037 +                srcA = (srcA * modulateA) / 255;
  8.3038 +            }
  8.3039 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.3040 +                /* This goes away if we ever use premultiplied alpha */
  8.3041 +                if (srcA < 255) {
  8.3042 +                    srcR = (srcR * srcA) / 255;
  8.3043 +                    srcG = (srcG * srcA) / 255;
  8.3044 +                    srcB = (srcB * srcA) / 255;
  8.3045 +                }
  8.3046 +            }
  8.3047 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.3048 +            case SDL_COPY_MASK:
  8.3049 +                if (srcA) {
  8.3050 +                    dstR = srcR;
  8.3051 +                    dstG = srcG;
  8.3052 +                    dstB = srcB;
  8.3053 +                }
  8.3054 +                break;
  8.3055 +            case SDL_COPY_BLEND:
  8.3056 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.3057 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.3058 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.3059 +                break;
  8.3060 +            case SDL_COPY_ADD:
  8.3061 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.3062 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.3063 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.3064 +                break;
  8.3065 +            case SDL_COPY_MOD:
  8.3066 +                dstR = (srcR * dstR) / 255;
  8.3067 +                dstG = (srcG * dstG) / 255;
  8.3068 +                dstB = (srcB * dstB) / 255;
  8.3069 +                break;
  8.3070 +            }
  8.3071 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.3072 +            *dst = dstpixel;
  8.3073 +            ++src;
  8.3074 +            ++dst;
  8.3075 +        }
  8.3076 +        info->src += info->src_pitch;
  8.3077 +        info->dst += info->dst_pitch;
  8.3078 +    }
  8.3079 +}
  8.3080 +
  8.3081 +void SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  8.3082 +{
  8.3083 +    const int flags = info->flags;
  8.3084 +    const Uint32 modulateR = info->r;
  8.3085 +    const Uint32 modulateG = info->g;
  8.3086 +    const Uint32 modulateB = info->b;
  8.3087 +    const Uint32 modulateA = info->a;
  8.3088 +    Uint32 srcpixel;
  8.3089 +    Uint32 srcR, srcG, srcB, srcA;
  8.3090 +    Uint32 dstpixel;
  8.3091 +    Uint32 dstR, dstG, dstB, dstA;
  8.3092 +    int srcy, srcx;
  8.3093 +    int posy, posx;
  8.3094 +    int incy, incx;
  8.3095 +
  8.3096 +    srcy = 0;
  8.3097 +    posy = 0;
  8.3098 +    incy = (info->src_h << 16) / info->dst_h;
  8.3099 +    incx = (info->src_w << 16) / info->dst_w;
  8.3100 +
  8.3101 +    while (info->dst_h--) {
  8.3102 +        Uint32 *src;
  8.3103 +        Uint32 *dst = (Uint32 *)info->dst;
  8.3104 +        int n = info->dst_w;
  8.3105 +        srcx = -1;
  8.3106 +        posx = 0x10000L;
  8.3107 +        while (posy >= 0x10000L) {
  8.3108 +            ++srcy;
  8.3109 +            posy -= 0x10000L;
  8.3110 +        }
  8.3111 +        while (n--) {
  8.3112 +            if (posx >= 0x10000L) {
  8.3113 +                while (posx >= 0x10000L) {
  8.3114 +                    ++srcx;
  8.3115 +                    posx -= 0x10000L;
  8.3116 +                }
  8.3117 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.3118 +            }
  8.3119 +            srcpixel = *src;
  8.3120 +            srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  8.3121 +            dstpixel = *dst;
  8.3122 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.3123 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.3124 +                srcR = (srcR * modulateR) / 255;
  8.3125 +                srcG = (srcG * modulateG) / 255;
  8.3126 +                srcB = (srcB * modulateB) / 255;
  8.3127 +            }
  8.3128 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.3129 +                srcA = (srcA * modulateA) / 255;
  8.3130 +            }
  8.3131 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.3132 +                /* This goes away if we ever use premultiplied alpha */
  8.3133 +                if (srcA < 255) {
  8.3134 +                    srcR = (srcR * srcA) / 255;
  8.3135 +                    srcG = (srcG * srcA) / 255;
  8.3136 +                    srcB = (srcB * srcA) / 255;
  8.3137 +                }
  8.3138 +            }
  8.3139 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.3140 +            case SDL_COPY_MASK:
  8.3141 +                if (srcA) {
  8.3142 +                    dstR = srcR;
  8.3143 +                    dstG = srcG;
  8.3144 +                    dstB = srcB;
  8.3145 +                }
  8.3146 +                break;
  8.3147 +            case SDL_COPY_BLEND:
  8.3148 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.3149 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.3150 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.3151 +                break;
  8.3152 +            case SDL_COPY_ADD:
  8.3153 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.3154 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.3155 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.3156 +                break;
  8.3157 +            case SDL_COPY_MOD:
  8.3158 +                dstR = (srcR * dstR) / 255;
  8.3159 +                dstG = (srcG * dstG) / 255;
  8.3160 +                dstB = (srcB * dstB) / 255;
  8.3161 +                break;
  8.3162 +            }
  8.3163 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.3164 +            *dst = dstpixel;
  8.3165 +            posx += incx;
  8.3166 +            ++dst;
  8.3167 +        }
  8.3168 +        posy += incy;
  8.3169 +        info->dst += info->dst_pitch;
  8.3170 +    }
  8.3171 +}
  8.3172 +
  8.3173 +void SDL_Blit_RGBA8888_BGR888_Scale(SDL_BlitInfo *info)
  8.3174 +{
  8.3175 +    const int flags = info->flags;
  8.3176 +    Uint32 pixel;
  8.3177 +    Uint32 R, G, B, A;
  8.3178 +    int srcy, srcx;
  8.3179 +    int posy, posx;
  8.3180 +    int incy, incx;
  8.3181 +
  8.3182 +    srcy = 0;
  8.3183 +    posy = 0;
  8.3184 +    incy = (info->src_h << 16) / info->dst_h;
  8.3185 +    incx = (info->src_w << 16) / info->dst_w;
  8.3186 +
  8.3187 +    while (info->dst_h--) {
  8.3188 +        Uint32 *src;
  8.3189 +        Uint32 *dst = (Uint32 *)info->dst;
  8.3190 +        int n = info->dst_w;
  8.3191 +        srcx = -1;
  8.3192 +        posx = 0x10000L;
  8.3193 +        while (posy >= 0x10000L) {
  8.3194 +            ++srcy;
  8.3195 +            posy -= 0x10000L;
  8.3196 +        }
  8.3197 +        while (n--) {
  8.3198 +            if (posx >= 0x10000L) {
  8.3199 +                while (posx >= 0x10000L) {
  8.3200 +                    ++srcx;
  8.3201 +                    posx -= 0x10000L;
  8.3202 +                }
  8.3203 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.3204 +            }
  8.3205 +            pixel = *src;
  8.3206 +            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  8.3207 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  8.3208 +            *dst = pixel;
  8.3209 +            posx += incx;
  8.3210 +            ++dst;
  8.3211 +        }
  8.3212 +        posy += incy;
  8.3213 +        info->dst += info->dst_pitch;
  8.3214 +    }
  8.3215 +}
  8.3216 +
  8.3217 +void SDL_Blit_RGBA8888_BGR888_Blend(SDL_BlitInfo *info)
  8.3218 +{
  8.3219 +    const int flags = info->flags;
  8.3220 +    Uint32 srcpixel;
  8.3221 +    Uint32 srcR, srcG, srcB, srcA;
  8.3222 +    Uint32 dstpixel;
  8.3223 +    Uint32 dstR, dstG, dstB, dstA;
  8.3224 +
  8.3225 +    while (info->dst_h--) {
  8.3226 +        Uint32 *src = (Uint32 *)info->src;
  8.3227 +        Uint32 *dst = (Uint32 *)info->dst;
  8.3228 +        int n = info->dst_w;
  8.3229 +        while (n--) {
  8.3230 +            srcpixel = *src;
  8.3231 +            srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  8.3232 +            dstpixel = *dst;
  8.3233 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.3234 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.3235 +                /* This goes away if we ever use premultiplied alpha */
  8.3236 +                if (srcA < 255) {
  8.3237 +                    srcR = (srcR * srcA) / 255;
  8.3238 +                    srcG = (srcG * srcA) / 255;
  8.3239 +                    srcB = (srcB * srcA) / 255;
  8.3240 +                }
  8.3241 +            }
  8.3242 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.3243 +            case SDL_COPY_MASK:
  8.3244 +                if (srcA) {
  8.3245 +                    dstR = srcR;
  8.3246 +                    dstG = srcG;
  8.3247 +                    dstB = srcB;
  8.3248 +                }
  8.3249 +                break;
  8.3250 +            case SDL_COPY_BLEND:
  8.3251 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.3252 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.3253 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.3254 +                break;
  8.3255 +            case SDL_COPY_ADD:
  8.3256 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.3257 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.3258 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.3259 +                break;
  8.3260 +            case SDL_COPY_MOD:
  8.3261 +                dstR = (srcR * dstR) / 255;
  8.3262 +                dstG = (srcG * dstG) / 255;
  8.3263 +                dstB = (srcB * dstB) / 255;
  8.3264 +                break;
  8.3265 +            }
  8.3266 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.3267 +            *dst = dstpixel;
  8.3268 +            ++src;
  8.3269 +            ++dst;
  8.3270 +        }
  8.3271 +        info->src += info->src_pitch;
  8.3272 +        info->dst += info->dst_pitch;
  8.3273 +    }
  8.3274 +}
  8.3275 +
  8.3276 +void SDL_Blit_RGBA8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
  8.3277 +{
  8.3278 +    const int flags = info->flags;
  8.3279 +    Uint32 srcpixel;
  8.3280 +    Uint32 srcR, srcG, srcB, srcA;
  8.3281 +    Uint32 dstpixel;
  8.3282 +    Uint32 dstR, dstG, dstB, dstA;
  8.3283 +    int srcy, srcx;
  8.3284 +    int posy, posx;
  8.3285 +    int incy, incx;
  8.3286 +
  8.3287 +    srcy = 0;
  8.3288 +    posy = 0;
  8.3289 +    incy = (info->src_h << 16) / info->dst_h;
  8.3290 +    incx = (info->src_w << 16) / info->dst_w;
  8.3291 +
  8.3292 +    while (info->dst_h--) {
  8.3293 +        Uint32 *src;
  8.3294 +        Uint32 *dst = (Uint32 *)info->dst;
  8.3295 +        int n = info->dst_w;
  8.3296 +        srcx = -1;
  8.3297 +        posx = 0x10000L;
  8.3298 +        while (posy >= 0x10000L) {
  8.3299 +            ++srcy;
  8.3300 +            posy -= 0x10000L;
  8.3301 +        }
  8.3302 +        while (n--) {
  8.3303 +            if (posx >= 0x10000L) {
  8.3304 +                while (posx >= 0x10000L) {
  8.3305 +                    ++srcx;
  8.3306 +                    posx -= 0x10000L;
  8.3307 +                }
  8.3308 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.3309 +            }
  8.3310 +            srcpixel = *src;
  8.3311 +            srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  8.3312 +            dstpixel = *dst;
  8.3313 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.3314 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.3315 +                /* This goes away if we ever use premultiplied alpha */
  8.3316 +                if (srcA < 255) {
  8.3317 +                    srcR = (srcR * srcA) / 255;
  8.3318 +                    srcG = (srcG * srcA) / 255;
  8.3319 +                    srcB = (srcB * srcA) / 255;
  8.3320 +                }
  8.3321 +            }
  8.3322 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.3323 +            case SDL_COPY_MASK:
  8.3324 +                if (srcA) {
  8.3325 +                    dstR = srcR;
  8.3326 +                    dstG = srcG;
  8.3327 +                    dstB = srcB;
  8.3328 +                }
  8.3329 +                break;
  8.3330 +            case SDL_COPY_BLEND:
  8.3331 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.3332 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.3333 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.3334 +                break;
  8.3335 +            case SDL_COPY_ADD:
  8.3336 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.3337 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.3338 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.3339 +                break;
  8.3340 +            case SDL_COPY_MOD:
  8.3341 +                dstR = (srcR * dstR) / 255;
  8.3342 +                dstG = (srcG * dstG) / 255;
  8.3343 +                dstB = (srcB * dstB) / 255;
  8.3344 +                break;
  8.3345 +            }
  8.3346 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.3347 +            *dst = dstpixel;
  8.3348 +            posx += incx;
  8.3349 +            ++dst;
  8.3350 +        }
  8.3351 +        posy += incy;
  8.3352 +        info->dst += info->dst_pitch;
  8.3353 +    }
  8.3354 +}
  8.3355 +
  8.3356 +void SDL_Blit_RGBA8888_BGR888_Modulate(SDL_BlitInfo *info)
  8.3357 +{
  8.3358 +    const int flags = info->flags;
  8.3359 +    const Uint32 modulateR = info->r;
  8.3360 +    const Uint32 modulateG = info->g;
  8.3361 +    const Uint32 modulateB = info->b;
  8.3362 +    const Uint32 modulateA = info->a;
  8.3363 +    Uint32 pixel;
  8.3364 +    Uint32 R, G, B, A;
  8.3365 +
  8.3366 +    while (info->dst_h--) {
  8.3367 +        Uint32 *src = (Uint32 *)info->src;
  8.3368 +        Uint32 *dst = (Uint32 *)info->dst;
  8.3369 +        int n = info->dst_w;
  8.3370 +        while (n--) {
  8.3371 +            pixel = *src;
  8.3372 +            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  8.3373 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.3374 +                R = (R * modulateR) / 255;
  8.3375 +                G = (G * modulateG) / 255;
  8.3376 +                B = (B * modulateB) / 255;
  8.3377 +            }
  8.3378 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.3379 +                A = (A * modulateA) / 255;
  8.3380 +            }
  8.3381 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  8.3382 +            *dst = pixel;
  8.3383 +            ++src;
  8.3384 +            ++dst;
  8.3385 +        }
  8.3386 +        info->src += info->src_pitch;
  8.3387 +        info->dst += info->dst_pitch;
  8.3388 +    }
  8.3389 +}
  8.3390 +
  8.3391 +void SDL_Blit_RGBA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
  8.3392 +{
  8.3393 +    const int flags = info->flags;
  8.3394 +    const Uint32 modulateR = info->r;
  8.3395 +    const Uint32 modulateG = info->g;
  8.3396 +    const Uint32 modulateB = info->b;
  8.3397 +    const Uint32 modulateA = info->a;
  8.3398 +    Uint32 pixel;
  8.3399 +    Uint32 R, G, B, A;
  8.3400 +    int srcy, srcx;
  8.3401 +    int posy, posx;
  8.3402 +    int incy, incx;
  8.3403 +
  8.3404 +    srcy = 0;
  8.3405 +    posy = 0;
  8.3406 +    incy = (info->src_h << 16) / info->dst_h;
  8.3407 +    incx = (info->src_w << 16) / info->dst_w;
  8.3408 +
  8.3409 +    while (info->dst_h--) {
  8.3410 +        Uint32 *src;
  8.3411 +        Uint32 *dst = (Uint32 *)info->dst;
  8.3412 +        int n = info->dst_w;
  8.3413 +        srcx = -1;
  8.3414 +        posx = 0x10000L;
  8.3415 +        while (posy >= 0x10000L) {
  8.3416 +            ++srcy;
  8.3417 +            posy -= 0x10000L;
  8.3418 +        }
  8.3419 +        while (n--) {
  8.3420 +            if (posx >= 0x10000L) {
  8.3421 +                while (posx >= 0x10000L) {
  8.3422 +                    ++srcx;
  8.3423 +                    posx -= 0x10000L;
  8.3424 +                }
  8.3425 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.3426 +            }
  8.3427 +            pixel = *src;
  8.3428 +            R = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); B = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  8.3429 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.3430 +                R = (R * modulateR) / 255;
  8.3431 +                G = (G * modulateG) / 255;
  8.3432 +                B = (B * modulateB) / 255;
  8.3433 +            }
  8.3434 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.3435 +                A = (A * modulateA) / 255;
  8.3436 +            }
  8.3437 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  8.3438 +            *dst = pixel;
  8.3439 +            posx += incx;
  8.3440 +            ++dst;
  8.3441 +        }
  8.3442 +        posy += incy;
  8.3443 +        info->dst += info->dst_pitch;
  8.3444 +    }
  8.3445 +}
  8.3446 +
  8.3447 +void SDL_Blit_RGBA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
  8.3448 +{
  8.3449 +    const int flags = info->flags;
  8.3450 +    const Uint32 modulateR = info->r;
  8.3451 +    const Uint32 modulateG = info->g;
  8.3452 +    const Uint32 modulateB = info->b;
  8.3453 +    const Uint32 modulateA = info->a;
  8.3454 +    Uint32 srcpixel;
  8.3455 +    Uint32 srcR, srcG, srcB, srcA;
  8.3456 +    Uint32 dstpixel;
  8.3457 +    Uint32 dstR, dstG, dstB, dstA;
  8.3458 +
  8.3459 +    while (info->dst_h--) {
  8.3460 +        Uint32 *src = (Uint32 *)info->src;
  8.3461 +        Uint32 *dst = (Uint32 *)info->dst;
  8.3462 +        int n = info->dst_w;
  8.3463 +        while (n--) {
  8.3464 +            srcpixel = *src;
  8.3465 +            srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  8.3466 +            dstpixel = *dst;
  8.3467 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.3468 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.3469 +                srcR = (srcR * modulateR) / 255;
  8.3470 +                srcG = (srcG * modulateG) / 255;
  8.3471 +                srcB = (srcB * modulateB) / 255;
  8.3472 +            }
  8.3473 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.3474 +                srcA = (srcA * modulateA) / 255;
  8.3475 +            }
  8.3476 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.3477 +                /* This goes away if we ever use premultiplied alpha */
  8.3478 +                if (srcA < 255) {
  8.3479 +                    srcR = (srcR * srcA) / 255;
  8.3480 +                    srcG = (srcG * srcA) / 255;
  8.3481 +                    srcB = (srcB * srcA) / 255;
  8.3482 +                }
  8.3483 +            }
  8.3484 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.3485 +            case SDL_COPY_MASK:
  8.3486 +                if (srcA) {
  8.3487 +                    dstR = srcR;
  8.3488 +                    dstG = srcG;
  8.3489 +                    dstB = srcB;
  8.3490 +                }
  8.3491 +                break;
  8.3492 +            case SDL_COPY_BLEND:
  8.3493 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.3494 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.3495 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.3496 +                break;
  8.3497 +            case SDL_COPY_ADD:
  8.3498 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.3499 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.3500 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.3501 +                break;
  8.3502 +            case SDL_COPY_MOD:
  8.3503 +                dstR = (srcR * dstR) / 255;
  8.3504 +                dstG = (srcG * dstG) / 255;
  8.3505 +                dstB = (srcB * dstB) / 255;
  8.3506 +                break;
  8.3507 +            }
  8.3508 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.3509 +            *dst = dstpixel;
  8.3510 +            ++src;
  8.3511 +            ++dst;
  8.3512 +        }
  8.3513 +        info->src += info->src_pitch;
  8.3514 +        info->dst += info->dst_pitch;
  8.3515 +    }
  8.3516 +}
  8.3517 +
  8.3518 +void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  8.3519 +{
  8.3520 +    const int flags = info->flags;
  8.3521 +    const Uint32 modulateR = info->r;
  8.3522 +    const Uint32 modulateG = info->g;
  8.3523 +    const Uint32 modulateB = info->b;
  8.3524 +    const Uint32 modulateA = info->a;
  8.3525 +    Uint32 srcpixel;
  8.3526 +    Uint32 srcR, srcG, srcB, srcA;
  8.3527 +    Uint32 dstpixel;
  8.3528 +    Uint32 dstR, dstG, dstB, dstA;
  8.3529 +    int srcy, srcx;
  8.3530 +    int posy, posx;
  8.3531 +    int incy, incx;
  8.3532 +
  8.3533 +    srcy = 0;
  8.3534 +    posy = 0;
  8.3535 +    incy = (info->src_h << 16) / info->dst_h;
  8.3536 +    incx = (info->src_w << 16) / info->dst_w;
  8.3537 +
  8.3538 +    while (info->dst_h--) {
  8.3539 +        Uint32 *src;
  8.3540 +        Uint32 *dst = (Uint32 *)info->dst;
  8.3541 +        int n = info->dst_w;
  8.3542 +        srcx = -1;
  8.3543 +        posx = 0x10000L;
  8.3544 +        while (posy >= 0x10000L) {
  8.3545 +            ++srcy;
  8.3546 +            posy -= 0x10000L;
  8.3547 +        }
  8.3548 +        while (n--) {
  8.3549 +            if (posx >= 0x10000L) {
  8.3550 +                while (posx >= 0x10000L) {
  8.3551 +                    ++srcx;
  8.3552 +                    posx -= 0x10000L;
  8.3553 +                }
  8.3554 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.3555 +            }
  8.3556 +            srcpixel = *src;
  8.3557 +            srcR = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcB = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  8.3558 +            dstpixel = *dst;
  8.3559 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.3560 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.3561 +                srcR = (srcR * modulateR) / 255;
  8.3562 +                srcG = (srcG * modulateG) / 255;
  8.3563 +                srcB = (srcB * modulateB) / 255;
  8.3564 +            }
  8.3565 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.3566 +                srcA = (srcA * modulateA) / 255;
  8.3567 +            }
  8.3568 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.3569 +                /* This goes away if we ever use premultiplied alpha */
  8.3570 +                if (srcA < 255) {
  8.3571 +                    srcR = (srcR * srcA) / 255;
  8.3572 +                    srcG = (srcG * srcA) / 255;
  8.3573 +                    srcB = (srcB * srcA) / 255;
  8.3574 +                }
  8.3575 +            }
  8.3576 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.3577 +            case SDL_COPY_MASK:
  8.3578 +                if (srcA) {
  8.3579 +                    dstR = srcR;
  8.3580 +                    dstG = srcG;
  8.3581 +                    dstB = srcB;
  8.3582 +                }
  8.3583 +                break;
  8.3584 +            case SDL_COPY_BLEND:
  8.3585 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.3586 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.3587 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.3588 +                break;
  8.3589 +            case SDL_COPY_ADD:
  8.3590 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.3591 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.3592 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.3593 +                break;
  8.3594 +            case SDL_COPY_MOD:
  8.3595 +                dstR = (srcR * dstR) / 255;
  8.3596 +                dstG = (srcG * dstG) / 255;
  8.3597 +                dstB = (srcB * dstB) / 255;
  8.3598 +                break;
  8.3599 +            }
  8.3600 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.3601 +            *dst = dstpixel;
  8.3602 +            posx += incx;
  8.3603 +            ++dst;
  8.3604 +        }
  8.3605 +        posy += incy;
  8.3606 +        info->dst += info->dst_pitch;
  8.3607 +    }
  8.3608 +}
  8.3609 +
  8.3610 +void SDL_Blit_ABGR8888_RGB888_Scale(SDL_BlitInfo *info)
  8.3611 +{
  8.3612 +    const int flags = info->flags;
  8.3613 +    Uint32 pixel;
  8.3614 +    Uint32 R, G, B, A;
  8.3615 +    int srcy, srcx;
  8.3616 +    int posy, posx;
  8.3617 +    int incy, incx;
  8.3618 +
  8.3619 +    srcy = 0;
  8.3620 +    posy = 0;
  8.3621 +    incy = (info->src_h << 16) / info->dst_h;
  8.3622 +    incx = (info->src_w << 16) / info->dst_w;
  8.3623 +
  8.3624 +    while (info->dst_h--) {
  8.3625 +        Uint32 *src;
  8.3626 +        Uint32 *dst = (Uint32 *)info->dst;
  8.3627 +        int n = info->dst_w;
  8.3628 +        srcx = -1;
  8.3629 +        posx = 0x10000L;
  8.3630 +        while (posy >= 0x10000L) {
  8.3631 +            ++srcy;
  8.3632 +            posy -= 0x10000L;
  8.3633 +        }
  8.3634 +        while (n--) {
  8.3635 +            if (posx >= 0x10000L) {
  8.3636 +                while (posx >= 0x10000L) {
  8.3637 +                    ++srcx;
  8.3638 +                    posx -= 0x10000L;
  8.3639 +                }
  8.3640 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.3641 +            }
  8.3642 +            pixel = *src;
  8.3643 +            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
  8.3644 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  8.3645 +            *dst = pixel;
  8.3646 +            posx += incx;
  8.3647 +            ++dst;
  8.3648 +        }
  8.3649 +        posy += incy;
  8.3650 +        info->dst += info->dst_pitch;
  8.3651 +    }
  8.3652 +}
  8.3653 +
  8.3654 +void SDL_Blit_ABGR8888_RGB888_Blend(SDL_BlitInfo *info)
  8.3655 +{
  8.3656 +    const int flags = info->flags;
  8.3657 +    Uint32 srcpixel;
  8.3658 +    Uint32 srcR, srcG, srcB, srcA;
  8.3659 +    Uint32 dstpixel;
  8.3660 +    Uint32 dstR, dstG, dstB, dstA;
  8.3661 +
  8.3662 +    while (info->dst_h--) {
  8.3663 +        Uint32 *src = (Uint32 *)info->src;
  8.3664 +        Uint32 *dst = (Uint32 *)info->dst;
  8.3665 +        int n = info->dst_w;
  8.3666 +        while (n--) {
  8.3667 +            srcpixel = *src;
  8.3668 +            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
  8.3669 +            dstpixel = *dst;
  8.3670 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.3671 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.3672 +                /* This goes away if we ever use premultiplied alpha */
  8.3673 +                if (srcA < 255) {
  8.3674 +                    srcR = (srcR * srcA) / 255;
  8.3675 +                    srcG = (srcG * srcA) / 255;
  8.3676 +                    srcB = (srcB * srcA) / 255;
  8.3677 +                }
  8.3678 +            }
  8.3679 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.3680 +            case SDL_COPY_MASK:
  8.3681 +                if (srcA) {
  8.3682 +                    dstR = srcR;
  8.3683 +                    dstG = srcG;
  8.3684 +                    dstB = srcB;
  8.3685 +                }
  8.3686 +                break;
  8.3687 +            case SDL_COPY_BLEND:
  8.3688 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.3689 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.3690 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.3691 +                break;
  8.3692 +            case SDL_COPY_ADD:
  8.3693 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.3694 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.3695 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.3696 +                break;
  8.3697 +            case SDL_COPY_MOD:
  8.3698 +                dstR = (srcR * dstR) / 255;
  8.3699 +                dstG = (srcG * dstG) / 255;
  8.3700 +                dstB = (srcB * dstB) / 255;
  8.3701 +                break;
  8.3702 +            }
  8.3703 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.3704 +            *dst = dstpixel;
  8.3705 +            ++src;
  8.3706 +            ++dst;
  8.3707 +        }
  8.3708 +        info->src += info->src_pitch;
  8.3709 +        info->dst += info->dst_pitch;
  8.3710 +    }
  8.3711 +}
  8.3712 +
  8.3713 +void SDL_Blit_ABGR8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
  8.3714 +{
  8.3715 +    const int flags = info->flags;
  8.3716 +    Uint32 srcpixel;
  8.3717 +    Uint32 srcR, srcG, srcB, srcA;
  8.3718 +    Uint32 dstpixel;
  8.3719 +    Uint32 dstR, dstG, dstB, dstA;
  8.3720 +    int srcy, srcx;
  8.3721 +    int posy, posx;
  8.3722 +    int incy, incx;
  8.3723 +
  8.3724 +    srcy = 0;
  8.3725 +    posy = 0;
  8.3726 +    incy = (info->src_h << 16) / info->dst_h;
  8.3727 +    incx = (info->src_w << 16) / info->dst_w;
  8.3728 +
  8.3729 +    while (info->dst_h--) {
  8.3730 +        Uint32 *src;
  8.3731 +        Uint32 *dst = (Uint32 *)info->dst;
  8.3732 +        int n = info->dst_w;
  8.3733 +        srcx = -1;
  8.3734 +        posx = 0x10000L;
  8.3735 +        while (posy >= 0x10000L) {
  8.3736 +            ++srcy;
  8.3737 +            posy -= 0x10000L;
  8.3738 +        }
  8.3739 +        while (n--) {
  8.3740 +            if (posx >= 0x10000L) {
  8.3741 +                while (posx >= 0x10000L) {
  8.3742 +                    ++srcx;
  8.3743 +                    posx -= 0x10000L;
  8.3744 +                }
  8.3745 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.3746 +            }
  8.3747 +            srcpixel = *src;
  8.3748 +            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
  8.3749 +            dstpixel = *dst;
  8.3750 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.3751 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.3752 +                /* This goes away if we ever use premultiplied alpha */
  8.3753 +                if (srcA < 255) {
  8.3754 +                    srcR = (srcR * srcA) / 255;
  8.3755 +                    srcG = (srcG * srcA) / 255;
  8.3756 +                    srcB = (srcB * srcA) / 255;
  8.3757 +                }
  8.3758 +            }
  8.3759 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.3760 +            case SDL_COPY_MASK:
  8.3761 +                if (srcA) {
  8.3762 +                    dstR = srcR;
  8.3763 +                    dstG = srcG;
  8.3764 +                    dstB = srcB;
  8.3765 +                }
  8.3766 +                break;
  8.3767 +            case SDL_COPY_BLEND:
  8.3768 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.3769 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.3770 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.3771 +                break;
  8.3772 +            case SDL_COPY_ADD:
  8.3773 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.3774 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.3775 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.3776 +                break;
  8.3777 +            case SDL_COPY_MOD:
  8.3778 +                dstR = (srcR * dstR) / 255;
  8.3779 +                dstG = (srcG * dstG) / 255;
  8.3780 +                dstB = (srcB * dstB) / 255;
  8.3781 +                break;
  8.3782 +            }
  8.3783 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.3784 +            *dst = dstpixel;
  8.3785 +            posx += incx;
  8.3786 +            ++dst;
  8.3787 +        }
  8.3788 +        posy += incy;
  8.3789 +        info->dst += info->dst_pitch;
  8.3790 +    }
  8.3791 +}
  8.3792 +
  8.3793 +void SDL_Blit_ABGR8888_RGB888_Modulate(SDL_BlitInfo *info)
  8.3794 +{
  8.3795 +    const int flags = info->flags;
  8.3796 +    const Uint32 modulateR = info->r;
  8.3797 +    const Uint32 modulateG = info->g;
  8.3798 +    const Uint32 modulateB = info->b;
  8.3799 +    const Uint32 modulateA = info->a;
  8.3800 +    Uint32 pixel;
  8.3801 +    Uint32 R, G, B, A;
  8.3802 +
  8.3803 +    while (info->dst_h--) {
  8.3804 +        Uint32 *src = (Uint32 *)info->src;
  8.3805 +        Uint32 *dst = (Uint32 *)info->dst;
  8.3806 +        int n = info->dst_w;
  8.3807 +        while (n--) {
  8.3808 +            pixel = *src;
  8.3809 +            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
  8.3810 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.3811 +                R = (R * modulateR) / 255;
  8.3812 +                G = (G * modulateG) / 255;
  8.3813 +                B = (B * modulateB) / 255;
  8.3814 +            }
  8.3815 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.3816 +                A = (A * modulateA) / 255;
  8.3817 +            }
  8.3818 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  8.3819 +            *dst = pixel;
  8.3820 +            ++src;
  8.3821 +            ++dst;
  8.3822 +        }
  8.3823 +        info->src += info->src_pitch;
  8.3824 +        info->dst += info->dst_pitch;
  8.3825 +    }
  8.3826 +}
  8.3827 +
  8.3828 +void SDL_Blit_ABGR8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
  8.3829 +{
  8.3830 +    const int flags = info->flags;
  8.3831 +    const Uint32 modulateR = info->r;
  8.3832 +    const Uint32 modulateG = info->g;
  8.3833 +    const Uint32 modulateB = info->b;
  8.3834 +    const Uint32 modulateA = info->a;
  8.3835 +    Uint32 pixel;
  8.3836 +    Uint32 R, G, B, A;
  8.3837 +    int srcy, srcx;
  8.3838 +    int posy, posx;
  8.3839 +    int incy, incx;
  8.3840 +
  8.3841 +    srcy = 0;
  8.3842 +    posy = 0;
  8.3843 +    incy = (info->src_h << 16) / info->dst_h;
  8.3844 +    incx = (info->src_w << 16) / info->dst_w;
  8.3845 +
  8.3846 +    while (info->dst_h--) {
  8.3847 +        Uint32 *src;
  8.3848 +        Uint32 *dst = (Uint32 *)info->dst;
  8.3849 +        int n = info->dst_w;
  8.3850 +        srcx = -1;
  8.3851 +        posx = 0x10000L;
  8.3852 +        while (posy >= 0x10000L) {
  8.3853 +            ++srcy;
  8.3854 +            posy -= 0x10000L;
  8.3855 +        }
  8.3856 +        while (n--) {
  8.3857 +            if (posx >= 0x10000L) {
  8.3858 +                while (posx >= 0x10000L) {
  8.3859 +                    ++srcx;
  8.3860 +                    posx -= 0x10000L;
  8.3861 +                }
  8.3862 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.3863 +            }
  8.3864 +            pixel = *src;
  8.3865 +            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
  8.3866 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.3867 +                R = (R * modulateR) / 255;
  8.3868 +                G = (G * modulateG) / 255;
  8.3869 +                B = (B * modulateB) / 255;
  8.3870 +            }
  8.3871 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.3872 +                A = (A * modulateA) / 255;
  8.3873 +            }
  8.3874 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  8.3875 +            *dst = pixel;
  8.3876 +            posx += incx;
  8.3877 +            ++dst;
  8.3878 +        }
  8.3879 +        posy += incy;
  8.3880 +        info->dst += info->dst_pitch;
  8.3881 +    }
  8.3882 +}
  8.3883 +
  8.3884 +void SDL_Blit_ABGR8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
  8.3885 +{
  8.3886 +    const int flags = info->flags;
  8.3887 +    const Uint32 modulateR = info->r;
  8.3888 +    const Uint32 modulateG = info->g;
  8.3889 +    const Uint32 modulateB = info->b;
  8.3890 +    const Uint32 modulateA = info->a;
  8.3891 +    Uint32 srcpixel;
  8.3892 +    Uint32 srcR, srcG, srcB, srcA;
  8.3893 +    Uint32 dstpixel;
  8.3894 +    Uint32 dstR, dstG, dstB, dstA;
  8.3895 +
  8.3896 +    while (info->dst_h--) {
  8.3897 +        Uint32 *src = (Uint32 *)info->src;
  8.3898 +        Uint32 *dst = (Uint32 *)info->dst;
  8.3899 +        int n = info->dst_w;
  8.3900 +        while (n--) {
  8.3901 +            srcpixel = *src;
  8.3902 +            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
  8.3903 +            dstpixel = *dst;
  8.3904 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.3905 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.3906 +                srcR = (srcR * modulateR) / 255;
  8.3907 +                srcG = (srcG * modulateG) / 255;
  8.3908 +                srcB = (srcB * modulateB) / 255;
  8.3909 +            }
  8.3910 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.3911 +                srcA = (srcA * modulateA) / 255;
  8.3912 +            }
  8.3913 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.3914 +                /* This goes away if we ever use premultiplied alpha */
  8.3915 +                if (srcA < 255) {
  8.3916 +                    srcR = (srcR * srcA) / 255;
  8.3917 +                    srcG = (srcG * srcA) / 255;
  8.3918 +                    srcB = (srcB * srcA) / 255;
  8.3919 +                }
  8.3920 +            }
  8.3921 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.3922 +            case SDL_COPY_MASK:
  8.3923 +                if (srcA) {
  8.3924 +                    dstR = srcR;
  8.3925 +                    dstG = srcG;
  8.3926 +                    dstB = srcB;
  8.3927 +                }
  8.3928 +                break;
  8.3929 +            case SDL_COPY_BLEND:
  8.3930 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.3931 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.3932 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.3933 +                break;
  8.3934 +            case SDL_COPY_ADD:
  8.3935 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.3936 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.3937 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.3938 +                break;
  8.3939 +            case SDL_COPY_MOD:
  8.3940 +                dstR = (srcR * dstR) / 255;
  8.3941 +                dstG = (srcG * dstG) / 255;
  8.3942 +                dstB = (srcB * dstB) / 255;
  8.3943 +                break;
  8.3944 +            }
  8.3945 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.3946 +            *dst = dstpixel;
  8.3947 +            ++src;
  8.3948 +            ++dst;
  8.3949 +        }
  8.3950 +        info->src += info->src_pitch;
  8.3951 +        info->dst += info->dst_pitch;
  8.3952 +    }
  8.3953 +}
  8.3954 +
  8.3955 +void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  8.3956 +{
  8.3957 +    const int flags = info->flags;
  8.3958 +    const Uint32 modulateR = info->r;
  8.3959 +    const Uint32 modulateG = info->g;
  8.3960 +    const Uint32 modulateB = info->b;
  8.3961 +    const Uint32 modulateA = info->a;
  8.3962 +    Uint32 srcpixel;
  8.3963 +    Uint32 srcR, srcG, srcB, srcA;
  8.3964 +    Uint32 dstpixel;
  8.3965 +    Uint32 dstR, dstG, dstB, dstA;
  8.3966 +    int srcy, srcx;
  8.3967 +    int posy, posx;
  8.3968 +    int incy, incx;
  8.3969 +
  8.3970 +    srcy = 0;
  8.3971 +    posy = 0;
  8.3972 +    incy = (info->src_h << 16) / info->dst_h;
  8.3973 +    incx = (info->src_w << 16) / info->dst_w;
  8.3974 +
  8.3975 +    while (info->dst_h--) {
  8.3976 +        Uint32 *src;
  8.3977 +        Uint32 *dst = (Uint32 *)info->dst;
  8.3978 +        int n = info->dst_w;
  8.3979 +        srcx = -1;
  8.3980 +        posx = 0x10000L;
  8.3981 +        while (posy >= 0x10000L) {
  8.3982 +            ++srcy;
  8.3983 +            posy -= 0x10000L;
  8.3984 +        }
  8.3985 +        while (n--) {
  8.3986 +            if (posx >= 0x10000L) {
  8.3987 +                while (posx >= 0x10000L) {
  8.3988 +                    ++srcx;
  8.3989 +                    posx -= 0x10000L;
  8.3990 +                }
  8.3991 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.3992 +            }
  8.3993 +            srcpixel = *src;
  8.3994 +            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
  8.3995 +            dstpixel = *dst;
  8.3996 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.3997 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.3998 +                srcR = (srcR * modulateR) / 255;
  8.3999 +                srcG = (srcG * modulateG) / 255;
  8.4000 +                srcB = (srcB * modulateB) / 255;
  8.4001 +            }
  8.4002 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.4003 +                srcA = (srcA * modulateA) / 255;
  8.4004 +            }
  8.4005 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.4006 +                /* This goes away if we ever use premultiplied alpha */
  8.4007 +                if (srcA < 255) {
  8.4008 +                    srcR = (srcR * srcA) / 255;
  8.4009 +                    srcG = (srcG * srcA) / 255;
  8.4010 +                    srcB = (srcB * srcA) / 255;
  8.4011 +                }
  8.4012 +            }
  8.4013 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.4014 +            case SDL_COPY_MASK:
  8.4015 +                if (srcA) {
  8.4016 +                    dstR = srcR;
  8.4017 +                    dstG = srcG;
  8.4018 +                    dstB = srcB;
  8.4019 +                }
  8.4020 +                break;
  8.4021 +            case SDL_COPY_BLEND:
  8.4022 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.4023 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.4024 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.4025 +                break;
  8.4026 +            case SDL_COPY_ADD:
  8.4027 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.4028 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.4029 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.4030 +                break;
  8.4031 +            case SDL_COPY_MOD:
  8.4032 +                dstR = (srcR * dstR) / 255;
  8.4033 +                dstG = (srcG * dstG) / 255;
  8.4034 +                dstB = (srcB * dstB) / 255;
  8.4035 +                break;
  8.4036 +            }
  8.4037 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.4038 +            *dst = dstpixel;
  8.4039 +            posx += incx;
  8.4040 +            ++dst;
  8.4041 +        }
  8.4042 +        posy += incy;
  8.4043 +        info->dst += info->dst_pitch;
  8.4044 +    }
  8.4045 +}
  8.4046 +
  8.4047 +void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info)
  8.4048 +{
  8.4049 +    const int flags = info->flags;
  8.4050 +    Uint32 pixel;
  8.4051 +    Uint32 R, G, B, A;
  8.4052 +    int srcy, srcx;
  8.4053 +    int posy, posx;
  8.4054 +    int incy, incx;
  8.4055 +
  8.4056 +    srcy = 0;
  8.4057 +    posy = 0;
  8.4058 +    incy = (info->src_h << 16) / info->dst_h;
  8.4059 +    incx = (info->src_w << 16) / info->dst_w;
  8.4060 +
  8.4061 +    while (info->dst_h--) {
  8.4062 +        Uint32 *src;
  8.4063 +        Uint32 *dst = (Uint32 *)info->dst;
  8.4064 +        int n = info->dst_w;
  8.4065 +        srcx = -1;
  8.4066 +        posx = 0x10000L;
  8.4067 +        while (posy >= 0x10000L) {
  8.4068 +            ++srcy;
  8.4069 +            posy -= 0x10000L;
  8.4070 +        }
  8.4071 +        while (n--) {
  8.4072 +            if (posx >= 0x10000L) {
  8.4073 +                while (posx >= 0x10000L) {
  8.4074 +                    ++srcx;
  8.4075 +                    posx -= 0x10000L;
  8.4076 +                }
  8.4077 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.4078 +            }
  8.4079 +            pixel = *src;
  8.4080 +            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
  8.4081 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  8.4082 +            *dst = pixel;
  8.4083 +            posx += incx;
  8.4084 +            ++dst;
  8.4085 +        }
  8.4086 +        posy += incy;
  8.4087 +        info->dst += info->dst_pitch;
  8.4088 +    }
  8.4089 +}
  8.4090 +
  8.4091 +void SDL_Blit_ABGR8888_BGR888_Blend(SDL_BlitInfo *info)
  8.4092 +{
  8.4093 +    const int flags = info->flags;
  8.4094 +    Uint32 srcpixel;
  8.4095 +    Uint32 srcR, srcG, srcB, srcA;
  8.4096 +    Uint32 dstpixel;
  8.4097 +    Uint32 dstR, dstG, dstB, dstA;
  8.4098 +
  8.4099 +    while (info->dst_h--) {
  8.4100 +        Uint32 *src = (Uint32 *)info->src;
  8.4101 +        Uint32 *dst = (Uint32 *)info->dst;
  8.4102 +        int n = info->dst_w;
  8.4103 +        while (n--) {
  8.4104 +            srcpixel = *src;
  8.4105 +            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
  8.4106 +            dstpixel = *dst;
  8.4107 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.4108 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.4109 +                /* This goes away if we ever use premultiplied alpha */
  8.4110 +                if (srcA < 255) {
  8.4111 +                    srcR = (srcR * srcA) / 255;
  8.4112 +                    srcG = (srcG * srcA) / 255;
  8.4113 +                    srcB = (srcB * srcA) / 255;
  8.4114 +                }
  8.4115 +            }
  8.4116 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.4117 +            case SDL_COPY_MASK:
  8.4118 +                if (srcA) {
  8.4119 +                    dstR = srcR;
  8.4120 +                    dstG = srcG;
  8.4121 +                    dstB = srcB;
  8.4122 +                }
  8.4123 +                break;
  8.4124 +            case SDL_COPY_BLEND:
  8.4125 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.4126 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.4127 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.4128 +                break;
  8.4129 +            case SDL_COPY_ADD:
  8.4130 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.4131 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.4132 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.4133 +                break;
  8.4134 +            case SDL_COPY_MOD:
  8.4135 +                dstR = (srcR * dstR) / 255;
  8.4136 +                dstG = (srcG * dstG) / 255;
  8.4137 +                dstB = (srcB * dstB) / 255;
  8.4138 +                break;
  8.4139 +            }
  8.4140 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.4141 +            *dst = dstpixel;
  8.4142 +            ++src;
  8.4143 +            ++dst;
  8.4144 +        }
  8.4145 +        info->src += info->src_pitch;
  8.4146 +        info->dst += info->dst_pitch;
  8.4147 +    }
  8.4148 +}
  8.4149 +
  8.4150 +void SDL_Blit_ABGR8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
  8.4151 +{
  8.4152 +    const int flags = info->flags;
  8.4153 +    Uint32 srcpixel;
  8.4154 +    Uint32 srcR, srcG, srcB, srcA;
  8.4155 +    Uint32 dstpixel;
  8.4156 +    Uint32 dstR, dstG, dstB, dstA;
  8.4157 +    int srcy, srcx;
  8.4158 +    int posy, posx;
  8.4159 +    int incy, incx;
  8.4160 +
  8.4161 +    srcy = 0;
  8.4162 +    posy = 0;
  8.4163 +    incy = (info->src_h << 16) / info->dst_h;
  8.4164 +    incx = (info->src_w << 16) / info->dst_w;
  8.4165 +
  8.4166 +    while (info->dst_h--) {
  8.4167 +        Uint32 *src;
  8.4168 +        Uint32 *dst = (Uint32 *)info->dst;
  8.4169 +        int n = info->dst_w;
  8.4170 +        srcx = -1;
  8.4171 +        posx = 0x10000L;
  8.4172 +        while (posy >= 0x10000L) {
  8.4173 +            ++srcy;
  8.4174 +            posy -= 0x10000L;
  8.4175 +        }
  8.4176 +        while (n--) {
  8.4177 +            if (posx >= 0x10000L) {
  8.4178 +                while (posx >= 0x10000L) {
  8.4179 +                    ++srcx;
  8.4180 +                    posx -= 0x10000L;
  8.4181 +                }
  8.4182 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.4183 +            }
  8.4184 +            srcpixel = *src;
  8.4185 +            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
  8.4186 +            dstpixel = *dst;
  8.4187 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.4188 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.4189 +                /* This goes away if we ever use premultiplied alpha */
  8.4190 +                if (srcA < 255) {
  8.4191 +                    srcR = (srcR * srcA) / 255;
  8.4192 +                    srcG = (srcG * srcA) / 255;
  8.4193 +                    srcB = (srcB * srcA) / 255;
  8.4194 +                }
  8.4195 +            }
  8.4196 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.4197 +            case SDL_COPY_MASK:
  8.4198 +                if (srcA) {
  8.4199 +                    dstR = srcR;
  8.4200 +                    dstG = srcG;
  8.4201 +                    dstB = srcB;
  8.4202 +                }
  8.4203 +                break;
  8.4204 +            case SDL_COPY_BLEND:
  8.4205 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.4206 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.4207 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.4208 +                break;
  8.4209 +            case SDL_COPY_ADD:
  8.4210 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.4211 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.4212 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.4213 +                break;
  8.4214 +            case SDL_COPY_MOD:
  8.4215 +                dstR = (srcR * dstR) / 255;
  8.4216 +                dstG = (srcG * dstG) / 255;
  8.4217 +                dstB = (srcB * dstB) / 255;
  8.4218 +                break;
  8.4219 +            }
  8.4220 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.4221 +            *dst = dstpixel;
  8.4222 +            posx += incx;
  8.4223 +            ++dst;
  8.4224 +        }
  8.4225 +        posy += incy;
  8.4226 +        info->dst += info->dst_pitch;
  8.4227 +    }
  8.4228 +}
  8.4229 +
  8.4230 +void SDL_Blit_ABGR8888_BGR888_Modulate(SDL_BlitInfo *info)
  8.4231 +{
  8.4232 +    const int flags = info->flags;
  8.4233 +    const Uint32 modulateR = info->r;
  8.4234 +    const Uint32 modulateG = info->g;
  8.4235 +    const Uint32 modulateB = info->b;
  8.4236 +    const Uint32 modulateA = info->a;
  8.4237 +    Uint32 pixel;
  8.4238 +    Uint32 R, G, B, A;
  8.4239 +
  8.4240 +    while (info->dst_h--) {
  8.4241 +        Uint32 *src = (Uint32 *)info->src;
  8.4242 +        Uint32 *dst = (Uint32 *)info->dst;
  8.4243 +        int n = info->dst_w;
  8.4244 +        while (n--) {
  8.4245 +            pixel = *src;
  8.4246 +            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
  8.4247 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.4248 +                R = (R * modulateR) / 255;
  8.4249 +                G = (G * modulateG) / 255;
  8.4250 +                B = (B * modulateB) / 255;
  8.4251 +            }
  8.4252 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.4253 +                A = (A * modulateA) / 255;
  8.4254 +            }
  8.4255 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  8.4256 +            *dst = pixel;
  8.4257 +            ++src;
  8.4258 +            ++dst;
  8.4259 +        }
  8.4260 +        info->src += info->src_pitch;
  8.4261 +        info->dst += info->dst_pitch;
  8.4262 +    }
  8.4263 +}
  8.4264 +
  8.4265 +void SDL_Blit_ABGR8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
  8.4266 +{
  8.4267 +    const int flags = info->flags;
  8.4268 +    const Uint32 modulateR = info->r;
  8.4269 +    const Uint32 modulateG = info->g;
  8.4270 +    const Uint32 modulateB = info->b;
  8.4271 +    const Uint32 modulateA = info->a;
  8.4272 +    Uint32 pixel;
  8.4273 +    Uint32 R, G, B, A;
  8.4274 +    int srcy, srcx;
  8.4275 +    int posy, posx;
  8.4276 +    int incy, incx;
  8.4277 +
  8.4278 +    srcy = 0;
  8.4279 +    posy = 0;
  8.4280 +    incy = (info->src_h << 16) / info->dst_h;
  8.4281 +    incx = (info->src_w << 16) / info->dst_w;
  8.4282 +
  8.4283 +    while (info->dst_h--) {
  8.4284 +        Uint32 *src;
  8.4285 +        Uint32 *dst = (Uint32 *)info->dst;
  8.4286 +        int n = info->dst_w;
  8.4287 +        srcx = -1;
  8.4288 +        posx = 0x10000L;
  8.4289 +        while (posy >= 0x10000L) {
  8.4290 +            ++srcy;
  8.4291 +            posy -= 0x10000L;
  8.4292 +        }
  8.4293 +        while (n--) {
  8.4294 +            if (posx >= 0x10000L) {
  8.4295 +                while (posx >= 0x10000L) {
  8.4296 +                    ++srcx;
  8.4297 +                    posx -= 0x10000L;
  8.4298 +                }
  8.4299 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.4300 +            }
  8.4301 +            pixel = *src;
  8.4302 +            A = (Uint8)(pixel >> 24); B = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); R = (Uint8)pixel;
  8.4303 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.4304 +                R = (R * modulateR) / 255;
  8.4305 +                G = (G * modulateG) / 255;
  8.4306 +                B = (B * modulateB) / 255;
  8.4307 +            }
  8.4308 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.4309 +                A = (A * modulateA) / 255;
  8.4310 +            }
  8.4311 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  8.4312 +            *dst = pixel;
  8.4313 +            posx += incx;
  8.4314 +            ++dst;
  8.4315 +        }
  8.4316 +        posy += incy;
  8.4317 +        info->dst += info->dst_pitch;
  8.4318 +    }
  8.4319 +}
  8.4320 +
  8.4321 +void SDL_Blit_ABGR8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
  8.4322 +{
  8.4323 +    const int flags = info->flags;
  8.4324 +    const Uint32 modulateR = info->r;
  8.4325 +    const Uint32 modulateG = info->g;
  8.4326 +    const Uint32 modulateB = info->b;
  8.4327 +    const Uint32 modulateA = info->a;
  8.4328 +    Uint32 srcpixel;
  8.4329 +    Uint32 srcR, srcG, srcB, srcA;
  8.4330 +    Uint32 dstpixel;
  8.4331 +    Uint32 dstR, dstG, dstB, dstA;
  8.4332 +
  8.4333 +    while (info->dst_h--) {
  8.4334 +        Uint32 *src = (Uint32 *)info->src;
  8.4335 +        Uint32 *dst = (Uint32 *)info->dst;
  8.4336 +        int n = info->dst_w;
  8.4337 +        while (n--) {
  8.4338 +            srcpixel = *src;
  8.4339 +            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
  8.4340 +            dstpixel = *dst;
  8.4341 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.4342 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.4343 +                srcR = (srcR * modulateR) / 255;
  8.4344 +                srcG = (srcG * modulateG) / 255;
  8.4345 +                srcB = (srcB * modulateB) / 255;
  8.4346 +            }
  8.4347 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.4348 +                srcA = (srcA * modulateA) / 255;
  8.4349 +            }
  8.4350 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.4351 +                /* This goes away if we ever use premultiplied alpha */
  8.4352 +                if (srcA < 255) {
  8.4353 +                    srcR = (srcR * srcA) / 255;
  8.4354 +                    srcG = (srcG * srcA) / 255;
  8.4355 +                    srcB = (srcB * srcA) / 255;
  8.4356 +                }
  8.4357 +            }
  8.4358 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.4359 +            case SDL_COPY_MASK:
  8.4360 +                if (srcA) {
  8.4361 +                    dstR = srcR;
  8.4362 +                    dstG = srcG;
  8.4363 +                    dstB = srcB;
  8.4364 +                }
  8.4365 +                break;
  8.4366 +            case SDL_COPY_BLEND:
  8.4367 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.4368 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.4369 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.4370 +                break;
  8.4371 +            case SDL_COPY_ADD:
  8.4372 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.4373 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.4374 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.4375 +                break;
  8.4376 +            case SDL_COPY_MOD:
  8.4377 +                dstR = (srcR * dstR) / 255;
  8.4378 +                dstG = (srcG * dstG) / 255;
  8.4379 +                dstB = (srcB * dstB) / 255;
  8.4380 +                break;
  8.4381 +            }
  8.4382 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.4383 +            *dst = dstpixel;
  8.4384 +            ++src;
  8.4385 +            ++dst;
  8.4386 +        }
  8.4387 +        info->src += info->src_pitch;
  8.4388 +        info->dst += info->dst_pitch;
  8.4389 +    }
  8.4390 +}
  8.4391 +
  8.4392 +void SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  8.4393 +{
  8.4394 +    const int flags = info->flags;
  8.4395 +    const Uint32 modulateR = info->r;
  8.4396 +    const Uint32 modulateG = info->g;
  8.4397 +    const Uint32 modulateB = info->b;
  8.4398 +    const Uint32 modulateA = info->a;
  8.4399 +    Uint32 srcpixel;
  8.4400 +    Uint32 srcR, srcG, srcB, srcA;
  8.4401 +    Uint32 dstpixel;
  8.4402 +    Uint32 dstR, dstG, dstB, dstA;
  8.4403 +    int srcy, srcx;
  8.4404 +    int posy, posx;
  8.4405 +    int incy, incx;
  8.4406 +
  8.4407 +    srcy = 0;
  8.4408 +    posy = 0;
  8.4409 +    incy = (info->src_h << 16) / info->dst_h;
  8.4410 +    incx = (info->src_w << 16) / info->dst_w;
  8.4411 +
  8.4412 +    while (info->dst_h--) {
  8.4413 +        Uint32 *src;
  8.4414 +        Uint32 *dst = (Uint32 *)info->dst;
  8.4415 +        int n = info->dst_w;
  8.4416 +        srcx = -1;
  8.4417 +        posx = 0x10000L;
  8.4418 +        while (posy >= 0x10000L) {
  8.4419 +            ++srcy;
  8.4420 +            posy -= 0x10000L;
  8.4421 +        }
  8.4422 +        while (n--) {
  8.4423 +            if (posx >= 0x10000L) {
  8.4424 +                while (posx >= 0x10000L) {
  8.4425 +                    ++srcx;
  8.4426 +                    posx -= 0x10000L;
  8.4427 +                }
  8.4428 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.4429 +            }
  8.4430 +            srcpixel = *src;
  8.4431 +            srcA = (Uint8)(srcpixel >> 24); srcB = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcR = (Uint8)srcpixel;
  8.4432 +            dstpixel = *dst;
  8.4433 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.4434 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.4435 +                srcR = (srcR * modulateR) / 255;
  8.4436 +                srcG = (srcG * modulateG) / 255;
  8.4437 +                srcB = (srcB * modulateB) / 255;
  8.4438 +            }
  8.4439 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.4440 +                srcA = (srcA * modulateA) / 255;
  8.4441 +            }
  8.4442 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.4443 +                /* This goes away if we ever use premultiplied alpha */
  8.4444 +                if (srcA < 255) {
  8.4445 +                    srcR = (srcR * srcA) / 255;
  8.4446 +                    srcG = (srcG * srcA) / 255;
  8.4447 +                    srcB = (srcB * srcA) / 255;
  8.4448 +                }
  8.4449 +            }
  8.4450 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.4451 +            case SDL_COPY_MASK:
  8.4452 +                if (srcA) {
  8.4453 +                    dstR = srcR;
  8.4454 +                    dstG = srcG;
  8.4455 +                    dstB = srcB;
  8.4456 +                }
  8.4457 +                break;
  8.4458 +            case SDL_COPY_BLEND:
  8.4459 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.4460 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.4461 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.4462 +                break;
  8.4463 +            case SDL_COPY_ADD:
  8.4464 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.4465 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.4466 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.4467 +                break;
  8.4468 +            case SDL_COPY_MOD:
  8.4469 +                dstR = (srcR * dstR) / 255;
  8.4470 +                dstG = (srcG * dstG) / 255;
  8.4471 +                dstB = (srcB * dstB) / 255;
  8.4472 +                break;
  8.4473 +            }
  8.4474 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.4475 +            *dst = dstpixel;
  8.4476 +            posx += incx;
  8.4477 +            ++dst;
  8.4478 +        }
  8.4479 +        posy += incy;
  8.4480 +        info->dst += info->dst_pitch;
  8.4481 +    }
  8.4482 +}
  8.4483 +
  8.4484 +void SDL_Blit_BGRA8888_RGB888_Scale(SDL_BlitInfo *info)
  8.4485 +{
  8.4486 +    const int flags = info->flags;
  8.4487 +    Uint32 pixel;
  8.4488 +    Uint32 R, G, B, A;
  8.4489 +    int srcy, srcx;
  8.4490 +    int posy, posx;
  8.4491 +    int incy, incx;
  8.4492 +
  8.4493 +    srcy = 0;
  8.4494 +    posy = 0;
  8.4495 +    incy = (info->src_h << 16) / info->dst_h;
  8.4496 +    incx = (info->src_w << 16) / info->dst_w;
  8.4497 +
  8.4498 +    while (info->dst_h--) {
  8.4499 +        Uint32 *src;
  8.4500 +        Uint32 *dst = (Uint32 *)info->dst;
  8.4501 +        int n = info->dst_w;
  8.4502 +        srcx = -1;
  8.4503 +        posx = 0x10000L;
  8.4504 +        while (posy >= 0x10000L) {
  8.4505 +            ++srcy;
  8.4506 +            posy -= 0x10000L;
  8.4507 +        }
  8.4508 +        while (n--) {
  8.4509 +            if (posx >= 0x10000L) {
  8.4510 +                while (posx >= 0x10000L) {
  8.4511 +                    ++srcx;
  8.4512 +                    posx -= 0x10000L;
  8.4513 +                }
  8.4514 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.4515 +            }
  8.4516 +            pixel = *src;
  8.4517 +            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  8.4518 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  8.4519 +            *dst = pixel;
  8.4520 +            posx += incx;
  8.4521 +            ++dst;
  8.4522 +        }
  8.4523 +        posy += incy;
  8.4524 +        info->dst += info->dst_pitch;
  8.4525 +    }
  8.4526 +}
  8.4527 +
  8.4528 +void SDL_Blit_BGRA8888_RGB888_Blend(SDL_BlitInfo *info)
  8.4529 +{
  8.4530 +    const int flags = info->flags;
  8.4531 +    Uint32 srcpixel;
  8.4532 +    Uint32 srcR, srcG, srcB, srcA;
  8.4533 +    Uint32 dstpixel;
  8.4534 +    Uint32 dstR, dstG, dstB, dstA;
  8.4535 +
  8.4536 +    while (info->dst_h--) {
  8.4537 +        Uint32 *src = (Uint32 *)info->src;
  8.4538 +        Uint32 *dst = (Uint32 *)info->dst;
  8.4539 +        int n = info->dst_w;
  8.4540 +        while (n--) {
  8.4541 +            srcpixel = *src;
  8.4542 +            srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  8.4543 +            dstpixel = *dst;
  8.4544 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.4545 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.4546 +                /* This goes away if we ever use premultiplied alpha */
  8.4547 +                if (srcA < 255) {
  8.4548 +                    srcR = (srcR * srcA) / 255;
  8.4549 +                    srcG = (srcG * srcA) / 255;
  8.4550 +                    srcB = (srcB * srcA) / 255;
  8.4551 +                }
  8.4552 +            }
  8.4553 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.4554 +            case SDL_COPY_MASK:
  8.4555 +                if (srcA) {
  8.4556 +                    dstR = srcR;
  8.4557 +                    dstG = srcG;
  8.4558 +                    dstB = srcB;
  8.4559 +                }
  8.4560 +                break;
  8.4561 +            case SDL_COPY_BLEND:
  8.4562 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.4563 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.4564 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.4565 +                break;
  8.4566 +            case SDL_COPY_ADD:
  8.4567 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.4568 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.4569 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.4570 +                break;
  8.4571 +            case SDL_COPY_MOD:
  8.4572 +                dstR = (srcR * dstR) / 255;
  8.4573 +                dstG = (srcG * dstG) / 255;
  8.4574 +                dstB = (srcB * dstB) / 255;
  8.4575 +                break;
  8.4576 +            }
  8.4577 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.4578 +            *dst = dstpixel;
  8.4579 +            ++src;
  8.4580 +            ++dst;
  8.4581 +        }
  8.4582 +        info->src += info->src_pitch;
  8.4583 +        info->dst += info->dst_pitch;
  8.4584 +    }
  8.4585 +}
  8.4586 +
  8.4587 +void SDL_Blit_BGRA8888_RGB888_Blend_Scale(SDL_BlitInfo *info)
  8.4588 +{
  8.4589 +    const int flags = info->flags;
  8.4590 +    Uint32 srcpixel;
  8.4591 +    Uint32 srcR, srcG, srcB, srcA;
  8.4592 +    Uint32 dstpixel;
  8.4593 +    Uint32 dstR, dstG, dstB, dstA;
  8.4594 +    int srcy, srcx;
  8.4595 +    int posy, posx;
  8.4596 +    int incy, incx;
  8.4597 +
  8.4598 +    srcy = 0;
  8.4599 +    posy = 0;
  8.4600 +    incy = (info->src_h << 16) / info->dst_h;
  8.4601 +    incx = (info->src_w << 16) / info->dst_w;
  8.4602 +
  8.4603 +    while (info->dst_h--) {
  8.4604 +        Uint32 *src;
  8.4605 +        Uint32 *dst = (Uint32 *)info->dst;
  8.4606 +        int n = info->dst_w;
  8.4607 +        srcx = -1;
  8.4608 +        posx = 0x10000L;
  8.4609 +        while (posy >= 0x10000L) {
  8.4610 +            ++srcy;
  8.4611 +            posy -= 0x10000L;
  8.4612 +        }
  8.4613 +        while (n--) {
  8.4614 +            if (posx >= 0x10000L) {
  8.4615 +                while (posx >= 0x10000L) {
  8.4616 +                    ++srcx;
  8.4617 +                    posx -= 0x10000L;
  8.4618 +                }
  8.4619 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.4620 +            }
  8.4621 +            srcpixel = *src;
  8.4622 +            srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  8.4623 +            dstpixel = *dst;
  8.4624 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.4625 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.4626 +                /* This goes away if we ever use premultiplied alpha */
  8.4627 +                if (srcA < 255) {
  8.4628 +                    srcR = (srcR * srcA) / 255;
  8.4629 +                    srcG = (srcG * srcA) / 255;
  8.4630 +                    srcB = (srcB * srcA) / 255;
  8.4631 +                }
  8.4632 +            }
  8.4633 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.4634 +            case SDL_COPY_MASK:
  8.4635 +                if (srcA) {
  8.4636 +                    dstR = srcR;
  8.4637 +                    dstG = srcG;
  8.4638 +                    dstB = srcB;
  8.4639 +                }
  8.4640 +                break;
  8.4641 +            case SDL_COPY_BLEND:
  8.4642 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.4643 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.4644 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.4645 +                break;
  8.4646 +            case SDL_COPY_ADD:
  8.4647 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.4648 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.4649 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.4650 +                break;
  8.4651 +            case SDL_COPY_MOD:
  8.4652 +                dstR = (srcR * dstR) / 255;
  8.4653 +                dstG = (srcG * dstG) / 255;
  8.4654 +                dstB = (srcB * dstB) / 255;
  8.4655 +                break;
  8.4656 +            }
  8.4657 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.4658 +            *dst = dstpixel;
  8.4659 +            posx += incx;
  8.4660 +            ++dst;
  8.4661 +        }
  8.4662 +        posy += incy;
  8.4663 +        info->dst += info->dst_pitch;
  8.4664 +    }
  8.4665 +}
  8.4666 +
  8.4667 +void SDL_Blit_BGRA8888_RGB888_Modulate(SDL_BlitInfo *info)
  8.4668 +{
  8.4669 +    const int flags = info->flags;
  8.4670 +    const Uint32 modulateR = info->r;
  8.4671 +    const Uint32 modulateG = info->g;
  8.4672 +    const Uint32 modulateB = info->b;
  8.4673 +    const Uint32 modulateA = info->a;
  8.4674 +    Uint32 pixel;
  8.4675 +    Uint32 R, G, B, A;
  8.4676 +
  8.4677 +    while (info->dst_h--) {
  8.4678 +        Uint32 *src = (Uint32 *)info->src;
  8.4679 +        Uint32 *dst = (Uint32 *)info->dst;
  8.4680 +        int n = info->dst_w;
  8.4681 +        while (n--) {
  8.4682 +            pixel = *src;
  8.4683 +            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  8.4684 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.4685 +                R = (R * modulateR) / 255;
  8.4686 +                G = (G * modulateG) / 255;
  8.4687 +                B = (B * modulateB) / 255;
  8.4688 +            }
  8.4689 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.4690 +                A = (A * modulateA) / 255;
  8.4691 +            }
  8.4692 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  8.4693 +            *dst = pixel;
  8.4694 +            ++src;
  8.4695 +            ++dst;
  8.4696 +        }
  8.4697 +        info->src += info->src_pitch;
  8.4698 +        info->dst += info->dst_pitch;
  8.4699 +    }
  8.4700 +}
  8.4701 +
  8.4702 +void SDL_Blit_BGRA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info)
  8.4703 +{
  8.4704 +    const int flags = info->flags;
  8.4705 +    const Uint32 modulateR = info->r;
  8.4706 +    const Uint32 modulateG = info->g;
  8.4707 +    const Uint32 modulateB = info->b;
  8.4708 +    const Uint32 modulateA = info->a;
  8.4709 +    Uint32 pixel;
  8.4710 +    Uint32 R, G, B, A;
  8.4711 +    int srcy, srcx;
  8.4712 +    int posy, posx;
  8.4713 +    int incy, incx;
  8.4714 +
  8.4715 +    srcy = 0;
  8.4716 +    posy = 0;
  8.4717 +    incy = (info->src_h << 16) / info->dst_h;
  8.4718 +    incx = (info->src_w << 16) / info->dst_w;
  8.4719 +
  8.4720 +    while (info->dst_h--) {
  8.4721 +        Uint32 *src;
  8.4722 +        Uint32 *dst = (Uint32 *)info->dst;
  8.4723 +        int n = info->dst_w;
  8.4724 +        srcx = -1;
  8.4725 +        posx = 0x10000L;
  8.4726 +        while (posy >= 0x10000L) {
  8.4727 +            ++srcy;
  8.4728 +            posy -= 0x10000L;
  8.4729 +        }
  8.4730 +        while (n--) {
  8.4731 +            if (posx >= 0x10000L) {
  8.4732 +                while (posx >= 0x10000L) {
  8.4733 +                    ++srcx;
  8.4734 +                    posx -= 0x10000L;
  8.4735 +                }
  8.4736 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.4737 +            }
  8.4738 +            pixel = *src;
  8.4739 +            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  8.4740 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.4741 +                R = (R * modulateR) / 255;
  8.4742 +                G = (G * modulateG) / 255;
  8.4743 +                B = (B * modulateB) / 255;
  8.4744 +            }
  8.4745 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.4746 +                A = (A * modulateA) / 255;
  8.4747 +            }
  8.4748 +            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  8.4749 +            *dst = pixel;
  8.4750 +            posx += incx;
  8.4751 +            ++dst;
  8.4752 +        }
  8.4753 +        posy += incy;
  8.4754 +        info->dst += info->dst_pitch;
  8.4755 +    }
  8.4756 +}
  8.4757 +
  8.4758 +void SDL_Blit_BGRA8888_RGB888_Modulate_Blend(SDL_BlitInfo *info)
  8.4759 +{
  8.4760 +    const int flags = info->flags;
  8.4761 +    const Uint32 modulateR = info->r;
  8.4762 +    const Uint32 modulateG = info->g;
  8.4763 +    const Uint32 modulateB = info->b;
  8.4764 +    const Uint32 modulateA = info->a;
  8.4765 +    Uint32 srcpixel;
  8.4766 +    Uint32 srcR, srcG, srcB, srcA;
  8.4767 +    Uint32 dstpixel;
  8.4768 +    Uint32 dstR, dstG, dstB, dstA;
  8.4769 +
  8.4770 +    while (info->dst_h--) {
  8.4771 +        Uint32 *src = (Uint32 *)info->src;
  8.4772 +        Uint32 *dst = (Uint32 *)info->dst;
  8.4773 +        int n = info->dst_w;
  8.4774 +        while (n--) {
  8.4775 +            srcpixel = *src;
  8.4776 +            srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  8.4777 +            dstpixel = *dst;
  8.4778 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.4779 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.4780 +                srcR = (srcR * modulateR) / 255;
  8.4781 +                srcG = (srcG * modulateG) / 255;
  8.4782 +                srcB = (srcB * modulateB) / 255;
  8.4783 +            }
  8.4784 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.4785 +                srcA = (srcA * modulateA) / 255;
  8.4786 +            }
  8.4787 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.4788 +                /* This goes away if we ever use premultiplied alpha */
  8.4789 +                if (srcA < 255) {
  8.4790 +                    srcR = (srcR * srcA) / 255;
  8.4791 +                    srcG = (srcG * srcA) / 255;
  8.4792 +                    srcB = (srcB * srcA) / 255;
  8.4793 +                }
  8.4794 +            }
  8.4795 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.4796 +            case SDL_COPY_MASK:
  8.4797 +                if (srcA) {
  8.4798 +                    dstR = srcR;
  8.4799 +                    dstG = srcG;
  8.4800 +                    dstB = srcB;
  8.4801 +                }
  8.4802 +                break;
  8.4803 +            case SDL_COPY_BLEND:
  8.4804 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.4805 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.4806 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.4807 +                break;
  8.4808 +            case SDL_COPY_ADD:
  8.4809 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.4810 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.4811 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.4812 +                break;
  8.4813 +            case SDL_COPY_MOD:
  8.4814 +                dstR = (srcR * dstR) / 255;
  8.4815 +                dstG = (srcG * dstG) / 255;
  8.4816 +                dstB = (srcB * dstB) / 255;
  8.4817 +                break;
  8.4818 +            }
  8.4819 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.4820 +            *dst = dstpixel;
  8.4821 +            ++src;
  8.4822 +            ++dst;
  8.4823 +        }
  8.4824 +        info->src += info->src_pitch;
  8.4825 +        info->dst += info->dst_pitch;
  8.4826 +    }
  8.4827 +}
  8.4828 +
  8.4829 +void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  8.4830 +{
  8.4831 +    const int flags = info->flags;
  8.4832 +    const Uint32 modulateR = info->r;
  8.4833 +    const Uint32 modulateG = info->g;
  8.4834 +    const Uint32 modulateB = info->b;
  8.4835 +    const Uint32 modulateA = info->a;
  8.4836 +    Uint32 srcpixel;
  8.4837 +    Uint32 srcR, srcG, srcB, srcA;
  8.4838 +    Uint32 dstpixel;
  8.4839 +    Uint32 dstR, dstG, dstB, dstA;
  8.4840 +    int srcy, srcx;
  8.4841 +    int posy, posx;
  8.4842 +    int incy, incx;
  8.4843 +
  8.4844 +    srcy = 0;
  8.4845 +    posy = 0;
  8.4846 +    incy = (info->src_h << 16) / info->dst_h;
  8.4847 +    incx = (info->src_w << 16) / info->dst_w;
  8.4848 +
  8.4849 +    while (info->dst_h--) {
  8.4850 +        Uint32 *src;
  8.4851 +        Uint32 *dst = (Uint32 *)info->dst;
  8.4852 +        int n = info->dst_w;
  8.4853 +        srcx = -1;
  8.4854 +        posx = 0x10000L;
  8.4855 +        while (posy >= 0x10000L) {
  8.4856 +            ++srcy;
  8.4857 +            posy -= 0x10000L;
  8.4858 +        }
  8.4859 +        while (n--) {
  8.4860 +            if (posx >= 0x10000L) {
  8.4861 +                while (posx >= 0x10000L) {
  8.4862 +                    ++srcx;
  8.4863 +                    posx -= 0x10000L;
  8.4864 +                }
  8.4865 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.4866 +            }
  8.4867 +            srcpixel = *src;
  8.4868 +            srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  8.4869 +            dstpixel = *dst;
  8.4870 +            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  8.4871 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.4872 +                srcR = (srcR * modulateR) / 255;
  8.4873 +                srcG = (srcG * modulateG) / 255;
  8.4874 +                srcB = (srcB * modulateB) / 255;
  8.4875 +            }
  8.4876 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.4877 +                srcA = (srcA * modulateA) / 255;
  8.4878 +            }
  8.4879 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.4880 +                /* This goes away if we ever use premultiplied alpha */
  8.4881 +                if (srcA < 255) {
  8.4882 +                    srcR = (srcR * srcA) / 255;
  8.4883 +                    srcG = (srcG * srcA) / 255;
  8.4884 +                    srcB = (srcB * srcA) / 255;
  8.4885 +                }
  8.4886 +            }
  8.4887 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.4888 +            case SDL_COPY_MASK:
  8.4889 +                if (srcA) {
  8.4890 +                    dstR = srcR;
  8.4891 +                    dstG = srcG;
  8.4892 +                    dstB = srcB;
  8.4893 +                }
  8.4894 +                break;
  8.4895 +            case SDL_COPY_BLEND:
  8.4896 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.4897 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.4898 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.4899 +                break;
  8.4900 +            case SDL_COPY_ADD:
  8.4901 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.4902 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.4903 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.4904 +                break;
  8.4905 +            case SDL_COPY_MOD:
  8.4906 +                dstR = (srcR * dstR) / 255;
  8.4907 +                dstG = (srcG * dstG) / 255;
  8.4908 +                dstB = (srcB * dstB) / 255;
  8.4909 +                break;
  8.4910 +            }
  8.4911 +            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  8.4912 +            *dst = dstpixel;
  8.4913 +            posx += incx;
  8.4914 +            ++dst;
  8.4915 +        }
  8.4916 +        posy += incy;
  8.4917 +        info->dst += info->dst_pitch;
  8.4918 +    }
  8.4919 +}
  8.4920 +
  8.4921 +void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info)
  8.4922 +{
  8.4923 +    const int flags = info->flags;
  8.4924 +    Uint32 pixel;
  8.4925 +    Uint32 R, G, B, A;
  8.4926 +    int srcy, srcx;
  8.4927 +    int posy, posx;
  8.4928 +    int incy, incx;
  8.4929 +
  8.4930 +    srcy = 0;
  8.4931 +    posy = 0;
  8.4932 +    incy = (info->src_h << 16) / info->dst_h;
  8.4933 +    incx = (info->src_w << 16) / info->dst_w;
  8.4934 +
  8.4935 +    while (info->dst_h--) {
  8.4936 +        Uint32 *src;
  8.4937 +        Uint32 *dst = (Uint32 *)info->dst;
  8.4938 +        int n = info->dst_w;
  8.4939 +        srcx = -1;
  8.4940 +        posx = 0x10000L;
  8.4941 +        while (posy >= 0x10000L) {
  8.4942 +            ++srcy;
  8.4943 +            posy -= 0x10000L;
  8.4944 +        }
  8.4945 +        while (n--) {
  8.4946 +            if (posx >= 0x10000L) {
  8.4947 +                while (posx >= 0x10000L) {
  8.4948 +                    ++srcx;
  8.4949 +                    posx -= 0x10000L;
  8.4950 +                }
  8.4951 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.4952 +            }
  8.4953 +            pixel = *src;
  8.4954 +            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  8.4955 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  8.4956 +            *dst = pixel;
  8.4957 +            posx += incx;
  8.4958 +            ++dst;
  8.4959 +        }
  8.4960 +        posy += incy;
  8.4961 +        info->dst += info->dst_pitch;
  8.4962 +    }
  8.4963 +}
  8.4964 +
  8.4965 +void SDL_Blit_BGRA8888_BGR888_Blend(SDL_BlitInfo *info)
  8.4966 +{
  8.4967 +    const int flags = info->flags;
  8.4968 +    Uint32 srcpixel;
  8.4969 +    Uint32 srcR, srcG, srcB, srcA;
  8.4970 +    Uint32 dstpixel;
  8.4971 +    Uint32 dstR, dstG, dstB, dstA;
  8.4972 +
  8.4973 +    while (info->dst_h--) {
  8.4974 +        Uint32 *src = (Uint32 *)info->src;
  8.4975 +        Uint32 *dst = (Uint32 *)info->dst;
  8.4976 +        int n = info->dst_w;
  8.4977 +        while (n--) {
  8.4978 +            srcpixel = *src;
  8.4979 +            srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  8.4980 +            dstpixel = *dst;
  8.4981 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.4982 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.4983 +                /* This goes away if we ever use premultiplied alpha */
  8.4984 +                if (srcA < 255) {
  8.4985 +                    srcR = (srcR * srcA) / 255;
  8.4986 +                    srcG = (srcG * srcA) / 255;
  8.4987 +                    srcB = (srcB * srcA) / 255;
  8.4988 +                }
  8.4989 +            }
  8.4990 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.4991 +            case SDL_COPY_MASK:
  8.4992 +                if (srcA) {
  8.4993 +                    dstR = srcR;
  8.4994 +                    dstG = srcG;
  8.4995 +                    dstB = srcB;
  8.4996 +                }
  8.4997 +                break;
  8.4998 +            case SDL_COPY_BLEND:
  8.4999 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.5000 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.5001 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.5002 +                break;
  8.5003 +            case SDL_COPY_ADD:
  8.5004 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.5005 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.5006 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.5007 +                break;
  8.5008 +            case SDL_COPY_MOD:
  8.5009 +                dstR = (srcR * dstR) / 255;
  8.5010 +                dstG = (srcG * dstG) / 255;
  8.5011 +                dstB = (srcB * dstB) / 255;
  8.5012 +                break;
  8.5013 +            }
  8.5014 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.5015 +            *dst = dstpixel;
  8.5016 +            ++src;
  8.5017 +            ++dst;
  8.5018 +        }
  8.5019 +        info->src += info->src_pitch;
  8.5020 +        info->dst += info->dst_pitch;
  8.5021 +    }
  8.5022 +}
  8.5023 +
  8.5024 +void SDL_Blit_BGRA8888_BGR888_Blend_Scale(SDL_BlitInfo *info)
  8.5025 +{
  8.5026 +    const int flags = info->flags;
  8.5027 +    Uint32 srcpixel;
  8.5028 +    Uint32 srcR, srcG, srcB, srcA;
  8.5029 +    Uint32 dstpixel;
  8.5030 +    Uint32 dstR, dstG, dstB, dstA;
  8.5031 +    int srcy, srcx;
  8.5032 +    int posy, posx;
  8.5033 +    int incy, incx;
  8.5034 +
  8.5035 +    srcy = 0;
  8.5036 +    posy = 0;
  8.5037 +    incy = (info->src_h << 16) / info->dst_h;
  8.5038 +    incx = (info->src_w << 16) / info->dst_w;
  8.5039 +
  8.5040 +    while (info->dst_h--) {
  8.5041 +        Uint32 *src;
  8.5042 +        Uint32 *dst = (Uint32 *)info->dst;
  8.5043 +        int n = info->dst_w;
  8.5044 +        srcx = -1;
  8.5045 +        posx = 0x10000L;
  8.5046 +        while (posy >= 0x10000L) {
  8.5047 +            ++srcy;
  8.5048 +            posy -= 0x10000L;
  8.5049 +        }
  8.5050 +        while (n--) {
  8.5051 +            if (posx >= 0x10000L) {
  8.5052 +                while (posx >= 0x10000L) {
  8.5053 +                    ++srcx;
  8.5054 +                    posx -= 0x10000L;
  8.5055 +                }
  8.5056 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.5057 +            }
  8.5058 +            srcpixel = *src;
  8.5059 +            srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  8.5060 +            dstpixel = *dst;
  8.5061 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.5062 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.5063 +                /* This goes away if we ever use premultiplied alpha */
  8.5064 +                if (srcA < 255) {
  8.5065 +                    srcR = (srcR * srcA) / 255;
  8.5066 +                    srcG = (srcG * srcA) / 255;
  8.5067 +                    srcB = (srcB * srcA) / 255;
  8.5068 +                }
  8.5069 +            }
  8.5070 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.5071 +            case SDL_COPY_MASK:
  8.5072 +                if (srcA) {
  8.5073 +                    dstR = srcR;
  8.5074 +                    dstG = srcG;
  8.5075 +                    dstB = srcB;
  8.5076 +                }
  8.5077 +                break;
  8.5078 +            case SDL_COPY_BLEND:
  8.5079 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.5080 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.5081 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.5082 +                break;
  8.5083 +            case SDL_COPY_ADD:
  8.5084 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.5085 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.5086 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.5087 +                break;
  8.5088 +            case SDL_COPY_MOD:
  8.5089 +                dstR = (srcR * dstR) / 255;
  8.5090 +                dstG = (srcG * dstG) / 255;
  8.5091 +                dstB = (srcB * dstB) / 255;
  8.5092 +                break;
  8.5093 +            }
  8.5094 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.5095 +            *dst = dstpixel;
  8.5096 +            posx += incx;
  8.5097 +            ++dst;
  8.5098 +        }
  8.5099 +        posy += incy;
  8.5100 +        info->dst += info->dst_pitch;
  8.5101 +    }
  8.5102 +}
  8.5103 +
  8.5104 +void SDL_Blit_BGRA8888_BGR888_Modulate(SDL_BlitInfo *info)
  8.5105 +{
  8.5106 +    const int flags = info->flags;
  8.5107 +    const Uint32 modulateR = info->r;
  8.5108 +    const Uint32 modulateG = info->g;
  8.5109 +    const Uint32 modulateB = info->b;
  8.5110 +    const Uint32 modulateA = info->a;
  8.5111 +    Uint32 pixel;
  8.5112 +    Uint32 R, G, B, A;
  8.5113 +
  8.5114 +    while (info->dst_h--) {
  8.5115 +        Uint32 *src = (Uint32 *)info->src;
  8.5116 +        Uint32 *dst = (Uint32 *)info->dst;
  8.5117 +        int n = info->dst_w;
  8.5118 +        while (n--) {
  8.5119 +            pixel = *src;
  8.5120 +            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  8.5121 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.5122 +                R = (R * modulateR) / 255;
  8.5123 +                G = (G * modulateG) / 255;
  8.5124 +                B = (B * modulateB) / 255;
  8.5125 +            }
  8.5126 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.5127 +                A = (A * modulateA) / 255;
  8.5128 +            }
  8.5129 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  8.5130 +            *dst = pixel;
  8.5131 +            ++src;
  8.5132 +            ++dst;
  8.5133 +        }
  8.5134 +        info->src += info->src_pitch;
  8.5135 +        info->dst += info->dst_pitch;
  8.5136 +    }
  8.5137 +}
  8.5138 +
  8.5139 +void SDL_Blit_BGRA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info)
  8.5140 +{
  8.5141 +    const int flags = info->flags;
  8.5142 +    const Uint32 modulateR = info->r;
  8.5143 +    const Uint32 modulateG = info->g;
  8.5144 +    const Uint32 modulateB = info->b;
  8.5145 +    const Uint32 modulateA = info->a;
  8.5146 +    Uint32 pixel;
  8.5147 +    Uint32 R, G, B, A;
  8.5148 +    int srcy, srcx;
  8.5149 +    int posy, posx;
  8.5150 +    int incy, incx;
  8.5151 +
  8.5152 +    srcy = 0;
  8.5153 +    posy = 0;
  8.5154 +    incy = (info->src_h << 16) / info->dst_h;
  8.5155 +    incx = (info->src_w << 16) / info->dst_w;
  8.5156 +
  8.5157 +    while (info->dst_h--) {
  8.5158 +        Uint32 *src;
  8.5159 +        Uint32 *dst = (Uint32 *)info->dst;
  8.5160 +        int n = info->dst_w;
  8.5161 +        srcx = -1;
  8.5162 +        posx = 0x10000L;
  8.5163 +        while (posy >= 0x10000L) {
  8.5164 +            ++srcy;
  8.5165 +            posy -= 0x10000L;
  8.5166 +        }
  8.5167 +        while (n--) {
  8.5168 +            if (posx >= 0x10000L) {
  8.5169 +                while (posx >= 0x10000L) {
  8.5170 +                    ++srcx;
  8.5171 +                    posx -= 0x10000L;
  8.5172 +                }
  8.5173 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.5174 +            }
  8.5175 +            pixel = *src;
  8.5176 +            B = (Uint8)(pixel >> 24); G = (Uint8)(pixel >> 16); R = (Uint8)(pixel >> 8); A = (Uint8)pixel;
  8.5177 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.5178 +                R = (R * modulateR) / 255;
  8.5179 +                G = (G * modulateG) / 255;
  8.5180 +                B = (B * modulateB) / 255;
  8.5181 +            }
  8.5182 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.5183 +                A = (A * modulateA) / 255;
  8.5184 +            }
  8.5185 +            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  8.5186 +            *dst = pixel;
  8.5187 +            posx += incx;
  8.5188 +            ++dst;
  8.5189 +        }
  8.5190 +        posy += incy;
  8.5191 +        info->dst += info->dst_pitch;
  8.5192 +    }
  8.5193 +}
  8.5194 +
  8.5195 +void SDL_Blit_BGRA8888_BGR888_Modulate_Blend(SDL_BlitInfo *info)
  8.5196 +{
  8.5197 +    const int flags = info->flags;
  8.5198 +    const Uint32 modulateR = info->r;
  8.5199 +    const Uint32 modulateG = info->g;
  8.5200 +    const Uint32 modulateB = info->b;
  8.5201 +    const Uint32 modulateA = info->a;
  8.5202 +    Uint32 srcpixel;
  8.5203 +    Uint32 srcR, srcG, srcB, srcA;
  8.5204 +    Uint32 dstpixel;
  8.5205 +    Uint32 dstR, dstG, dstB, dstA;
  8.5206 +
  8.5207 +    while (info->dst_h--) {
  8.5208 +        Uint32 *src = (Uint32 *)info->src;
  8.5209 +        Uint32 *dst = (Uint32 *)info->dst;
  8.5210 +        int n = info->dst_w;
  8.5211 +        while (n--) {
  8.5212 +            srcpixel = *src;
  8.5213 +            srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  8.5214 +            dstpixel = *dst;
  8.5215 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.5216 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.5217 +                srcR = (srcR * modulateR) / 255;
  8.5218 +                srcG = (srcG * modulateG) / 255;
  8.5219 +                srcB = (srcB * modulateB) / 255;
  8.5220 +            }
  8.5221 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.5222 +                srcA = (srcA * modulateA) / 255;
  8.5223 +            }
  8.5224 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.5225 +                /* This goes away if we ever use premultiplied alpha */
  8.5226 +                if (srcA < 255) {
  8.5227 +                    srcR = (srcR * srcA) / 255;
  8.5228 +                    srcG = (srcG * srcA) / 255;
  8.5229 +                    srcB = (srcB * srcA) / 255;
  8.5230 +                }
  8.5231 +            }
  8.5232 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.5233 +            case SDL_COPY_MASK:
  8.5234 +                if (srcA) {
  8.5235 +                    dstR = srcR;
  8.5236 +                    dstG = srcG;
  8.5237 +                    dstB = srcB;
  8.5238 +                }
  8.5239 +                break;
  8.5240 +            case SDL_COPY_BLEND:
  8.5241 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.5242 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.5243 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.5244 +                break;
  8.5245 +            case SDL_COPY_ADD:
  8.5246 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.5247 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.5248 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.5249 +                break;
  8.5250 +            case SDL_COPY_MOD:
  8.5251 +                dstR = (srcR * dstR) / 255;
  8.5252 +                dstG = (srcG * dstG) / 255;
  8.5253 +                dstB = (srcB * dstB) / 255;
  8.5254 +                break;
  8.5255 +            }
  8.5256 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.5257 +            *dst = dstpixel;
  8.5258 +            ++src;
  8.5259 +            ++dst;
  8.5260 +        }
  8.5261 +        info->src += info->src_pitch;
  8.5262 +        info->dst += info->dst_pitch;
  8.5263 +    }
  8.5264 +}
  8.5265 +
  8.5266 +void SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
  8.5267 +{
  8.5268 +    const int flags = info->flags;
  8.5269 +    const Uint32 modulateR = info->r;
  8.5270 +    const Uint32 modulateG = info->g;
  8.5271 +    const Uint32 modulateB = info->b;
  8.5272 +    const Uint32 modulateA = info->a;
  8.5273 +    Uint32 srcpixel;
  8.5274 +    Uint32 srcR, srcG, srcB, srcA;
  8.5275 +    Uint32 dstpixel;
  8.5276 +    Uint32 dstR, dstG, dstB, dstA;
  8.5277 +    int srcy, srcx;
  8.5278 +    int posy, posx;
  8.5279 +    int incy, incx;
  8.5280 +
  8.5281 +    srcy = 0;
  8.5282 +    posy = 0;
  8.5283 +    incy = (info->src_h << 16) / info->dst_h;
  8.5284 +    incx = (info->src_w << 16) / info->dst_w;
  8.5285 +
  8.5286 +    while (info->dst_h--) {
  8.5287 +        Uint32 *src;
  8.5288 +        Uint32 *dst = (Uint32 *)info->dst;
  8.5289 +        int n = info->dst_w;
  8.5290 +        srcx = -1;
  8.5291 +        posx = 0x10000L;
  8.5292 +        while (posy >= 0x10000L) {
  8.5293 +            ++srcy;
  8.5294 +            posy -= 0x10000L;
  8.5295 +        }
  8.5296 +        while (n--) {
  8.5297 +            if (posx >= 0x10000L) {
  8.5298 +                while (posx >= 0x10000L) {
  8.5299 +                    ++srcx;
  8.5300 +                    posx -= 0x10000L;
  8.5301 +                }
  8.5302 +                src = (Uint32 *)(info->src + (srcy * info->src_pitch) + (srcx * 4));
  8.5303 +            }
  8.5304 +            srcpixel = *src;
  8.5305 +            srcB = (Uint8)(srcpixel >> 24); srcG = (Uint8)(srcpixel >> 16); srcR = (Uint8)(srcpixel >> 8); srcA = (Uint8)srcpixel;
  8.5306 +            dstpixel = *dst;
  8.5307 +            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  8.5308 +            if (flags & SDL_COPY_MODULATE_COLOR) {
  8.5309 +                srcR = (srcR * modulateR) / 255;
  8.5310 +                srcG = (srcG * modulateG) / 255;
  8.5311 +                srcB = (srcB * modulateB) / 255;
  8.5312 +            }
  8.5313 +            if (flags & SDL_COPY_MODULATE_ALPHA) {
  8.5314 +                srcA = (srcA * modulateA) / 255;
  8.5315 +            }
  8.5316 +            if (flags & (SDL_COPY_BLEND|SDL_COPY_ADD)) {
  8.5317 +                /* This goes away if we ever use premultiplied alpha */
  8.5318 +                if (srcA < 255) {
  8.5319 +                    srcR = (srcR * srcA) / 255;
  8.5320 +                    srcG = (srcG * srcA) / 255;
  8.5321 +                    srcB = (srcB * srcA) / 255;
  8.5322 +                }
  8.5323 +            }
  8.5324 +            switch (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
  8.5325 +            case SDL_COPY_MASK:
  8.5326 +                if (srcA) {
  8.5327 +                    dstR = srcR;
  8.5328 +                    dstG = srcG;
  8.5329 +                    dstB = srcB;
  8.5330 +                }
  8.5331 +                break;
  8.5332 +            case SDL_COPY_BLEND:
  8.5333 +                dstR = srcR + ((255 - srcA) * dstR) / 255;
  8.5334 +                dstG = srcG + ((255 - srcA) * dstG) / 255;
  8.5335 +                dstB = srcB + ((255 - srcA) * dstB) / 255;
  8.5336 +                break;
  8.5337 +            case SDL_COPY_ADD:
  8.5338 +                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  8.5339 +                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  8.5340 +                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  8.5341 +                break;
  8.5342 +            case SDL_COPY_MOD:
  8.5343 +                dstR = (srcR * dstR) / 255;
  8.5344 +                dstG = (srcG * dstG) / 255;
  8.5345 +                dstB = (srcB * dstB) / 255;
  8.5346 +                break;
  8.5347 +            }
  8.5348 +            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  8.5349 +            *dst = dstpixel;
  8.5350 +            posx += incx;
  8.5351 +            ++dst;
  8.5352 +        }
  8.5353 +        posy += incy;
  8.5354 +        info->dst += info->dst_pitch;
  8.5355 +    }
  8.5356 +}
  8.5357 +
  8.5358 +/* *INDENT-ON* */
  8.5359 +
  8.5360 +/* vi: set ts=4 sw=4 expandtab: */
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/src/video/SDL_blit_auto.h	Fri Aug 17 06:21:58 2007 +0000
     9.3 @@ -0,0 +1,31 @@
     9.4 +/* DO NOT EDIT!  This file is generated by sdlgenblit.pl */
     9.5 +/*
     9.6 +    SDL - Simple DirectMedia Layer
     9.7 +    Copyright (C) 1997-2006 Sam Lantinga
     9.8 +
     9.9 +    This library is free software; you can redistribute it and/or
    9.10 +    modify it under the terms of the GNU Lesser General Public
    9.11 +    License as published by the Free Software Foundation; either
    9.12 +    version 2.1 of the License, or (at your option) any later version.
    9.13 +
    9.14 +    This library is distributed in the hope that it will be useful,
    9.15 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.16 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    9.17 +    Lesser General Public License for more details.
    9.18 +
    9.19 +    You should have received a copy of the GNU Lesser General Public
    9.20 +    License along with this library; if not, write to the Free Software
    9.21 +    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    9.22 +
    9.23 +    Sam Lantinga
    9.24 +    slouken@libsdl.org
    9.25 +*/
    9.26 +#include "SDL_config.h"
    9.27 +
    9.28 +/* *INDENT-OFF* */
    9.29 +
    9.30 +extern SDL_BlitFuncEntry *SDL_GeneratedBlitFuncTable;
    9.31 +
    9.32 +/* *INDENT-ON* */
    9.33 +
    9.34 +/* vi: set ts=4 sw=4 expandtab: */
    10.1 --- a/src/video/SDL_blit_copy.c	Fri Aug 17 03:22:03 2007 +0000
    10.2 +++ b/src/video/SDL_blit_copy.c	Fri Aug 17 06:21:58 2007 +0000
    10.3 @@ -95,12 +95,12 @@
    10.4      int w, h;
    10.5      int srcskip, dstskip;
    10.6  
    10.7 -    w = info->d_width * info->dst->BytesPerPixel;
    10.8 -    h = info->d_height;
    10.9 -    src = info->s_pixels;
   10.10 -    dst = info->d_pixels;
   10.11 +    w = info->dst_w * info->dst->BytesPerPixel;
   10.12 +    h = info->dst_h;
   10.13 +    src = info->src;
   10.14 +    dst = info->dst;
   10.15      srcskip = w + info->s_skip;
   10.16 -    dstskip = w + info->d_skip;
   10.17 +    dstskip = w + info->dst_pitch;
   10.18  
   10.19  #ifdef __SSE__
   10.20      if (SDL_HasSSE() && !((uintptr_t) src & 15) && !((uintptr_t) dst & 15)) {
   10.21 @@ -139,10 +139,10 @@
   10.22      int w, h;
   10.23      int skip;
   10.24  
   10.25 -    w = info->d_width * info->dst->BytesPerPixel;
   10.26 -    h = info->d_height;
   10.27 -    src = info->s_pixels;
   10.28 -    dst = info->d_pixels;
   10.29 +    w = info->dst_w * info->dst->BytesPerPixel;
   10.30 +    h = info->dst_h;
   10.31 +    src = info->src;
   10.32 +    dst = info->dst;
   10.33      skip = w + info->s_skip;
   10.34      if ((dst < src) || (dst >= (src + h * skip))) {
   10.35          SDL_BlitCopy(info);
    11.1 --- a/src/video/SDL_rendercopy.c	Fri Aug 17 03:22:03 2007 +0000
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,5469 +0,0 @@
    11.4 -/* DO NOT EDIT!  This file is generated by sdlgenblit.pl */
    11.5 -/*
    11.6 -    SDL - Simple DirectMedia Layer
    11.7 -    Copyright (C) 1997-2006 Sam Lantinga
    11.8 -
    11.9 -    This library is free software; you can redistribute it and/or
   11.10 -    modify it under the terms of the GNU Lesser General Public
   11.11 -    License as published by the Free Software Foundation; either
   11.12 -    version 2.1 of the License, or (at your option) any later version.
   11.13 -
   11.14 -    This library is distributed in the hope that it will be useful,
   11.15 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
   11.16 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   11.17 -    Lesser General Public License for more details.
   11.18 -
   11.19 -    You should have received a copy of the GNU Lesser General Public
   11.20 -    License along with this library; if not, write to the Free Software
   11.21 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   11.22 -
   11.23 -    Sam Lantinga
   11.24 -    slouken@libsdl.org
   11.25 -*/
   11.26 -#include "SDL_config.h"
   11.27 -
   11.28 -/* *INDENT-OFF* */
   11.29 -
   11.30 -#include "SDL_video.h"
   11.31 -#include "SDL_rendercopy.h"
   11.32 -
   11.33 -static struct {
   11.34 -    Uint32 src_format;
   11.35 -    Uint32 dst_format;
   11.36 -    int modMode;
   11.37 -    int blendMode;
   11.38 -    int scaleMode;
   11.39 -    SDL_RenderCopyFunc func;
   11.40 -} SDL_RenderCopyFuncTable[] = {
   11.41 -    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, 0, 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_RGB888_RGB888_Scale },
   11.42 -    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_RGB888_RGB888_Blend },
   11.43 -    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_RGB888_RGB888_Blend_Scale },
   11.44 -    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, 0,  SDL_RenderCopy_RGB888_RGB888_Modulate },
   11.45 -    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_RGB888_RGB888_Modulate_Scale },
   11.46 -    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_RGB888_RGB888_Modulate_Blend },
   11.47 -    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_RGB888_RGB888_Modulate_Blend_Scale },
   11.48 -    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, 0, 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_RGB888_BGR888_Scale },
   11.49 -    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_RGB888_BGR888_Blend },
   11.50 -    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_RGB888_BGR888_Blend_Scale },
   11.51 -    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, 0,  SDL_RenderCopy_RGB888_BGR888_Modulate },
   11.52 -    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_RGB888_BGR888_Modulate_Scale },
   11.53 -    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_RGB888_BGR888_Modulate_Blend },
   11.54 -    { SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_RGB888_BGR888_Modulate_Blend_Scale },
   11.55 -    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, 0, 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_BGR888_RGB888_Scale },
   11.56 -    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_BGR888_RGB888_Blend },
   11.57 -    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_BGR888_RGB888_Blend_Scale },
   11.58 -    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, 0,  SDL_RenderCopy_BGR888_RGB888_Modulate },
   11.59 -    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_BGR888_RGB888_Modulate_Scale },
   11.60 -    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_BGR888_RGB888_Modulate_Blend },
   11.61 -    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_BGR888_RGB888_Modulate_Blend_Scale },
   11.62 -    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, 0, 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_BGR888_BGR888_Scale },
   11.63 -    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_BGR888_BGR888_Blend },
   11.64 -    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_BGR888_BGR888_Blend_Scale },
   11.65 -    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, 0,  SDL_RenderCopy_BGR888_BGR888_Modulate },
   11.66 -    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_BGR888_BGR888_Modulate_Scale },
   11.67 -    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_BGR888_BGR888_Modulate_Blend },
   11.68 -    { SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_BGR888_BGR888_Modulate_Blend_Scale },
   11.69 -    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, 0, 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_ARGB8888_RGB888_Scale },
   11.70 -    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_ARGB8888_RGB888_Blend },
   11.71 -    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_ARGB8888_RGB888_Blend_Scale },
   11.72 -    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, 0,  SDL_RenderCopy_ARGB8888_RGB888_Modulate },
   11.73 -    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_ARGB8888_RGB888_Modulate_Scale },
   11.74 -    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_ARGB8888_RGB888_Modulate_Blend },
   11.75 -    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_ARGB8888_RGB888_Modulate_Blend_Scale },
   11.76 -    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, 0, 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_ARGB8888_BGR888_Scale },
   11.77 -    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_ARGB8888_BGR888_Blend },
   11.78 -    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_ARGB8888_BGR888_Blend_Scale },
   11.79 -    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, 0,  SDL_RenderCopy_ARGB8888_BGR888_Modulate },
   11.80 -    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_ARGB8888_BGR888_Modulate_Scale },
   11.81 -    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_ARGB8888_BGR888_Modulate_Blend },
   11.82 -    { SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_ARGB8888_BGR888_Modulate_Blend_Scale },
   11.83 -    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, 0, 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_RGBA8888_RGB888_Scale },
   11.84 -    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_RGBA8888_RGB888_Blend },
   11.85 -    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_RGBA8888_RGB888_Blend_Scale },
   11.86 -    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, 0,  SDL_RenderCopy_RGBA8888_RGB888_Modulate },
   11.87 -    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_RGBA8888_RGB888_Modulate_Scale },
   11.88 -    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_RGBA8888_RGB888_Modulate_Blend },
   11.89 -    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_RGBA8888_RGB888_Modulate_Blend_Scale },
   11.90 -    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, 0, 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_RGBA8888_BGR888_Scale },
   11.91 -    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_RGBA8888_BGR888_Blend },
   11.92 -    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_RGBA8888_BGR888_Blend_Scale },
   11.93 -    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, 0,  SDL_RenderCopy_RGBA8888_BGR888_Modulate },
   11.94 -    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_RGBA8888_BGR888_Modulate_Scale },
   11.95 -    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_RGBA8888_BGR888_Modulate_Blend },
   11.96 -    { SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_RGBA8888_BGR888_Modulate_Blend_Scale },
   11.97 -    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, 0, 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_ABGR8888_RGB888_Scale },
   11.98 -    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_ABGR8888_RGB888_Blend },
   11.99 -    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_ABGR8888_RGB888_Blend_Scale },
  11.100 -    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, 0,  SDL_RenderCopy_ABGR8888_RGB888_Modulate },
  11.101 -    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_ABGR8888_RGB888_Modulate_Scale },
  11.102 -    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_ABGR8888_RGB888_Modulate_Blend },
  11.103 -    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_ABGR8888_RGB888_Modulate_Blend_Scale },
  11.104 -    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, 0, 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_ABGR8888_BGR888_Scale },
  11.105 -    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_ABGR8888_BGR888_Blend },
  11.106 -    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_ABGR8888_BGR888_Blend_Scale },
  11.107 -    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, 0,  SDL_RenderCopy_ABGR8888_BGR888_Modulate },
  11.108 -    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_ABGR8888_BGR888_Modulate_Scale },
  11.109 -    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_ABGR8888_BGR888_Modulate_Blend },
  11.110 -    { SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_ABGR8888_BGR888_Modulate_Blend_Scale },
  11.111 -    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, 0, 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_BGRA8888_RGB888_Scale },
  11.112 -    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_BGRA8888_RGB888_Blend },
  11.113 -    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_BGRA8888_RGB888_Blend_Scale },
  11.114 -    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, 0,  SDL_RenderCopy_BGRA8888_RGB888_Modulate },
  11.115 -    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_BGRA8888_RGB888_Modulate_Scale },
  11.116 -    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_BGRA8888_RGB888_Modulate_Blend },
  11.117 -    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGB888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_BGRA8888_RGB888_Modulate_Blend_Scale },
  11.118 -    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, 0, 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_BGRA8888_BGR888_Scale },
  11.119 -    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_BGRA8888_BGR888_Blend },
  11.120 -    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, 0, (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_BGRA8888_BGR888_Blend_Scale },
  11.121 -    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, 0,  SDL_RenderCopy_BGRA8888_BGR888_Modulate },
  11.122 -    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), 0, SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_BGRA8888_BGR888_Modulate_Scale },
  11.123 -    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), 0,  SDL_RenderCopy_BGRA8888_BGR888_Modulate_Blend },
  11.124 -    { SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGR888, (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA), (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD), SDL_TEXTURESCALEMODE_FAST,  SDL_RenderCopy_BGRA8888_BGR888_Modulate_Blend_Scale },
  11.125 -};
  11.126 -
  11.127 -SDL_RenderCopyFunc SDL_GetRenderCopyFunc(Uint32 src_format, Uint32 dst_format, int modMode, int blendMode, int scaleMode)
  11.128 -{
  11.129 -    int i;
  11.130 -
  11.131 -    for (i = 0; i < SDL_arraysize(SDL_RenderCopyFuncTable); ++i) {
  11.132 -        if (src_format != SDL_RenderCopyFuncTable[i].src_format) {
  11.133 -            continue;
  11.134 -        }
  11.135 -        if (dst_format != SDL_RenderCopyFuncTable[i].dst_format) {
  11.136 -            continue;
  11.137 -        }
  11.138 -        if ((modMode & SDL_RenderCopyFuncTable[i].modMode) != modMode) {
  11.139 -            continue;
  11.140 -        }
  11.141 -        if ((blendMode & SDL_RenderCopyFuncTable[i].blendMode) != blendMode) {
  11.142 -            continue;
  11.143 -        }
  11.144 -        if ((scaleMode & SDL_RenderCopyFuncTable[i].scaleMode) != scaleMode) {
  11.145 -            continue;
  11.146 -        }
  11.147 -        return SDL_RenderCopyFuncTable[i].func;
  11.148 -    }
  11.149 -    return NULL;
  11.150 -}
  11.151 -
  11.152 -int SDL_RenderCopy_RGB888_RGB888_Scale(SDL_RenderCopyData *data)
  11.153 -{
  11.154 -    const int flags = data->flags;
  11.155 -    int srcy, srcx;
  11.156 -    int posy, posx;
  11.157 -    int incy, incx;
  11.158 -
  11.159 -    srcy = 0;
  11.160 -    posy = 0;
  11.161 -    incy = (data->src_h << 16) / data->dst_h;
  11.162 -    incx = (data->src_w << 16) / data->dst_w;
  11.163 -
  11.164 -    while (data->dst_h--) {
  11.165 -        Uint32 *src;
  11.166 -        Uint32 *dst = (Uint32 *)data->dst;
  11.167 -        int n = data->dst_w;
  11.168 -        srcx = -1;
  11.169 -        posx = 0x10000L;
  11.170 -        while (posy >= 0x10000L) {
  11.171 -            ++srcy;
  11.172 -            posy -= 0x10000L;
  11.173 -        }
  11.174 -        while (n--) {
  11.175 -            if (posx >= 0x10000L) {
  11.176 -                while (posx >= 0x10000L) {
  11.177 -                    ++srcx;
  11.178 -                    posx -= 0x10000L;
  11.179 -                }
  11.180 -                src = (Uint32 *)(data->src + (srcy * data->src_pitch) + (srcx * 4));
  11.181 -            }
  11.182 -            *dst = *src;
  11.183 -            posx += incx;
  11.184 -            ++dst;
  11.185 -        }
  11.186 -        posy += incy;
  11.187 -        data->dst += data->dst_pitch;
  11.188 -    }
  11.189 -    return 0;
  11.190 -}
  11.191 -
  11.192 -int SDL_RenderCopy_RGB888_RGB888_Blend(SDL_RenderCopyData *data)
  11.193 -{
  11.194 -    const int flags = data->flags;
  11.195 -    Uint32 srcpixel;
  11.196 -    Uint32 srcR, srcG, srcB, srcA;
  11.197 -    Uint32 dstpixel;
  11.198 -    Uint32 dstR, dstG, dstB, dstA;
  11.199 -
  11.200 -    while (data->dst_h--) {
  11.201 -        Uint32 *src = (Uint32 *)data->src;
  11.202 -        Uint32 *dst = (Uint32 *)data->dst;
  11.203 -        int n = data->dst_w;
  11.204 -        while (n--) {
  11.205 -            srcpixel = *src;
  11.206 -            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
  11.207 -            dstpixel = *dst;
  11.208 -            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  11.209 -            if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) {
  11.210 -                /* This goes away if we ever use premultiplied alpha */
  11.211 -                if (srcA < 255) {
  11.212 -                    srcR = (srcR * srcA) / 255;
  11.213 -                    srcG = (srcG * srcA) / 255;
  11.214 -                    srcB = (srcB * srcA) / 255;
  11.215 -                }
  11.216 -            }
  11.217 -            switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) {
  11.218 -            case SDL_RENDERCOPY_MASK:
  11.219 -                if (srcA) {
  11.220 -                    dstR = srcR;
  11.221 -                    dstG = srcG;
  11.222 -                    dstB = srcB;
  11.223 -                }
  11.224 -                break;
  11.225 -            case SDL_RENDERCOPY_BLEND:
  11.226 -                dstR = srcR + ((255 - srcA) * dstR) / 255;
  11.227 -                dstG = srcG + ((255 - srcA) * dstG) / 255;
  11.228 -                dstB = srcB + ((255 - srcA) * dstB) / 255;
  11.229 -                break;
  11.230 -            case SDL_RENDERCOPY_ADD:
  11.231 -                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  11.232 -                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  11.233 -                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  11.234 -                break;
  11.235 -            case SDL_RENDERCOPY_MOD:
  11.236 -                dstR = (srcR * dstR) / 255;
  11.237 -                dstG = (srcG * dstG) / 255;
  11.238 -                dstB = (srcB * dstB) / 255;
  11.239 -                break;
  11.240 -            }
  11.241 -            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  11.242 -            *dst = dstpixel;
  11.243 -            ++src;
  11.244 -            ++dst;
  11.245 -        }
  11.246 -        data->src += data->src_pitch;
  11.247 -        data->dst += data->dst_pitch;
  11.248 -    }
  11.249 -    return 0;
  11.250 -}
  11.251 -
  11.252 -int SDL_RenderCopy_RGB888_RGB888_Blend_Scale(SDL_RenderCopyData *data)
  11.253 -{
  11.254 -    const int flags = data->flags;
  11.255 -    Uint32 srcpixel;
  11.256 -    Uint32 srcR, srcG, srcB, srcA;
  11.257 -    Uint32 dstpixel;
  11.258 -    Uint32 dstR, dstG, dstB, dstA;
  11.259 -    int srcy, srcx;
  11.260 -    int posy, posx;
  11.261 -    int incy, incx;
  11.262 -
  11.263 -    srcy = 0;
  11.264 -    posy = 0;
  11.265 -    incy = (data->src_h << 16) / data->dst_h;
  11.266 -    incx = (data->src_w << 16) / data->dst_w;
  11.267 -
  11.268 -    while (data->dst_h--) {
  11.269 -        Uint32 *src;
  11.270 -        Uint32 *dst = (Uint32 *)data->dst;
  11.271 -        int n = data->dst_w;
  11.272 -        srcx = -1;
  11.273 -        posx = 0x10000L;
  11.274 -        while (posy >= 0x10000L) {
  11.275 -            ++srcy;
  11.276 -            posy -= 0x10000L;
  11.277 -        }
  11.278 -        while (n--) {
  11.279 -            if (posx >= 0x10000L) {
  11.280 -                while (posx >= 0x10000L) {
  11.281 -                    ++srcx;
  11.282 -                    posx -= 0x10000L;
  11.283 -                }
  11.284 -                src = (Uint32 *)(data->src + (srcy * data->src_pitch) + (srcx * 4));
  11.285 -            }
  11.286 -            srcpixel = *src;
  11.287 -            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
  11.288 -            dstpixel = *dst;
  11.289 -            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  11.290 -            if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) {
  11.291 -                /* This goes away if we ever use premultiplied alpha */
  11.292 -                if (srcA < 255) {
  11.293 -                    srcR = (srcR * srcA) / 255;
  11.294 -                    srcG = (srcG * srcA) / 255;
  11.295 -                    srcB = (srcB * srcA) / 255;
  11.296 -                }
  11.297 -            }
  11.298 -            switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) {
  11.299 -            case SDL_RENDERCOPY_MASK:
  11.300 -                if (srcA) {
  11.301 -                    dstR = srcR;
  11.302 -                    dstG = srcG;
  11.303 -                    dstB = srcB;
  11.304 -                }
  11.305 -                break;
  11.306 -            case SDL_RENDERCOPY_BLEND:
  11.307 -                dstR = srcR + ((255 - srcA) * dstR) / 255;
  11.308 -                dstG = srcG + ((255 - srcA) * dstG) / 255;
  11.309 -                dstB = srcB + ((255 - srcA) * dstB) / 255;
  11.310 -                break;
  11.311 -            case SDL_RENDERCOPY_ADD:
  11.312 -                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  11.313 -                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  11.314 -                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  11.315 -                break;
  11.316 -            case SDL_RENDERCOPY_MOD:
  11.317 -                dstR = (srcR * dstR) / 255;
  11.318 -                dstG = (srcG * dstG) / 255;
  11.319 -                dstB = (srcB * dstB) / 255;
  11.320 -                break;
  11.321 -            }
  11.322 -            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  11.323 -            *dst = dstpixel;
  11.324 -            posx += incx;
  11.325 -            ++dst;
  11.326 -        }
  11.327 -        posy += incy;
  11.328 -        data->dst += data->dst_pitch;
  11.329 -    }
  11.330 -    return 0;
  11.331 -}
  11.332 -
  11.333 -int SDL_RenderCopy_RGB888_RGB888_Modulate(SDL_RenderCopyData *data)
  11.334 -{
  11.335 -    const int flags = data->flags;
  11.336 -    const Uint32 modulateR = data->r;
  11.337 -    const Uint32 modulateG = data->g;
  11.338 -    const Uint32 modulateB = data->b;
  11.339 -    const Uint32 modulateA = data->a;
  11.340 -    Uint32 pixel;
  11.341 -    Uint32 R, G, B, A;
  11.342 -
  11.343 -    while (data->dst_h--) {
  11.344 -        Uint32 *src = (Uint32 *)data->src;
  11.345 -        Uint32 *dst = (Uint32 *)data->dst;
  11.346 -        int n = data->dst_w;
  11.347 -        while (n--) {
  11.348 -            pixel = *src;
  11.349 -            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
  11.350 -            if (flags & SDL_RENDERCOPY_MODULATE_COLOR) {
  11.351 -                R = (R * modulateR) / 255;
  11.352 -                G = (G * modulateG) / 255;
  11.353 -                B = (B * modulateB) / 255;
  11.354 -            }
  11.355 -            if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) {
  11.356 -                A = (A * modulateA) / 255;
  11.357 -            }
  11.358 -            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  11.359 -            *dst = pixel;
  11.360 -            ++src;
  11.361 -            ++dst;
  11.362 -        }
  11.363 -        data->src += data->src_pitch;
  11.364 -        data->dst += data->dst_pitch;
  11.365 -    }
  11.366 -    return 0;
  11.367 -}
  11.368 -
  11.369 -int SDL_RenderCopy_RGB888_RGB888_Modulate_Scale(SDL_RenderCopyData *data)
  11.370 -{
  11.371 -    const int flags = data->flags;
  11.372 -    const Uint32 modulateR = data->r;
  11.373 -    const Uint32 modulateG = data->g;
  11.374 -    const Uint32 modulateB = data->b;
  11.375 -    const Uint32 modulateA = data->a;
  11.376 -    Uint32 pixel;
  11.377 -    Uint32 R, G, B, A;
  11.378 -    int srcy, srcx;
  11.379 -    int posy, posx;
  11.380 -    int incy, incx;
  11.381 -
  11.382 -    srcy = 0;
  11.383 -    posy = 0;
  11.384 -    incy = (data->src_h << 16) / data->dst_h;
  11.385 -    incx = (data->src_w << 16) / data->dst_w;
  11.386 -
  11.387 -    while (data->dst_h--) {
  11.388 -        Uint32 *src;
  11.389 -        Uint32 *dst = (Uint32 *)data->dst;
  11.390 -        int n = data->dst_w;
  11.391 -        srcx = -1;
  11.392 -        posx = 0x10000L;
  11.393 -        while (posy >= 0x10000L) {
  11.394 -            ++srcy;
  11.395 -            posy -= 0x10000L;
  11.396 -        }
  11.397 -        while (n--) {
  11.398 -            if (posx >= 0x10000L) {
  11.399 -                while (posx >= 0x10000L) {
  11.400 -                    ++srcx;
  11.401 -                    posx -= 0x10000L;
  11.402 -                }
  11.403 -                src = (Uint32 *)(data->src + (srcy * data->src_pitch) + (srcx * 4));
  11.404 -            }
  11.405 -            pixel = *src;
  11.406 -            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
  11.407 -            if (flags & SDL_RENDERCOPY_MODULATE_COLOR) {
  11.408 -                R = (R * modulateR) / 255;
  11.409 -                G = (G * modulateG) / 255;
  11.410 -                B = (B * modulateB) / 255;
  11.411 -            }
  11.412 -            if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) {
  11.413 -                A = (A * modulateA) / 255;
  11.414 -            }
  11.415 -            pixel = ((Uint32)R << 16) | ((Uint32)G << 8) | B;
  11.416 -            *dst = pixel;
  11.417 -            posx += incx;
  11.418 -            ++dst;
  11.419 -        }
  11.420 -        posy += incy;
  11.421 -        data->dst += data->dst_pitch;
  11.422 -    }
  11.423 -    return 0;
  11.424 -}
  11.425 -
  11.426 -int SDL_RenderCopy_RGB888_RGB888_Modulate_Blend(SDL_RenderCopyData *data)
  11.427 -{
  11.428 -    const int flags = data->flags;
  11.429 -    const Uint32 modulateR = data->r;
  11.430 -    const Uint32 modulateG = data->g;
  11.431 -    const Uint32 modulateB = data->b;
  11.432 -    const Uint32 modulateA = data->a;
  11.433 -    Uint32 srcpixel;
  11.434 -    Uint32 srcR, srcG, srcB, srcA;
  11.435 -    Uint32 dstpixel;
  11.436 -    Uint32 dstR, dstG, dstB, dstA;
  11.437 -
  11.438 -    while (data->dst_h--) {
  11.439 -        Uint32 *src = (Uint32 *)data->src;
  11.440 -        Uint32 *dst = (Uint32 *)data->dst;
  11.441 -        int n = data->dst_w;
  11.442 -        while (n--) {
  11.443 -            srcpixel = *src;
  11.444 -            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
  11.445 -            dstpixel = *dst;
  11.446 -            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  11.447 -            if (flags & SDL_RENDERCOPY_MODULATE_COLOR) {
  11.448 -                srcR = (srcR * modulateR) / 255;
  11.449 -                srcG = (srcG * modulateG) / 255;
  11.450 -                srcB = (srcB * modulateB) / 255;
  11.451 -            }
  11.452 -            if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) {
  11.453 -                srcA = (srcA * modulateA) / 255;
  11.454 -            }
  11.455 -            if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) {
  11.456 -                /* This goes away if we ever use premultiplied alpha */
  11.457 -                if (srcA < 255) {
  11.458 -                    srcR = (srcR * srcA) / 255;
  11.459 -                    srcG = (srcG * srcA) / 255;
  11.460 -                    srcB = (srcB * srcA) / 255;
  11.461 -                }
  11.462 -            }
  11.463 -            switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) {
  11.464 -            case SDL_RENDERCOPY_MASK:
  11.465 -                if (srcA) {
  11.466 -                    dstR = srcR;
  11.467 -                    dstG = srcG;
  11.468 -                    dstB = srcB;
  11.469 -                }
  11.470 -                break;
  11.471 -            case SDL_RENDERCOPY_BLEND:
  11.472 -                dstR = srcR + ((255 - srcA) * dstR) / 255;
  11.473 -                dstG = srcG + ((255 - srcA) * dstG) / 255;
  11.474 -                dstB = srcB + ((255 - srcA) * dstB) / 255;
  11.475 -                break;
  11.476 -            case SDL_RENDERCOPY_ADD:
  11.477 -                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  11.478 -                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  11.479 -                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  11.480 -                break;
  11.481 -            case SDL_RENDERCOPY_MOD:
  11.482 -                dstR = (srcR * dstR) / 255;
  11.483 -                dstG = (srcG * dstG) / 255;
  11.484 -                dstB = (srcB * dstB) / 255;
  11.485 -                break;
  11.486 -            }
  11.487 -            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  11.488 -            *dst = dstpixel;
  11.489 -            ++src;
  11.490 -            ++dst;
  11.491 -        }
  11.492 -        data->src += data->src_pitch;
  11.493 -        data->dst += data->dst_pitch;
  11.494 -    }
  11.495 -    return 0;
  11.496 -}
  11.497 -
  11.498 -int SDL_RenderCopy_RGB888_RGB888_Modulate_Blend_Scale(SDL_RenderCopyData *data)
  11.499 -{
  11.500 -    const int flags = data->flags;
  11.501 -    const Uint32 modulateR = data->r;
  11.502 -    const Uint32 modulateG = data->g;
  11.503 -    const Uint32 modulateB = data->b;
  11.504 -    const Uint32 modulateA = data->a;
  11.505 -    Uint32 srcpixel;
  11.506 -    Uint32 srcR, srcG, srcB, srcA;
  11.507 -    Uint32 dstpixel;
  11.508 -    Uint32 dstR, dstG, dstB, dstA;
  11.509 -    int srcy, srcx;
  11.510 -    int posy, posx;
  11.511 -    int incy, incx;
  11.512 -
  11.513 -    srcy = 0;
  11.514 -    posy = 0;
  11.515 -    incy = (data->src_h << 16) / data->dst_h;
  11.516 -    incx = (data->src_w << 16) / data->dst_w;
  11.517 -
  11.518 -    while (data->dst_h--) {
  11.519 -        Uint32 *src;
  11.520 -        Uint32 *dst = (Uint32 *)data->dst;
  11.521 -        int n = data->dst_w;
  11.522 -        srcx = -1;
  11.523 -        posx = 0x10000L;
  11.524 -        while (posy >= 0x10000L) {
  11.525 -            ++srcy;
  11.526 -            posy -= 0x10000L;
  11.527 -        }
  11.528 -        while (n--) {
  11.529 -            if (posx >= 0x10000L) {
  11.530 -                while (posx >= 0x10000L) {
  11.531 -                    ++srcx;
  11.532 -                    posx -= 0x10000L;
  11.533 -                }
  11.534 -                src = (Uint32 *)(data->src + (srcy * data->src_pitch) + (srcx * 4));
  11.535 -            }
  11.536 -            srcpixel = *src;
  11.537 -            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
  11.538 -            dstpixel = *dst;
  11.539 -            dstR = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstB = (Uint8)dstpixel; dstA = 0xFF;
  11.540 -            if (flags & SDL_RENDERCOPY_MODULATE_COLOR) {
  11.541 -                srcR = (srcR * modulateR) / 255;
  11.542 -                srcG = (srcG * modulateG) / 255;
  11.543 -                srcB = (srcB * modulateB) / 255;
  11.544 -            }
  11.545 -            if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) {
  11.546 -                srcA = (srcA * modulateA) / 255;
  11.547 -            }
  11.548 -            if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) {
  11.549 -                /* This goes away if we ever use premultiplied alpha */
  11.550 -                if (srcA < 255) {
  11.551 -                    srcR = (srcR * srcA) / 255;
  11.552 -                    srcG = (srcG * srcA) / 255;
  11.553 -                    srcB = (srcB * srcA) / 255;
  11.554 -                }
  11.555 -            }
  11.556 -            switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) {
  11.557 -            case SDL_RENDERCOPY_MASK:
  11.558 -                if (srcA) {
  11.559 -                    dstR = srcR;
  11.560 -                    dstG = srcG;
  11.561 -                    dstB = srcB;
  11.562 -                }
  11.563 -                break;
  11.564 -            case SDL_RENDERCOPY_BLEND:
  11.565 -                dstR = srcR + ((255 - srcA) * dstR) / 255;
  11.566 -                dstG = srcG + ((255 - srcA) * dstG) / 255;
  11.567 -                dstB = srcB + ((255 - srcA) * dstB) / 255;
  11.568 -                break;
  11.569 -            case SDL_RENDERCOPY_ADD:
  11.570 -                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  11.571 -                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  11.572 -                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  11.573 -                break;
  11.574 -            case SDL_RENDERCOPY_MOD:
  11.575 -                dstR = (srcR * dstR) / 255;
  11.576 -                dstG = (srcG * dstG) / 255;
  11.577 -                dstB = (srcB * dstB) / 255;
  11.578 -                break;
  11.579 -            }
  11.580 -            dstpixel = ((Uint32)dstR << 16) | ((Uint32)dstG << 8) | dstB;
  11.581 -            *dst = dstpixel;
  11.582 -            posx += incx;
  11.583 -            ++dst;
  11.584 -        }
  11.585 -        posy += incy;
  11.586 -        data->dst += data->dst_pitch;
  11.587 -    }
  11.588 -    return 0;
  11.589 -}
  11.590 -
  11.591 -int SDL_RenderCopy_RGB888_BGR888_Scale(SDL_RenderCopyData *data)
  11.592 -{
  11.593 -    const int flags = data->flags;
  11.594 -    Uint32 pixel;
  11.595 -    Uint32 R, G, B, A;
  11.596 -    int srcy, srcx;
  11.597 -    int posy, posx;
  11.598 -    int incy, incx;
  11.599 -
  11.600 -    srcy = 0;
  11.601 -    posy = 0;
  11.602 -    incy = (data->src_h << 16) / data->dst_h;
  11.603 -    incx = (data->src_w << 16) / data->dst_w;
  11.604 -
  11.605 -    while (data->dst_h--) {
  11.606 -        Uint32 *src;
  11.607 -        Uint32 *dst = (Uint32 *)data->dst;
  11.608 -        int n = data->dst_w;
  11.609 -        srcx = -1;
  11.610 -        posx = 0x10000L;
  11.611 -        while (posy >= 0x10000L) {
  11.612 -            ++srcy;
  11.613 -            posy -= 0x10000L;
  11.614 -        }
  11.615 -        while (n--) {
  11.616 -            if (posx >= 0x10000L) {
  11.617 -                while (posx >= 0x10000L) {
  11.618 -                    ++srcx;
  11.619 -                    posx -= 0x10000L;
  11.620 -                }
  11.621 -                src = (Uint32 *)(data->src + (srcy * data->src_pitch) + (srcx * 4));
  11.622 -            }
  11.623 -            pixel = *src;
  11.624 -            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
  11.625 -            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  11.626 -            *dst = pixel;
  11.627 -            posx += incx;
  11.628 -            ++dst;
  11.629 -        }
  11.630 -        posy += incy;
  11.631 -        data->dst += data->dst_pitch;
  11.632 -    }
  11.633 -    return 0;
  11.634 -}
  11.635 -
  11.636 -int SDL_RenderCopy_RGB888_BGR888_Blend(SDL_RenderCopyData *data)
  11.637 -{
  11.638 -    const int flags = data->flags;
  11.639 -    Uint32 srcpixel;
  11.640 -    Uint32 srcR, srcG, srcB, srcA;
  11.641 -    Uint32 dstpixel;
  11.642 -    Uint32 dstR, dstG, dstB, dstA;
  11.643 -
  11.644 -    while (data->dst_h--) {
  11.645 -        Uint32 *src = (Uint32 *)data->src;
  11.646 -        Uint32 *dst = (Uint32 *)data->dst;
  11.647 -        int n = data->dst_w;
  11.648 -        while (n--) {
  11.649 -            srcpixel = *src;
  11.650 -            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
  11.651 -            dstpixel = *dst;
  11.652 -            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  11.653 -            if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) {
  11.654 -                /* This goes away if we ever use premultiplied alpha */
  11.655 -                if (srcA < 255) {
  11.656 -                    srcR = (srcR * srcA) / 255;
  11.657 -                    srcG = (srcG * srcA) / 255;
  11.658 -                    srcB = (srcB * srcA) / 255;
  11.659 -                }
  11.660 -            }
  11.661 -            switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) {
  11.662 -            case SDL_RENDERCOPY_MASK:
  11.663 -                if (srcA) {
  11.664 -                    dstR = srcR;
  11.665 -                    dstG = srcG;
  11.666 -                    dstB = srcB;
  11.667 -                }
  11.668 -                break;
  11.669 -            case SDL_RENDERCOPY_BLEND:
  11.670 -                dstR = srcR + ((255 - srcA) * dstR) / 255;
  11.671 -                dstG = srcG + ((255 - srcA) * dstG) / 255;
  11.672 -                dstB = srcB + ((255 - srcA) * dstB) / 255;
  11.673 -                break;
  11.674 -            case SDL_RENDERCOPY_ADD:
  11.675 -                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  11.676 -                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  11.677 -                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  11.678 -                break;
  11.679 -            case SDL_RENDERCOPY_MOD:
  11.680 -                dstR = (srcR * dstR) / 255;
  11.681 -                dstG = (srcG * dstG) / 255;
  11.682 -                dstB = (srcB * dstB) / 255;
  11.683 -                break;
  11.684 -            }
  11.685 -            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  11.686 -            *dst = dstpixel;
  11.687 -            ++src;
  11.688 -            ++dst;
  11.689 -        }
  11.690 -        data->src += data->src_pitch;
  11.691 -        data->dst += data->dst_pitch;
  11.692 -    }
  11.693 -    return 0;
  11.694 -}
  11.695 -
  11.696 -int SDL_RenderCopy_RGB888_BGR888_Blend_Scale(SDL_RenderCopyData *data)
  11.697 -{
  11.698 -    const int flags = data->flags;
  11.699 -    Uint32 srcpixel;
  11.700 -    Uint32 srcR, srcG, srcB, srcA;
  11.701 -    Uint32 dstpixel;
  11.702 -    Uint32 dstR, dstG, dstB, dstA;
  11.703 -    int srcy, srcx;
  11.704 -    int posy, posx;
  11.705 -    int incy, incx;
  11.706 -
  11.707 -    srcy = 0;
  11.708 -    posy = 0;
  11.709 -    incy = (data->src_h << 16) / data->dst_h;
  11.710 -    incx = (data->src_w << 16) / data->dst_w;
  11.711 -
  11.712 -    while (data->dst_h--) {
  11.713 -        Uint32 *src;
  11.714 -        Uint32 *dst = (Uint32 *)data->dst;
  11.715 -        int n = data->dst_w;
  11.716 -        srcx = -1;
  11.717 -        posx = 0x10000L;
  11.718 -        while (posy >= 0x10000L) {
  11.719 -            ++srcy;
  11.720 -            posy -= 0x10000L;
  11.721 -        }
  11.722 -        while (n--) {
  11.723 -            if (posx >= 0x10000L) {
  11.724 -                while (posx >= 0x10000L) {
  11.725 -                    ++srcx;
  11.726 -                    posx -= 0x10000L;
  11.727 -                }
  11.728 -                src = (Uint32 *)(data->src + (srcy * data->src_pitch) + (srcx * 4));
  11.729 -            }
  11.730 -            srcpixel = *src;
  11.731 -            srcR = (Uint8)(srcpixel >> 16); srcG = (Uint8)(srcpixel >> 8); srcB = (Uint8)srcpixel; srcA = 0xFF;
  11.732 -            dstpixel = *dst;
  11.733 -            dstB = (Uint8)(dstpixel >> 16); dstG = (Uint8)(dstpixel >> 8); dstR = (Uint8)dstpixel; dstA = 0xFF;
  11.734 -            if (flags & (SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD)) {
  11.735 -                /* This goes away if we ever use premultiplied alpha */
  11.736 -                if (srcA < 255) {
  11.737 -                    srcR = (srcR * srcA) / 255;
  11.738 -                    srcG = (srcG * srcA) / 255;
  11.739 -                    srcB = (srcB * srcA) / 255;
  11.740 -                }
  11.741 -            }
  11.742 -            switch (flags & (SDL_RENDERCOPY_MASK|SDL_RENDERCOPY_BLEND|SDL_RENDERCOPY_ADD|SDL_RENDERCOPY_MOD)) {
  11.743 -            case SDL_RENDERCOPY_MASK:
  11.744 -                if (srcA) {
  11.745 -                    dstR = srcR;
  11.746 -                    dstG = srcG;
  11.747 -                    dstB = srcB;
  11.748 -                }
  11.749 -                break;
  11.750 -            case SDL_RENDERCOPY_BLEND:
  11.751 -                dstR = srcR + ((255 - srcA) * dstR) / 255;
  11.752 -                dstG = srcG + ((255 - srcA) * dstG) / 255;
  11.753 -                dstB = srcB + ((255 - srcA) * dstB) / 255;
  11.754 -                break;
  11.755 -            case SDL_RENDERCOPY_ADD:
  11.756 -                dstR = srcR + dstR; if (dstR > 255) dstR = 255;
  11.757 -                dstG = srcG + dstG; if (dstG > 255) dstG = 255;
  11.758 -                dstB = srcB + dstB; if (dstB > 255) dstB = 255;
  11.759 -                break;
  11.760 -            case SDL_RENDERCOPY_MOD:
  11.761 -                dstR = (srcR * dstR) / 255;
  11.762 -                dstG = (srcG * dstG) / 255;
  11.763 -                dstB = (srcB * dstB) / 255;
  11.764 -                break;
  11.765 -            }
  11.766 -            dstpixel = ((Uint32)dstB << 16) | ((Uint32)dstG << 8) | dstR;
  11.767 -            *dst = dstpixel;
  11.768 -            posx += incx;
  11.769 -            ++dst;
  11.770 -        }
  11.771 -        posy += incy;
  11.772 -        data->dst += data->dst_pitch;
  11.773 -    }
  11.774 -    return 0;
  11.775 -}
  11.776 -
  11.777 -int SDL_RenderCopy_RGB888_BGR888_Modulate(SDL_RenderCopyData *data)
  11.778 -{
  11.779 -    const int flags = data->flags;
  11.780 -    const Uint32 modulateR = data->r;
  11.781 -    const Uint32 modulateG = data->g;
  11.782 -    const Uint32 modulateB = data->b;
  11.783 -    const Uint32 modulateA = data->a;
  11.784 -    Uint32 pixel;
  11.785 -    Uint32 R, G, B, A;
  11.786 -
  11.787 -    while (data->dst_h--) {
  11.788 -        Uint32 *src = (Uint32 *)data->src;
  11.789 -        Uint32 *dst = (Uint32 *)data->dst;
  11.790 -        int n = data->dst_w;
  11.791 -        while (n--) {
  11.792 -            pixel = *src;
  11.793 -            R = (Uint8)(pixel >> 16); G = (Uint8)(pixel >> 8); B = (Uint8)pixel; A = 0xFF;
  11.794 -            if (flags & SDL_RENDERCOPY_MODULATE_COLOR) {
  11.795 -                R = (R * modulateR) / 255;
  11.796 -                G = (G * modulateG) / 255;
  11.797 -                B = (B * modulateB) / 255;
  11.798 -            }
  11.799 -            if (flags & SDL_RENDERCOPY_MODULATE_ALPHA) {
  11.800 -                A = (A * modulateA) / 255;
  11.801 -            }
  11.802 -            pixel = ((Uint32)B << 16) | ((Uint32)G << 8) | R;
  11.803 -            *dst = pixel;
  11.804 -            ++src;
  11.805 -            ++dst;
  11.806 -        }
  11.807 -        data->src += data->src_pitch;
  11.808 -        data->dst += data->dst_pitch;
  11.809 -    }
  11.810 -    return 0;
  11.811 -}
  11.812 -
  11.813 -int SDL_RenderCopy_RGB888_BGR888_Modulate_Scale(SDL_RenderCopyData *data)
  11.814 -{
  11.815 -    const int flags = data->flags;
  11.816 -    const Uint32 modulateR = data->r;
  11.817 -    const Uint32 modulateG = data->g;
  11.818 -    const Uint32 modulateB = data->b;
  11.819 -    const Uint32 modulateA = data->a;
  11.820 -    Uint32 pixel;
  11.821 -    Uint32 R, G, B, A;
  11.822 -    int srcy, srcx;
  11.823 -    int posy, posx;
  11.824 -    int incy, incx;
  11.825 -
  11.826 -    srcy = 0;
  11.827 -    posy = 0;
  11.828 -    incy = (data->src_h << 16) / data->dst_h;
  11.829 -    incx = (data->src_w << 16) / data->dst_w;
  11.830 -
  11.831 -    while (data->dst_h--) {
  11.832 -        Uint32 *src;
  11.833 -        Uint32 *dst = (Uint32 *)data->dst;
  11.834 -        int n = data->dst_w;
  11.835 -        srcx = -1;
  11.836 -        posx = 0x10000L;
  11.837 -        while (posy >= 0x10000L) {
  11.838 -            ++srcy;
  11.839 -            posy -= 0x10000L;