src/video/SDL_blit_A.c
changeset 2267 c785543d1843
parent 2262 bee005ace1bf
child 2291 dc3dd3a0bf02
     1.1 --- a/src/video/SDL_blit_A.c	Sat Aug 18 01:44:21 2007 +0000
     1.2 +++ b/src/video/SDL_blit_A.c	Sat Aug 18 05:39:09 2007 +0000
     1.3 @@ -33,15 +33,15 @@
     1.4      int width = info->dst_w;
     1.5      int height = info->dst_h;
     1.6      Uint8 *src = info->src;
     1.7 -    int srcskip = info->s_skip;
     1.8 +    int srcskip = info->src_skip;
     1.9      Uint8 *dst = info->dst;
    1.10 -    int dstskip = info->dst_pitch;
    1.11 +    int dstskip = info->dst_skip;
    1.12      Uint8 *palmap = info->table;
    1.13 -    SDL_PixelFormat *srcfmt = info->src;
    1.14 -    SDL_PixelFormat *dstfmt = info->dst;
    1.15 +    SDL_PixelFormat *srcfmt = info->src_fmt;
    1.16 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
    1.17      int srcbpp = srcfmt->BytesPerPixel;
    1.18  
    1.19 -    const unsigned A = (info->cmod >> 24);
    1.20 +    const unsigned A = info->a;
    1.21  
    1.22      while (height--) {
    1.23  	    /* *INDENT-OFF* */
    1.24 @@ -89,12 +89,12 @@
    1.25      int width = info->dst_w;
    1.26      int height = info->dst_h;
    1.27      Uint8 *src = info->src;
    1.28 -    int srcskip = info->s_skip;
    1.29 +    int srcskip = info->src_skip;
    1.30      Uint8 *dst = info->dst;
    1.31 -    int dstskip = info->dst_pitch;
    1.32 +    int dstskip = info->dst_skip;
    1.33      Uint8 *palmap = info->table;
    1.34 -    SDL_PixelFormat *srcfmt = info->src;
    1.35 -    SDL_PixelFormat *dstfmt = info->dst;
    1.36 +    SDL_PixelFormat *srcfmt = info->src_fmt;
    1.37 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
    1.38      int srcbpp = srcfmt->BytesPerPixel;
    1.39  
    1.40      /* FIXME: fix alpha bit field expansion here too? */
    1.41 @@ -145,16 +145,16 @@
    1.42      int width = info->dst_w;
    1.43      int height = info->dst_h;
    1.44      Uint8 *src = info->src;
    1.45 -    int srcskip = info->s_skip;
    1.46 +    int srcskip = info->src_skip;
    1.47      Uint8 *dst = info->dst;
    1.48 -    int dstskip = info->dst_pitch;
    1.49 +    int dstskip = info->dst_skip;
    1.50      Uint8 *palmap = info->table;
    1.51 -    SDL_PixelFormat *srcfmt = info->src;
    1.52 -    SDL_PixelFormat *dstfmt = info->dst;
    1.53 +    SDL_PixelFormat *srcfmt = info->src_fmt;
    1.54 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
    1.55      int srcbpp = srcfmt->BytesPerPixel;
    1.56 -    Uint32 ckey = info->ckey;
    1.57 +    Uint32 ckey = info->colorkey;
    1.58  
    1.59 -    const int A = (info->cmod >> 24);
    1.60 +    const int A = info->a;
    1.61  
    1.62      while (height--) {
    1.63  	    /* *INDENT-OFF* */
    1.64 @@ -206,10 +206,10 @@
    1.65      int width = info->dst_w;
    1.66      int height = info->dst_h;
    1.67      Uint32 *srcp = (Uint32 *) info->src;
    1.68 -    int srcskip = info->s_skip >> 2;
    1.69 +    int srcskip = info->src_skip >> 2;
    1.70      Uint32 *dstp = (Uint32 *) info->dst;
    1.71 -    int dstskip = info->dst_pitch >> 2;
    1.72 -    Uint32 dalpha = info->dst->Amask;
    1.73 +    int dstskip = info->dst_skip >> 2;
    1.74 +    Uint32 dalpha = info->dst_fmt->Amask;
    1.75  
    1.76      __m64 src1, src2, dst1, dst2, lmask, hmask, dsta;
    1.77  
    1.78 @@ -259,9 +259,9 @@
    1.79  static void
    1.80  BlitRGBtoRGBSurfaceAlphaMMX(SDL_BlitInfo * info)
    1.81  {
    1.82 -    SDL_PixelFormat *df = info->dst;
    1.83 +    SDL_PixelFormat *df = info->dst_fmt;
    1.84      Uint32 chanmask = df->Rmask | df->Gmask | df->Bmask;
    1.85 -    unsigned alpha = (info->cmod >> 24);
    1.86 +    unsigned alpha = info->a;
    1.87  
    1.88      if (alpha == 128 && (df->Rmask | df->Gmask | df->Bmask) == 0x00FFFFFF) {
    1.89          /* only call a128 version when R,G,B occupy lower bits */
    1.90 @@ -270,9 +270,9 @@
    1.91          int width = info->dst_w;
    1.92          int height = info->dst_h;
    1.93          Uint32 *srcp = (Uint32 *) info->src;
    1.94 -        int srcskip = info->s_skip >> 2;
    1.95 +        int srcskip = info->src_skip >> 2;
    1.96          Uint32 *dstp = (Uint32 *) info->dst;
    1.97 -        int dstskip = info->dst_pitch >> 2;
    1.98 +        int dstskip = info->dst_skip >> 2;
    1.99          Uint32 dalpha = df->Amask;
   1.100          Uint32 amult;
   1.101  
   1.102 @@ -359,10 +359,10 @@
   1.103      int width = info->dst_w;
   1.104      int height = info->dst_h;
   1.105      Uint32 *srcp = (Uint32 *) info->src;
   1.106 -    int srcskip = info->s_skip >> 2;
   1.107 +    int srcskip = info->src_skip >> 2;
   1.108      Uint32 *dstp = (Uint32 *) info->dst;
   1.109 -    int dstskip = info->dst_pitch >> 2;
   1.110 -    SDL_PixelFormat *sf = info->src;
   1.111 +    int dstskip = info->dst_skip >> 2;
   1.112 +    SDL_PixelFormat *sf = info->src_fmt;
   1.113      Uint32 chanmask = sf->Rmask | sf->Gmask | sf->Bmask;
   1.114      Uint32 amask = sf->Amask;
   1.115      Uint32 ashift = sf->Ashift;
   1.116 @@ -544,10 +544,10 @@
   1.117  {
   1.118      int height = info->dst_h;
   1.119      Uint8 *src = (Uint8 *) info->src;
   1.120 -    int srcskip = info->s_skip;
   1.121 +    int srcskip = info->src_skip;
   1.122      Uint8 *dst = (Uint8 *) info->dst;
   1.123 -    int dstskip = info->dst_pitch;
   1.124 -    SDL_PixelFormat *srcfmt = info->src;
   1.125 +    int dstskip = info->dst_skip;
   1.126 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   1.127  
   1.128      vector unsigned char v0 = vec_splat_u8(0);
   1.129      vector unsigned short v8_16 = vec_splat_u16(8);
   1.130 @@ -720,15 +720,15 @@
   1.131  {
   1.132      int height = info->dst_h;
   1.133      Uint32 *srcp = (Uint32 *) info->src;
   1.134 -    int srcskip = info->s_skip >> 2;
   1.135 +    int srcskip = info->src_skip >> 2;
   1.136      Uint32 *dstp = (Uint32 *) info->dst;
   1.137 -    int dstskip = info->dst_pitch >> 2;
   1.138 -    SDL_PixelFormat *srcfmt = info->src;
   1.139 -    SDL_PixelFormat *dstfmt = info->dst;
   1.140 -    unsigned sA = (info->cmod >> 24);
   1.141 +    int dstskip = info->dst_skip >> 2;
   1.142 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   1.143 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   1.144 +    unsigned sA = info->a;
   1.145      unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
   1.146      Uint32 rgbmask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
   1.147 -    Uint32 ckey = info->ckey;
   1.148 +    Uint32 ckey = info->colorkey;
   1.149      vector unsigned char mergePermute;
   1.150      vector unsigned char vsrcPermute;
   1.151      vector unsigned char vdstPermute;
   1.152 @@ -847,11 +847,11 @@
   1.153      int width = info->dst_w;
   1.154      int height = info->dst_h;
   1.155      Uint32 *srcp = (Uint32 *) info->src;
   1.156 -    int srcskip = info->s_skip >> 2;
   1.157 +    int srcskip = info->src_skip >> 2;
   1.158      Uint32 *dstp = (Uint32 *) info->dst;
   1.159 -    int dstskip = info->dst_pitch >> 2;
   1.160 -    SDL_PixelFormat *srcfmt = info->src;
   1.161 -    SDL_PixelFormat *dstfmt = info->dst;
   1.162 +    int dstskip = info->dst_skip >> 2;
   1.163 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   1.164 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   1.165      vector unsigned char mergePermute;
   1.166      vector unsigned char valphaPermute;
   1.167      vector unsigned char vsrcPermute;
   1.168 @@ -945,9 +945,9 @@
   1.169      int width = info->dst_w;
   1.170      int height = info->dst_h;
   1.171      Uint32 *srcp = (Uint32 *) info->src;
   1.172 -    int srcskip = info->s_skip >> 2;
   1.173 +    int srcskip = info->src_skip >> 2;
   1.174      Uint32 *dstp = (Uint32 *) info->dst;
   1.175 -    int dstskip = info->dst_pitch >> 2;
   1.176 +    int dstskip = info->dst_skip >> 2;
   1.177      vector unsigned char mergePermute;
   1.178      vector unsigned char valphaPermute;
   1.179      vector unsigned char valphamask;
   1.180 @@ -1042,12 +1042,12 @@
   1.181      /* XXX : 6 */
   1.182      int height = info->dst_h;
   1.183      Uint32 *srcp = (Uint32 *) info->src;
   1.184 -    int srcskip = info->s_skip >> 2;
   1.185 +    int srcskip = info->src_skip >> 2;
   1.186      Uint32 *dstp = (Uint32 *) info->dst;
   1.187 -    int dstskip = info->dst_pitch >> 2;
   1.188 -    SDL_PixelFormat *srcfmt = info->src;
   1.189 -    SDL_PixelFormat *dstfmt = info->dst;
   1.190 -    unsigned sA = (info->cmod >> 24);
   1.191 +    int dstskip = info->dst_skip >> 2;
   1.192 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   1.193 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   1.194 +    unsigned sA = info->a;
   1.195      unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
   1.196      vector unsigned char mergePermute;
   1.197      vector unsigned char vsrcPermute;
   1.198 @@ -1136,12 +1136,12 @@
   1.199  static void
   1.200  BlitRGBtoRGBSurfaceAlphaAltivec(SDL_BlitInfo * info)
   1.201  {
   1.202 -    unsigned alpha = (info->cmod >> 24);
   1.203 +    unsigned alpha = info->a;
   1.204      int height = info->dst_h;
   1.205      Uint32 *srcp = (Uint32 *) info->src;
   1.206 -    int srcskip = info->s_skip >> 2;
   1.207 +    int srcskip = info->src_skip >> 2;
   1.208      Uint32 *dstp = (Uint32 *) info->dst;
   1.209 -    int dstskip = info->dst_pitch >> 2;
   1.210 +    int dstskip = info->dst_skip >> 2;
   1.211      vector unsigned char mergePermute;
   1.212      vector unsigned char valpha;
   1.213      vector unsigned char valphamask;
   1.214 @@ -1227,9 +1227,9 @@
   1.215      int width = info->dst_w;
   1.216      int height = info->dst_h;
   1.217      Uint32 *srcp = (Uint32 *) info->src;
   1.218 -    int srcskip = info->s_skip >> 2;
   1.219 +    int srcskip = info->src_skip >> 2;
   1.220      Uint32 *dstp = (Uint32 *) info->dst;
   1.221 -    int dstskip = info->dst_pitch >> 2;
   1.222 +    int dstskip = info->dst_skip >> 2;
   1.223  
   1.224      while (height--) {
   1.225  	    /* *INDENT-OFF* */
   1.226 @@ -1249,16 +1249,16 @@
   1.227  static void
   1.228  BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo * info)
   1.229  {
   1.230 -    unsigned alpha = (info->cmod >> 24);
   1.231 +    unsigned alpha = info->a;
   1.232      if (alpha == 128) {
   1.233          BlitRGBtoRGBSurfaceAlpha128(info);
   1.234      } else {
   1.235          int width = info->dst_w;
   1.236          int height = info->dst_h;
   1.237          Uint32 *srcp = (Uint32 *) info->src;
   1.238 -        int srcskip = info->s_skip >> 2;
   1.239 +        int srcskip = info->src_skip >> 2;
   1.240          Uint32 *dstp = (Uint32 *) info->dst;
   1.241 -        int dstskip = info->dst_pitch >> 2;
   1.242 +        int dstskip = info->dst_skip >> 2;
   1.243          Uint32 s;
   1.244          Uint32 d;
   1.245          Uint32 s1;
   1.246 @@ -1324,9 +1324,9 @@
   1.247      int width = info->dst_w;
   1.248      int height = info->dst_h;
   1.249      Uint32 *srcp = (Uint32 *) info->src;
   1.250 -    int srcskip = info->s_skip >> 2;
   1.251 +    int srcskip = info->src_skip >> 2;
   1.252      Uint32 *dstp = (Uint32 *) info->dst;
   1.253 -    int dstskip = info->dst_pitch >> 2;
   1.254 +    int dstskip = info->dst_skip >> 2;
   1.255  
   1.256      while (height--) {
   1.257  	    /* *INDENT-OFF* */
   1.258 @@ -1377,10 +1377,10 @@
   1.259      int width = info->dst_w;
   1.260      int height = info->dst_h;
   1.261      Uint32 *srcp = (Uint32 *) info->src;
   1.262 -    int srcskip = info->s_skip >> 2;
   1.263 +    int srcskip = info->src_skip >> 2;
   1.264      Uint32 *dstp = (Uint32 *) info->dst;
   1.265 -    int dstskip = info->dst_pitch >> 2;
   1.266 -    SDL_PixelFormat *sf = info->src;
   1.267 +    int dstskip = info->dst_skip >> 2;
   1.268 +    SDL_PixelFormat *sf = info->src_fmt;
   1.269      Uint32 chanmask = sf->Rmask | sf->Gmask | sf->Bmask;
   1.270      Uint32 amask = sf->Amask;
   1.271      Uint32 ashift = sf->Ashift;
   1.272 @@ -1459,9 +1459,9 @@
   1.273      int width = info->dst_w;
   1.274      int height = info->dst_h;
   1.275      Uint16 *srcp = (Uint16 *) info->src;
   1.276 -    int srcskip = info->s_skip >> 1;
   1.277 +    int srcskip = info->src_skip >> 1;
   1.278      Uint16 *dstp = (Uint16 *) info->dst;
   1.279 -    int dstskip = info->dst_pitch >> 1;
   1.280 +    int dstskip = info->dst_skip >> 1;
   1.281  
   1.282      while (height--) {
   1.283          if (((uintptr_t) srcp ^ (uintptr_t) dstp) & 2) {
   1.284 @@ -1558,16 +1558,16 @@
   1.285  static void
   1.286  Blit565to565SurfaceAlphaMMX(SDL_BlitInfo * info)
   1.287  {
   1.288 -    unsigned alpha = (info->cmod >> 24);
   1.289 +    unsigned alpha = info->a;
   1.290      if (alpha == 128) {
   1.291          Blit16to16SurfaceAlpha128(info, 0xf7de);
   1.292      } else {
   1.293          int width = info->dst_w;
   1.294          int height = info->dst_h;
   1.295          Uint16 *srcp = (Uint16 *) info->src;
   1.296 -        int srcskip = info->s_skip >> 1;
   1.297 +        int srcskip = info->src_skip >> 1;
   1.298          Uint16 *dstp = (Uint16 *) info->dst;
   1.299 -        int dstskip = info->dst_pitch >> 1;
   1.300 +        int dstskip = info->dst_skip >> 1;
   1.301          Uint32 s, d;
   1.302  
   1.303          __m64 src1, dst1, src2, dst2, gmask, bmask, mm_res, mm_alpha;
   1.304 @@ -1695,16 +1695,16 @@
   1.305  static void
   1.306  Blit555to555SurfaceAlphaMMX(SDL_BlitInfo * info)
   1.307  {
   1.308 -    unsigned alpha = (info->cmod >> 24);
   1.309 +    unsigned alpha = info->a;
   1.310      if (alpha == 128) {
   1.311          Blit16to16SurfaceAlpha128(info, 0xfbde);
   1.312      } else {
   1.313          int width = info->dst_w;
   1.314          int height = info->dst_h;
   1.315          Uint16 *srcp = (Uint16 *) info->src;
   1.316 -        int srcskip = info->s_skip >> 1;
   1.317 +        int srcskip = info->src_skip >> 1;
   1.318          Uint16 *dstp = (Uint16 *) info->dst;
   1.319 -        int dstskip = info->dst_pitch >> 1;
   1.320 +        int dstskip = info->dst_skip >> 1;
   1.321          Uint32 s, d;
   1.322  
   1.323          __m64 src1, dst1, src2, dst2, rmask, gmask, bmask, mm_res, mm_alpha;
   1.324 @@ -1835,16 +1835,16 @@
   1.325  static void
   1.326  Blit565to565SurfaceAlpha(SDL_BlitInfo * info)
   1.327  {
   1.328 -    unsigned alpha = (info->cmod >> 24);
   1.329 +    unsigned alpha = info->a;
   1.330      if (alpha == 128) {
   1.331          Blit16to16SurfaceAlpha128(info, 0xf7de);
   1.332      } else {
   1.333          int width = info->dst_w;
   1.334          int height = info->dst_h;
   1.335          Uint16 *srcp = (Uint16 *) info->src;
   1.336 -        int srcskip = info->s_skip >> 1;
   1.337 +        int srcskip = info->src_skip >> 1;
   1.338          Uint16 *dstp = (Uint16 *) info->dst;
   1.339 -        int dstskip = info->dst_pitch >> 1;
   1.340 +        int dstskip = info->dst_skip >> 1;
   1.341          alpha >>= 3;            /* downscale alpha to 5 bits */
   1.342  
   1.343          while (height--) {
   1.344 @@ -1874,16 +1874,16 @@
   1.345  static void
   1.346  Blit555to555SurfaceAlpha(SDL_BlitInfo * info)
   1.347  {
   1.348 -    unsigned alpha = (info->cmod >> 24);        /* downscale alpha to 5 bits */
   1.349 +    unsigned alpha = info->a;   /* downscale alpha to 5 bits */
   1.350      if (alpha == 128) {
   1.351          Blit16to16SurfaceAlpha128(info, 0xfbde);
   1.352      } else {
   1.353          int width = info->dst_w;
   1.354          int height = info->dst_h;
   1.355          Uint16 *srcp = (Uint16 *) info->src;
   1.356 -        int srcskip = info->s_skip >> 1;
   1.357 +        int srcskip = info->src_skip >> 1;
   1.358          Uint16 *dstp = (Uint16 *) info->dst;
   1.359 -        int dstskip = info->dst_pitch >> 1;
   1.360 +        int dstskip = info->dst_skip >> 1;
   1.361          alpha >>= 3;            /* downscale alpha to 5 bits */
   1.362  
   1.363          while (height--) {
   1.364 @@ -1916,9 +1916,9 @@
   1.365      int width = info->dst_w;
   1.366      int height = info->dst_h;
   1.367      Uint32 *srcp = (Uint32 *) info->src;
   1.368 -    int srcskip = info->s_skip >> 2;
   1.369 +    int srcskip = info->src_skip >> 2;
   1.370      Uint16 *dstp = (Uint16 *) info->dst;
   1.371 -    int dstskip = info->dst_pitch >> 1;
   1.372 +    int dstskip = info->dst_skip >> 1;
   1.373  
   1.374      while (height--) {
   1.375  	    /* *INDENT-OFF* */
   1.376 @@ -1962,9 +1962,9 @@
   1.377      int width = info->dst_w;
   1.378      int height = info->dst_h;
   1.379      Uint32 *srcp = (Uint32 *) info->src;
   1.380 -    int srcskip = info->s_skip >> 2;
   1.381 +    int srcskip = info->src_skip >> 2;
   1.382      Uint16 *dstp = (Uint16 *) info->dst;
   1.383 -    int dstskip = info->dst_pitch >> 1;
   1.384 +    int dstskip = info->dst_skip >> 1;
   1.385  
   1.386      while (height--) {
   1.387  	    /* *INDENT-OFF* */
   1.388 @@ -2009,14 +2009,14 @@
   1.389      int width = info->dst_w;
   1.390      int height = info->dst_h;
   1.391      Uint8 *src = info->src;
   1.392 -    int srcskip = info->s_skip;
   1.393 +    int srcskip = info->src_skip;
   1.394      Uint8 *dst = info->dst;
   1.395 -    int dstskip = info->dst_pitch;
   1.396 -    SDL_PixelFormat *srcfmt = info->src;
   1.397 -    SDL_PixelFormat *dstfmt = info->dst;
   1.398 +    int dstskip = info->dst_skip;
   1.399 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   1.400 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   1.401      int srcbpp = srcfmt->BytesPerPixel;
   1.402      int dstbpp = dstfmt->BytesPerPixel;
   1.403 -    unsigned sA = (info->cmod >> 24);
   1.404 +    unsigned sA = info->a;
   1.405      unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
   1.406  
   1.407      if (sA) {
   1.408 @@ -2053,15 +2053,15 @@
   1.409      int width = info->dst_w;
   1.410      int height = info->dst_h;
   1.411      Uint8 *src = info->src;
   1.412 -    int srcskip = info->s_skip;
   1.413 +    int srcskip = info->src_skip;
   1.414      Uint8 *dst = info->dst;
   1.415 -    int dstskip = info->dst_pitch;
   1.416 -    SDL_PixelFormat *srcfmt = info->src;
   1.417 -    SDL_PixelFormat *dstfmt = info->dst;
   1.418 -    Uint32 ckey = info->ckey;
   1.419 +    int dstskip = info->dst_skip;
   1.420 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   1.421 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   1.422 +    Uint32 ckey = info->colorkey;
   1.423      int srcbpp = srcfmt->BytesPerPixel;
   1.424      int dstbpp = dstfmt->BytesPerPixel;
   1.425 -    unsigned sA = (info->cmod >> 24);
   1.426 +    unsigned sA = info->a;
   1.427      unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
   1.428  
   1.429      while (height--) {
   1.430 @@ -2099,11 +2099,11 @@
   1.431      int width = info->dst_w;
   1.432      int height = info->dst_h;
   1.433      Uint8 *src = info->src;
   1.434 -    int srcskip = info->s_skip;
   1.435 +    int srcskip = info->src_skip;
   1.436      Uint8 *dst = info->dst;
   1.437 -    int dstskip = info->dst_pitch;
   1.438 -    SDL_PixelFormat *srcfmt = info->src;
   1.439 -    SDL_PixelFormat *dstfmt = info->dst;
   1.440 +    int dstskip = info->dst_skip;
   1.441 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   1.442 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   1.443  
   1.444      int srcbpp;
   1.445      int dstbpp;
   1.446 @@ -2147,81 +2147,14 @@
   1.447  }
   1.448  
   1.449  
   1.450 -SDL_loblit
   1.451 -SDL_CalculateAlphaBlit(SDL_Surface * surface, int blit_index)
   1.452 +SDL_BlitFunc
   1.453 +SDL_CalculateBlitA(SDL_Surface * surface)
   1.454  {
   1.455      SDL_PixelFormat *sf = surface->format;
   1.456      SDL_PixelFormat *df = surface->map->dst->format;
   1.457  
   1.458 -    if (sf->Amask == 0) {
   1.459 -        if ((surface->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) {
   1.460 -            if (df->BytesPerPixel == 1)
   1.461 -                return BlitNto1SurfaceAlphaKey;
   1.462 -            else
   1.463 -#if SDL_ALTIVEC_BLITTERS
   1.464 -            if (sf->BytesPerPixel == 4 && df->BytesPerPixel == 4 &&
   1.465 -                    SDL_HasAltiVec())
   1.466 -                return Blit32to32SurfaceAlphaKeyAltivec;
   1.467 -            else
   1.468 -#endif
   1.469 -                return BlitNtoNSurfaceAlphaKey;
   1.470 -        } else {
   1.471 -            /* Per-surface alpha blits */
   1.472 -            switch (df->BytesPerPixel) {
   1.473 -            case 1:
   1.474 -                return BlitNto1SurfaceAlpha;
   1.475 -
   1.476 -            case 2:
   1.477 -                if (surface->map->identity) {
   1.478 -                    if (df->Gmask == 0x7e0) {
   1.479 -#ifdef __MMX__
   1.480 -                        if (SDL_HasMMX())
   1.481 -                            return Blit565to565SurfaceAlphaMMX;
   1.482 -                        else
   1.483 -#endif
   1.484 -                            return Blit565to565SurfaceAlpha;
   1.485 -                    } else if (df->Gmask == 0x3e0) {
   1.486 -#ifdef __MMX__
   1.487 -                        if (SDL_HasMMX())
   1.488 -                            return Blit555to555SurfaceAlphaMMX;
   1.489 -                        else
   1.490 -#endif
   1.491 -                            return Blit555to555SurfaceAlpha;
   1.492 -                    }
   1.493 -                }
   1.494 -                return BlitNtoNSurfaceAlpha;
   1.495 -
   1.496 -            case 4:
   1.497 -                if (sf->Rmask == df->Rmask
   1.498 -                    && sf->Gmask == df->Gmask
   1.499 -                    && sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
   1.500 -#ifdef __MMX__
   1.501 -                    if (sf->Rshift % 8 == 0
   1.502 -                        && sf->Gshift % 8 == 0
   1.503 -                        && sf->Bshift % 8 == 0 && SDL_HasMMX())
   1.504 -                        return BlitRGBtoRGBSurfaceAlphaMMX;
   1.505 -#endif
   1.506 -                    if ((sf->Rmask | sf->Gmask | sf->Bmask) == 0xffffff) {
   1.507 -#if SDL_ALTIVEC_BLITTERS
   1.508 -                        if (SDL_HasAltiVec())
   1.509 -                            return BlitRGBtoRGBSurfaceAlphaAltivec;
   1.510 -#endif
   1.511 -                        return BlitRGBtoRGBSurfaceAlpha;
   1.512 -                    }
   1.513 -                }
   1.514 -#if SDL_ALTIVEC_BLITTERS
   1.515 -                if ((sf->BytesPerPixel == 4) && SDL_HasAltiVec())
   1.516 -                    return Blit32to32SurfaceAlphaAltivec;
   1.517 -                else
   1.518 -#endif
   1.519 -                    return BlitNtoNSurfaceAlpha;
   1.520 -
   1.521 -            case 3:
   1.522 -            default:
   1.523 -                return BlitNtoNSurfaceAlpha;
   1.524 -            }
   1.525 -        }
   1.526 -    } else {
   1.527 +    switch (surface->map->info.flags) {
   1.528 +    case SDL_COPY_BLEND:
   1.529          /* Per-pixel alpha blits */
   1.530          switch (df->BytesPerPixel) {
   1.531          case 1:
   1.532 @@ -2284,7 +2217,84 @@
   1.533          default:
   1.534              return BlitNtoNPixelAlpha;
   1.535          }
   1.536 +        break;
   1.537 +
   1.538 +    case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
   1.539 +        if (sf->Amask == 0) {
   1.540 +            /* Per-surface alpha blits */
   1.541 +            switch (df->BytesPerPixel) {
   1.542 +            case 1:
   1.543 +                return BlitNto1SurfaceAlpha;
   1.544 +
   1.545 +            case 2:
   1.546 +                if (surface->map->identity) {
   1.547 +                    if (df->Gmask == 0x7e0) {
   1.548 +#ifdef __MMX__
   1.549 +                        if (SDL_HasMMX())
   1.550 +                            return Blit565to565SurfaceAlphaMMX;
   1.551 +                        else
   1.552 +#endif
   1.553 +                            return Blit565to565SurfaceAlpha;
   1.554 +                    } else if (df->Gmask == 0x3e0) {
   1.555 +#ifdef __MMX__
   1.556 +                        if (SDL_HasMMX())
   1.557 +                            return Blit555to555SurfaceAlphaMMX;
   1.558 +                        else
   1.559 +#endif
   1.560 +                            return Blit555to555SurfaceAlpha;
   1.561 +                    }
   1.562 +                }
   1.563 +                return BlitNtoNSurfaceAlpha;
   1.564 +
   1.565 +            case 4:
   1.566 +                if (sf->Rmask == df->Rmask
   1.567 +                    && sf->Gmask == df->Gmask
   1.568 +                    && sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
   1.569 +#ifdef __MMX__
   1.570 +                    if (sf->Rshift % 8 == 0
   1.571 +                        && sf->Gshift % 8 == 0
   1.572 +                        && sf->Bshift % 8 == 0 && SDL_HasMMX())
   1.573 +                        return BlitRGBtoRGBSurfaceAlphaMMX;
   1.574 +#endif
   1.575 +                    if ((sf->Rmask | sf->Gmask | sf->Bmask) == 0xffffff) {
   1.576 +#if SDL_ALTIVEC_BLITTERS
   1.577 +                        if (SDL_HasAltiVec())
   1.578 +                            return BlitRGBtoRGBSurfaceAlphaAltivec;
   1.579 +#endif
   1.580 +                        return BlitRGBtoRGBSurfaceAlpha;
   1.581 +                    }
   1.582 +                }
   1.583 +#if SDL_ALTIVEC_BLITTERS
   1.584 +                if ((sf->BytesPerPixel == 4) && SDL_HasAltiVec())
   1.585 +                    return Blit32to32SurfaceAlphaAltivec;
   1.586 +                else
   1.587 +#endif
   1.588 +                    return BlitNtoNSurfaceAlpha;
   1.589 +
   1.590 +            case 3:
   1.591 +            default:
   1.592 +                return BlitNtoNSurfaceAlpha;
   1.593 +            }
   1.594 +        }
   1.595 +        break;
   1.596 +
   1.597 +    case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
   1.598 +        if (sf->Amask == 0) {
   1.599 +            if (df->BytesPerPixel == 1)
   1.600 +                return BlitNto1SurfaceAlphaKey;
   1.601 +            else
   1.602 +#if SDL_ALTIVEC_BLITTERS
   1.603 +            if (sf->BytesPerPixel == 4 && df->BytesPerPixel == 4 &&
   1.604 +                    SDL_HasAltiVec())
   1.605 +                return Blit32to32SurfaceAlphaKeyAltivec;
   1.606 +            else
   1.607 +#endif
   1.608 +                return BlitNtoNSurfaceAlphaKey;
   1.609 +        }
   1.610 +        break;
   1.611      }
   1.612 +
   1.613 +    return NULL;
   1.614  }
   1.615  
   1.616  /* vi: set ts=4 sw=4 expandtab: */