src/video/SDL_blit_N.c
changeset 2257 340942cfda48
parent 2247 93994f65c74c
child 2262 bee005ace1bf
     1.1 --- a/src/video/SDL_blit_N.c	Thu Aug 16 22:56:18 2007 +0000
     1.2 +++ b/src/video/SDL_blit_N.c	Fri Aug 17 00:54:53 2007 +0000
     1.3 @@ -322,8 +322,8 @@
     1.4      vf800 = (vector unsigned short) vec_splat_u8(-7);
     1.5      vf800 = vec_sl(vf800, vec_splat_u16(8));
     1.6  
     1.7 -    if (dstfmt->Amask && srcfmt->alpha) {
     1.8 -        ((unsigned char *) &valpha)[0] = alpha = srcfmt->alpha;
     1.9 +    if (dstfmt->Amask && (info->cmod >> 24)) {
    1.10 +        ((unsigned char *) &valpha)[0] = alpha = (info->cmod >> 24);
    1.11          valpha = vec_splat(valpha, 0);
    1.12      } else {
    1.13          alpha = 0;
    1.14 @@ -470,8 +470,8 @@
    1.15      vf800 = (vector unsigned short) vec_splat_u8(-7);
    1.16      vf800 = vec_sl(vf800, vec_splat_u16(8));
    1.17  
    1.18 -    if (dstfmt->Amask && srcfmt->alpha) {
    1.19 -        ((unsigned char *) &valpha)[0] = alpha = srcfmt->alpha;
    1.20 +    if (dstfmt->Amask && (info->cmod >> 24)) {
    1.21 +        ((unsigned char *) &valpha)[0] = alpha = (info->cmod >> 24);
    1.22          valpha = vec_splat(valpha, 0);
    1.23      } else {
    1.24          alpha = 0;
    1.25 @@ -569,9 +569,9 @@
    1.26      SDL_PixelFormat *dstfmt = info->dst;
    1.27      int dstbpp = dstfmt->BytesPerPixel;
    1.28      int copy_alpha = (srcfmt->Amask && dstfmt->Amask);
    1.29 -    unsigned alpha = dstfmt->Amask ? srcfmt->alpha : 0;
    1.30 +    unsigned alpha = dstfmt->Amask ? (info->cmod >> 24) : 0;
    1.31      Uint32 rgbmask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
    1.32 -    Uint32 ckey = info->src->colorkey;
    1.33 +    Uint32 ckey = info->ckey;
    1.34      vector unsigned int valpha;
    1.35      vector unsigned char vpermute;
    1.36      vector unsigned char vzero;
    1.37 @@ -687,9 +687,9 @@
    1.38      vector unsigned int vzero = vec_splat_u32(0);
    1.39      vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
    1.40      if (dstfmt->Amask && !srcfmt->Amask) {
    1.41 -        if (srcfmt->alpha) {
    1.42 +        if ((info->cmod >> 24)) {
    1.43              vector unsigned char valpha;
    1.44 -            ((unsigned char *) &valpha)[0] = srcfmt->alpha;
    1.45 +            ((unsigned char *) &valpha)[0] = (info->cmod >> 24);
    1.46              vzero = (vector unsigned int) vec_splat(valpha, 0);
    1.47          }
    1.48      }
    1.49 @@ -766,9 +766,9 @@
    1.50      vector unsigned int vzero = vec_splat_u32(0);
    1.51      vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
    1.52      if (dstfmt->Amask && !srcfmt->Amask) {
    1.53 -        if (srcfmt->alpha) {
    1.54 +        if ((info->cmod >> 24)) {
    1.55              vector unsigned char valpha;
    1.56 -            ((unsigned char *) &valpha)[0] = srcfmt->alpha;
    1.57 +            ((unsigned char *) &valpha)[0] = (info->cmod >> 24);
    1.58              vzero = (vector unsigned int) vec_splat(valpha, 0);
    1.59          }
    1.60      }
    1.61 @@ -2039,7 +2039,7 @@
    1.62  
    1.63      if (dstfmt->Amask) {
    1.64          /* RGB->RGBA, SET_ALPHA */
    1.65 -        Uint32 mask = (srcfmt->alpha >> dstfmt->Aloss) << dstfmt->Ashift;
    1.66 +        Uint32 mask = ((info->cmod >> 24) >> dstfmt->Aloss) << dstfmt->Ashift;
    1.67  
    1.68          while (height--) {
    1.69  			/* *INDENT-OFF* */
    1.70 @@ -2087,7 +2087,7 @@
    1.71      int srcbpp = srcfmt->BytesPerPixel;
    1.72      SDL_PixelFormat *dstfmt = info->dst;
    1.73      int dstbpp = dstfmt->BytesPerPixel;
    1.74 -    unsigned alpha = dstfmt->Amask ? srcfmt->alpha : 0;
    1.75 +    unsigned alpha = dstfmt->Amask ? (info->cmod >> 24) : 0;
    1.76  
    1.77      while (height--) {
    1.78  		/* *INDENT-OFF* */
    1.79 @@ -2150,7 +2150,7 @@
    1.80      int dstskip = info->d_skip;
    1.81      SDL_PixelFormat *srcfmt = info->src;
    1.82      const Uint8 *palmap = info->table;
    1.83 -    Uint32 ckey = srcfmt->colorkey;
    1.84 +    Uint32 ckey = info->ckey;
    1.85      Uint32 rgbmask = ~srcfmt->Amask;
    1.86      int srcbpp;
    1.87      Uint32 Pixel;
    1.88 @@ -2214,7 +2214,7 @@
    1.89      int srcskip = info->s_skip;
    1.90      Uint16 *dstp = (Uint16 *) info->d_pixels;
    1.91      int dstskip = info->d_skip;
    1.92 -    Uint32 ckey = info->src->colorkey;
    1.93 +    Uint32 ckey = info->ckey;
    1.94      Uint32 rgbmask = ~info->src->Amask;
    1.95  
    1.96      /* Set up some basic variables */
    1.97 @@ -2248,12 +2248,12 @@
    1.98      int srcskip = info->s_skip;
    1.99      Uint8 *dst = info->d_pixels;
   1.100      int dstskip = info->d_skip;
   1.101 -    Uint32 ckey = info->src->colorkey;
   1.102 +    Uint32 ckey = info->ckey;
   1.103      SDL_PixelFormat *srcfmt = info->src;
   1.104      SDL_PixelFormat *dstfmt = info->dst;
   1.105      int srcbpp = srcfmt->BytesPerPixel;
   1.106      int dstbpp = dstfmt->BytesPerPixel;
   1.107 -    unsigned alpha = dstfmt->Amask ? srcfmt->alpha : 0;
   1.108 +    unsigned alpha = dstfmt->Amask ? (info->cmod >> 24) : 0;
   1.109      Uint32 rgbmask = ~srcfmt->Amask;
   1.110  
   1.111      /* Set up some basic variables */
   1.112 @@ -2291,7 +2291,7 @@
   1.113      int srcskip = info->s_skip;
   1.114      Uint8 *dst = info->d_pixels;
   1.115      int dstskip = info->d_skip;
   1.116 -    Uint32 ckey = info->src->colorkey;
   1.117 +    Uint32 ckey = info->ckey;
   1.118      SDL_PixelFormat *srcfmt = info->src;
   1.119      SDL_PixelFormat *dstfmt = info->dst;
   1.120      Uint32 rgbmask = ~srcfmt->Amask;
   1.121 @@ -2332,70 +2332,69 @@
   1.122      int dstbpp;
   1.123      Uint32 dstR, dstG, dstB;
   1.124      Uint32 blit_features;
   1.125 -    void *aux_data;
   1.126      SDL_loblit blitfunc;
   1.127      enum
   1.128      { NO_ALPHA = 1, SET_ALPHA = 2, COPY_ALPHA = 4 } alpha;
   1.129  };
   1.130  static const struct blit_table normal_blit_1[] = {
   1.131      /* Default for 8-bit RGB source, an invalid combination */
   1.132 -    {0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL},
   1.133 +    {0, 0, 0, 0, 0, 0, 0, 0, NULL},
   1.134  };
   1.135  static const struct blit_table normal_blit_2[] = {
   1.136  #if SDL_ALTIVEC_BLITTERS
   1.137      /* has-altivec */
   1.138      {0x0000F800, 0x000007E0, 0x0000001F, 4, 0x00000000, 0x00000000,
   1.139       0x00000000,
   1.140 -     2, NULL, Blit_RGB565_32Altivec, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
   1.141 +     2, Blit_RGB565_32Altivec, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
   1.142      {0x00007C00, 0x000003E0, 0x0000001F, 4, 0x00000000, 0x00000000,
   1.143       0x00000000,
   1.144 -     2, NULL, Blit_RGB555_32Altivec, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
   1.145 +     2, Blit_RGB555_32Altivec, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
   1.146  #endif
   1.147      {0x0000F800, 0x000007E0, 0x0000001F, 4, 0x00FF0000, 0x0000FF00,
   1.148       0x000000FF,
   1.149 -     0, NULL, Blit_RGB565_ARGB8888, SET_ALPHA},
   1.150 +     0, Blit_RGB565_ARGB8888, SET_ALPHA},
   1.151      {0x0000F800, 0x000007E0, 0x0000001F, 4, 0x000000FF, 0x0000FF00,
   1.152       0x00FF0000,
   1.153 -     0, NULL, Blit_RGB565_ABGR8888, SET_ALPHA},
   1.154 +     0, Blit_RGB565_ABGR8888, SET_ALPHA},
   1.155      {0x0000F800, 0x000007E0, 0x0000001F, 4, 0xFF000000, 0x00FF0000,
   1.156       0x0000FF00,
   1.157 -     0, NULL, Blit_RGB565_RGBA8888, SET_ALPHA},
   1.158 +     0, Blit_RGB565_RGBA8888, SET_ALPHA},
   1.159      {0x0000F800, 0x000007E0, 0x0000001F, 4, 0x0000FF00, 0x00FF0000,
   1.160       0xFF000000,
   1.161 -     0, NULL, Blit_RGB565_BGRA8888, SET_ALPHA},
   1.162 +     0, Blit_RGB565_BGRA8888, SET_ALPHA},
   1.163  
   1.164      /* Default for 16-bit RGB source, used if no other blitter matches */
   1.165 -    {0, 0, 0, 0, 0, 0, 0, 0, NULL, BlitNtoN, 0}
   1.166 +    {0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
   1.167  };
   1.168  static const struct blit_table normal_blit_3[] = {
   1.169      /* Default for 24-bit RGB source, never optimized */
   1.170 -    {0, 0, 0, 0, 0, 0, 0, 0, NULL, BlitNtoN, 0}
   1.171 +    {0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
   1.172  };
   1.173  static const struct blit_table normal_blit_4[] = {
   1.174  #if SDL_ALTIVEC_BLITTERS
   1.175      /* has-altivec | dont-use-prefetch */
   1.176      {0x00000000, 0x00000000, 0x00000000, 4, 0x00000000, 0x00000000,
   1.177       0x00000000,
   1.178 -     6, NULL, ConvertAltivec32to32_noprefetch,
   1.179 +     6, ConvertAltivec32to32_noprefetch,
   1.180       NO_ALPHA | COPY_ALPHA | SET_ALPHA},
   1.181      /* has-altivec */
   1.182      {0x00000000, 0x00000000, 0x00000000, 4, 0x00000000, 0x00000000,
   1.183       0x00000000,
   1.184 -     2, NULL, ConvertAltivec32to32_prefetch,
   1.185 +     2, ConvertAltivec32to32_prefetch,
   1.186       NO_ALPHA | COPY_ALPHA | SET_ALPHA},
   1.187      /* has-altivec */
   1.188      {0x00000000, 0x00000000, 0x00000000, 2, 0x0000F800, 0x000007E0,
   1.189       0x0000001F,
   1.190 -     2, NULL, Blit_RGB888_RGB565Altivec, NO_ALPHA},
   1.191 +     2, Blit_RGB888_RGB565Altivec, NO_ALPHA},
   1.192  #endif
   1.193      {0x00FF0000, 0x0000FF00, 0x000000FF, 2, 0x0000F800, 0x000007E0,
   1.194       0x0000001F,
   1.195 -     0, NULL, Blit_RGB888_RGB565, NO_ALPHA},
   1.196 +     0, Blit_RGB888_RGB565, NO_ALPHA},
   1.197      {0x00FF0000, 0x0000FF00, 0x000000FF, 2, 0x00007C00, 0x000003E0,
   1.198       0x0000001F,
   1.199 -     0, NULL, Blit_RGB888_RGB555, NO_ALPHA},
   1.200 +     0, Blit_RGB888_RGB555, NO_ALPHA},
   1.201      /* Default for 32-bit RGB source, used if no other blitter matches */
   1.202 -    {0, 0, 0, 0, 0, 0, 0, 0, NULL, BlitNtoN, 0}
   1.203 +    {0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
   1.204  };
   1.205  static const struct blit_table *normal_blit[] = {
   1.206      normal_blit_1, normal_blit_2, normal_blit_3, normal_blit_4
   1.207 @@ -2407,7 +2406,6 @@
   1.208  SDL_loblit
   1.209  SDL_CalculateBlitN(SDL_Surface * surface, int blit_index)
   1.210  {
   1.211 -    struct private_swaccel *sdata;
   1.212      SDL_PixelFormat *srcfmt;
   1.213      SDL_PixelFormat *dstfmt;
   1.214      const struct blit_table *table;
   1.215 @@ -2415,7 +2413,6 @@
   1.216      SDL_loblit blitfun;
   1.217  
   1.218      /* Set up data for choosing the blit */
   1.219 -    sdata = surface->map->sw_data;
   1.220      srcfmt = surface->format;
   1.221      dstfmt = surface->map->dst->format;
   1.222  
   1.223 @@ -2486,7 +2483,6 @@
   1.224                   table[which].blit_features))
   1.225                  break;
   1.226          }
   1.227 -        sdata->aux_data = table[which].aux_data;
   1.228          blitfun = table[which].blitfunc;
   1.229  
   1.230          if (blitfun == BlitNtoN) {      /* default C fallback catch-all. Slow! */