changeset 3050:e763aa6db88b

Fixed Altivec blitters for PPC
author Sam Lantinga <slouken@libsdl.org>
date Sun, 25 Jan 2009 05:14:29 +0000
parents ed67e93944b1
children 1a45bc89db0c
files src/video/SDL_blit_N.c
diffstat 1 files changed, 25 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/SDL_blit_N.c	Mon Jan 19 15:58:57 2009 +0000
+++ b/src/video/SDL_blit_N.c	Sun Jan 25 05:14:29 2009 +0000
@@ -114,11 +114,10 @@
      */
     /* ARGB */
     const static struct SDL_PixelFormat default_pixel_format = {
-        NULL, 0, 0,
+        NULL, 32, 4,
         0, 0, 0, 0,
         16, 8, 0, 24,
-        0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000,
-        0, 0
+        0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000
     };
     if (!srcfmt) {
         srcfmt = &default_pixel_format;
@@ -163,7 +162,7 @@
     int srcskip = info->src_skip;
     Uint8 *dst = (Uint8 *) info->dst;
     int dstskip = info->dst_skip;
-    SDL_PixelFormat *srcfmt = info->src;
+    SDL_PixelFormat *srcfmt = info->src_fmt;
     vector unsigned char valpha = vec_splat_u8(0);
     vector unsigned char vpermute = calc_swizzle32(srcfmt, NULL);
     vector unsigned char vgmerge = VECUINT8_LITERAL(0x00, 0x02, 0x00, 0x06,
@@ -267,8 +266,8 @@
     int srcskip = info->src_skip;
     Uint8 *dst = (Uint8 *) info->dst;
     int dstskip = info->dst_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
+    SDL_PixelFormat *srcfmt = info->src_fmt;
+    SDL_PixelFormat *dstfmt = info->dst_fmt;
     unsigned alpha;
     vector unsigned char valpha;
     vector unsigned char vpermute;
@@ -415,8 +414,8 @@
     int srcskip = info->src_skip;
     Uint8 *dst = (Uint8 *) info->dst;
     int dstskip = info->dst_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
+    SDL_PixelFormat *srcfmt = info->src_fmt;
+    SDL_PixelFormat *dstfmt = info->dst_fmt;
     unsigned alpha;
     vector unsigned char valpha;
     vector unsigned char vpermute;
@@ -561,12 +560,12 @@
 {
     int height = info->dst_h;
     Uint32 *srcp = (Uint32 *) info->src;
-    int srcskip = info->src_skip;
+    int srcskip = info->src_skip / 4;
     Uint32 *dstp = (Uint32 *) info->dst;
-    int dstskip = info->dst_skip;
-    SDL_PixelFormat *srcfmt = info->src;
+    int dstskip = info->dst_skip / 4;
+    SDL_PixelFormat *srcfmt = info->src_fmt;
     int srcbpp = srcfmt->BytesPerPixel;
-    SDL_PixelFormat *dstfmt = info->dst;
+    SDL_PixelFormat *dstfmt = info->dst_fmt;
     int dstbpp = dstfmt->BytesPerPixel;
     int copy_alpha = (srcfmt->Amask && dstfmt->Amask);
     unsigned alpha = dstfmt->Amask ? info->a : 0;
@@ -666,8 +665,8 @@
             }
             ONE_PIXEL_BLEND((extrawidth), extrawidth);
 #undef ONE_PIXEL_BLEND
-            srcp += srcskip >> 2;
-            dstp += dstskip >> 2;
+            srcp += srcskip;
+            dstp += dstskip;
         }
     }
 }
@@ -679,11 +678,11 @@
 {
     int height = info->dst_h;
     Uint32 *src = (Uint32 *) info->src;
-    int srcskip = info->src_skip;
+    int srcskip = info->src_skip / 4;
     Uint32 *dst = (Uint32 *) info->dst;
-    int dstskip = info->dst_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
+    int dstskip = info->dst_skip / 4;
+    SDL_PixelFormat *srcfmt = info->src_fmt;
+    SDL_PixelFormat *dstfmt = info->dst_fmt;
     vector unsigned int vzero = vec_splat_u32(0);
     vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
     if (dstfmt->Amask && !srcfmt->Amask) {
@@ -742,8 +741,8 @@
             extrawidth--;
         }
 
-        src += srcskip >> 2;    /* move to next row, accounting for pitch. */
-        dst += dstskip >> 2;
+        src += srcskip;
+        dst += dstskip;
     }
 
 }
@@ -758,11 +757,11 @@
 
     int height = info->dst_h;
     Uint32 *src = (Uint32 *) info->src;
-    int srcskip = info->src_skip;
+    int srcskip = info->src_skip / 4;
     Uint32 *dst = (Uint32 *) info->dst;
-    int dstskip = info->dst_skip;
-    SDL_PixelFormat *srcfmt = info->src;
-    SDL_PixelFormat *dstfmt = info->dst;
+    int dstskip = info->dst_skip / 4;
+    SDL_PixelFormat *srcfmt = info->src_fmt;
+    SDL_PixelFormat *dstfmt = info->dst_fmt;
     vector unsigned int vzero = vec_splat_u32(0);
     vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
     if (dstfmt->Amask && !srcfmt->Amask) {
@@ -829,8 +828,8 @@
             extrawidth--;
         }
 
-        src += srcskip >> 2;    /* move to next row, accounting for pitch. */
-        dst += dstskip >> 2;
+        src += srcskip;
+        dst += dstskip;
     }
 
     vec_dss(DST_CHAN_SRC);