Fixed Altivec blitters for PPC
authorSam Lantinga <slouken@libsdl.org>
Sun, 25 Jan 2009 05:14:29 +0000
changeset 3050e763aa6db88b
parent 3049 ed67e93944b1
child 3051 1a45bc89db0c
Fixed Altivec blitters for PPC
src/video/SDL_blit_N.c
     1.1 --- a/src/video/SDL_blit_N.c	Mon Jan 19 15:58:57 2009 +0000
     1.2 +++ b/src/video/SDL_blit_N.c	Sun Jan 25 05:14:29 2009 +0000
     1.3 @@ -114,11 +114,10 @@
     1.4       */
     1.5      /* ARGB */
     1.6      const static struct SDL_PixelFormat default_pixel_format = {
     1.7 -        NULL, 0, 0,
     1.8 +        NULL, 32, 4,
     1.9          0, 0, 0, 0,
    1.10          16, 8, 0, 24,
    1.11 -        0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000,
    1.12 -        0, 0
    1.13 +        0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000
    1.14      };
    1.15      if (!srcfmt) {
    1.16          srcfmt = &default_pixel_format;
    1.17 @@ -163,7 +162,7 @@
    1.18      int srcskip = info->src_skip;
    1.19      Uint8 *dst = (Uint8 *) info->dst;
    1.20      int dstskip = info->dst_skip;
    1.21 -    SDL_PixelFormat *srcfmt = info->src;
    1.22 +    SDL_PixelFormat *srcfmt = info->src_fmt;
    1.23      vector unsigned char valpha = vec_splat_u8(0);
    1.24      vector unsigned char vpermute = calc_swizzle32(srcfmt, NULL);
    1.25      vector unsigned char vgmerge = VECUINT8_LITERAL(0x00, 0x02, 0x00, 0x06,
    1.26 @@ -267,8 +266,8 @@
    1.27      int srcskip = info->src_skip;
    1.28      Uint8 *dst = (Uint8 *) info->dst;
    1.29      int dstskip = info->dst_skip;
    1.30 -    SDL_PixelFormat *srcfmt = info->src;
    1.31 -    SDL_PixelFormat *dstfmt = info->dst;
    1.32 +    SDL_PixelFormat *srcfmt = info->src_fmt;
    1.33 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
    1.34      unsigned alpha;
    1.35      vector unsigned char valpha;
    1.36      vector unsigned char vpermute;
    1.37 @@ -415,8 +414,8 @@
    1.38      int srcskip = info->src_skip;
    1.39      Uint8 *dst = (Uint8 *) info->dst;
    1.40      int dstskip = info->dst_skip;
    1.41 -    SDL_PixelFormat *srcfmt = info->src;
    1.42 -    SDL_PixelFormat *dstfmt = info->dst;
    1.43 +    SDL_PixelFormat *srcfmt = info->src_fmt;
    1.44 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
    1.45      unsigned alpha;
    1.46      vector unsigned char valpha;
    1.47      vector unsigned char vpermute;
    1.48 @@ -561,12 +560,12 @@
    1.49  {
    1.50      int height = info->dst_h;
    1.51      Uint32 *srcp = (Uint32 *) info->src;
    1.52 -    int srcskip = info->src_skip;
    1.53 +    int srcskip = info->src_skip / 4;
    1.54      Uint32 *dstp = (Uint32 *) info->dst;
    1.55 -    int dstskip = info->dst_skip;
    1.56 -    SDL_PixelFormat *srcfmt = info->src;
    1.57 +    int dstskip = info->dst_skip / 4;
    1.58 +    SDL_PixelFormat *srcfmt = info->src_fmt;
    1.59      int srcbpp = srcfmt->BytesPerPixel;
    1.60 -    SDL_PixelFormat *dstfmt = info->dst;
    1.61 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
    1.62      int dstbpp = dstfmt->BytesPerPixel;
    1.63      int copy_alpha = (srcfmt->Amask && dstfmt->Amask);
    1.64      unsigned alpha = dstfmt->Amask ? info->a : 0;
    1.65 @@ -666,8 +665,8 @@
    1.66              }
    1.67              ONE_PIXEL_BLEND((extrawidth), extrawidth);
    1.68  #undef ONE_PIXEL_BLEND
    1.69 -            srcp += srcskip >> 2;
    1.70 -            dstp += dstskip >> 2;
    1.71 +            srcp += srcskip;
    1.72 +            dstp += dstskip;
    1.73          }
    1.74      }
    1.75  }
    1.76 @@ -679,11 +678,11 @@
    1.77  {
    1.78      int height = info->dst_h;
    1.79      Uint32 *src = (Uint32 *) info->src;
    1.80 -    int srcskip = info->src_skip;
    1.81 +    int srcskip = info->src_skip / 4;
    1.82      Uint32 *dst = (Uint32 *) info->dst;
    1.83 -    int dstskip = info->dst_skip;
    1.84 -    SDL_PixelFormat *srcfmt = info->src;
    1.85 -    SDL_PixelFormat *dstfmt = info->dst;
    1.86 +    int dstskip = info->dst_skip / 4;
    1.87 +    SDL_PixelFormat *srcfmt = info->src_fmt;
    1.88 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
    1.89      vector unsigned int vzero = vec_splat_u32(0);
    1.90      vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
    1.91      if (dstfmt->Amask && !srcfmt->Amask) {
    1.92 @@ -742,8 +741,8 @@
    1.93              extrawidth--;
    1.94          }
    1.95  
    1.96 -        src += srcskip >> 2;    /* move to next row, accounting for pitch. */
    1.97 -        dst += dstskip >> 2;
    1.98 +        src += srcskip;
    1.99 +        dst += dstskip;
   1.100      }
   1.101  
   1.102  }
   1.103 @@ -758,11 +757,11 @@
   1.104  
   1.105      int height = info->dst_h;
   1.106      Uint32 *src = (Uint32 *) info->src;
   1.107 -    int srcskip = info->src_skip;
   1.108 +    int srcskip = info->src_skip / 4;
   1.109      Uint32 *dst = (Uint32 *) info->dst;
   1.110 -    int dstskip = info->dst_skip;
   1.111 -    SDL_PixelFormat *srcfmt = info->src;
   1.112 -    SDL_PixelFormat *dstfmt = info->dst;
   1.113 +    int dstskip = info->dst_skip / 4;
   1.114 +    SDL_PixelFormat *srcfmt = info->src_fmt;
   1.115 +    SDL_PixelFormat *dstfmt = info->dst_fmt;
   1.116      vector unsigned int vzero = vec_splat_u32(0);
   1.117      vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
   1.118      if (dstfmt->Amask && !srcfmt->Amask) {
   1.119 @@ -829,8 +828,8 @@
   1.120              extrawidth--;
   1.121          }
   1.122  
   1.123 -        src += srcskip >> 2;    /* move to next row, accounting for pitch. */
   1.124 -        dst += dstskip >> 2;
   1.125 +        src += srcskip;
   1.126 +        dst += dstskip;
   1.127      }
   1.128  
   1.129      vec_dss(DST_CHAN_SRC);