src/video/SDL_blit_N.c
changeset 2262 bee005ace1bf
parent 2257 340942cfda48
child 2267 c785543d1843
equal deleted inserted replaced
2261:c20476d7d7b3 2262:bee005ace1bf
   156 
   156 
   157 static void Blit_RGB888_RGB565(SDL_BlitInfo * info);
   157 static void Blit_RGB888_RGB565(SDL_BlitInfo * info);
   158 static void
   158 static void
   159 Blit_RGB888_RGB565Altivec(SDL_BlitInfo * info)
   159 Blit_RGB888_RGB565Altivec(SDL_BlitInfo * info)
   160 {
   160 {
   161     int height = info->d_height;
   161     int height = info->dst_h;
   162     Uint8 *src = (Uint8 *) info->s_pixels;
   162     Uint8 *src = (Uint8 *) info->src;
   163     int srcskip = info->s_skip;
   163     int srcskip = info->s_skip;
   164     Uint8 *dst = (Uint8 *) info->d_pixels;
   164     Uint8 *dst = (Uint8 *) info->dst;
   165     int dstskip = info->d_skip;
   165     int dstskip = info->dst_pitch;
   166     SDL_PixelFormat *srcfmt = info->src;
   166     SDL_PixelFormat *srcfmt = info->src;
   167     vector unsigned char valpha = vec_splat_u8(0);
   167     vector unsigned char valpha = vec_splat_u8(0);
   168     vector unsigned char vpermute = calc_swizzle32(srcfmt, NULL);
   168     vector unsigned char vpermute = calc_swizzle32(srcfmt, NULL);
   169     vector unsigned char vgmerge = VECUINT8_LITERAL(0x00, 0x02, 0x00, 0x06,
   169     vector unsigned char vgmerge = VECUINT8_LITERAL(0x00, 0x02, 0x00, 0x06,
   170                                                     0x00, 0x0a, 0x00, 0x0e,
   170                                                     0x00, 0x0a, 0x00, 0x0e,
   184     while (height--) {
   184     while (height--) {
   185         vector unsigned char valigner;
   185         vector unsigned char valigner;
   186         vector unsigned char voverflow;
   186         vector unsigned char voverflow;
   187         vector unsigned char vsrc;
   187         vector unsigned char vsrc;
   188 
   188 
   189         int width = info->d_width;
   189         int width = info->dst_w;
   190         int extrawidth;
   190         int extrawidth;
   191 
   191 
   192         /* do scalar until we can align... */
   192         /* do scalar until we can align... */
   193 #define ONE_PIXEL_BLEND(condition, widthvar) \
   193 #define ONE_PIXEL_BLEND(condition, widthvar) \
   194         while (condition) { \
   194         while (condition) { \
   260 }
   260 }
   261 
   261 
   262 static void
   262 static void
   263 Blit_RGB565_32Altivec(SDL_BlitInfo * info)
   263 Blit_RGB565_32Altivec(SDL_BlitInfo * info)
   264 {
   264 {
   265     int height = info->d_height;
   265     int height = info->dst_h;
   266     Uint8 *src = (Uint8 *) info->s_pixels;
   266     Uint8 *src = (Uint8 *) info->src;
   267     int srcskip = info->s_skip;
   267     int srcskip = info->s_skip;
   268     Uint8 *dst = (Uint8 *) info->d_pixels;
   268     Uint8 *dst = (Uint8 *) info->dst;
   269     int dstskip = info->d_skip;
   269     int dstskip = info->dst_pitch;
   270     SDL_PixelFormat *srcfmt = info->src;
   270     SDL_PixelFormat *srcfmt = info->src;
   271     SDL_PixelFormat *dstfmt = info->dst;
   271     SDL_PixelFormat *dstfmt = info->dst;
   272     unsigned alpha;
   272     unsigned alpha;
   273     vector unsigned char valpha;
   273     vector unsigned char valpha;
   274     vector unsigned char vpermute;
   274     vector unsigned char vpermute;
   334     while (height--) {
   334     while (height--) {
   335         vector unsigned char valigner;
   335         vector unsigned char valigner;
   336         vector unsigned char voverflow;
   336         vector unsigned char voverflow;
   337         vector unsigned char vsrc;
   337         vector unsigned char vsrc;
   338 
   338 
   339         int width = info->d_width;
   339         int width = info->dst_w;
   340         int extrawidth;
   340         int extrawidth;
   341 
   341 
   342         /* do scalar until we can align... */
   342         /* do scalar until we can align... */
   343 #define ONE_PIXEL_BLEND(condition, widthvar) \
   343 #define ONE_PIXEL_BLEND(condition, widthvar) \
   344         while (condition) { \
   344         while (condition) { \
   408 
   408 
   409 
   409 
   410 static void
   410 static void
   411 Blit_RGB555_32Altivec(SDL_BlitInfo * info)
   411 Blit_RGB555_32Altivec(SDL_BlitInfo * info)
   412 {
   412 {
   413     int height = info->d_height;
   413     int height = info->dst_h;
   414     Uint8 *src = (Uint8 *) info->s_pixels;
   414     Uint8 *src = (Uint8 *) info->src;
   415     int srcskip = info->s_skip;
   415     int srcskip = info->s_skip;
   416     Uint8 *dst = (Uint8 *) info->d_pixels;
   416     Uint8 *dst = (Uint8 *) info->dst;
   417     int dstskip = info->d_skip;
   417     int dstskip = info->dst_pitch;
   418     SDL_PixelFormat *srcfmt = info->src;
   418     SDL_PixelFormat *srcfmt = info->src;
   419     SDL_PixelFormat *dstfmt = info->dst;
   419     SDL_PixelFormat *dstfmt = info->dst;
   420     unsigned alpha;
   420     unsigned alpha;
   421     vector unsigned char valpha;
   421     vector unsigned char valpha;
   422     vector unsigned char vpermute;
   422     vector unsigned char vpermute;
   482     while (height--) {
   482     while (height--) {
   483         vector unsigned char valigner;
   483         vector unsigned char valigner;
   484         vector unsigned char voverflow;
   484         vector unsigned char voverflow;
   485         vector unsigned char vsrc;
   485         vector unsigned char vsrc;
   486 
   486 
   487         int width = info->d_width;
   487         int width = info->dst_w;
   488         int extrawidth;
   488         int extrawidth;
   489 
   489 
   490         /* do scalar until we can align... */
   490         /* do scalar until we can align... */
   491 #define ONE_PIXEL_BLEND(condition, widthvar) \
   491 #define ONE_PIXEL_BLEND(condition, widthvar) \
   492         while (condition) { \
   492         while (condition) { \
   557 static void BlitNtoNKey(SDL_BlitInfo * info);
   557 static void BlitNtoNKey(SDL_BlitInfo * info);
   558 static void BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info);
   558 static void BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info);
   559 static void
   559 static void
   560 Blit32to32KeyAltivec(SDL_BlitInfo * info)
   560 Blit32to32KeyAltivec(SDL_BlitInfo * info)
   561 {
   561 {
   562     int height = info->d_height;
   562     int height = info->dst_h;
   563     Uint32 *srcp = (Uint32 *) info->s_pixels;
   563     Uint32 *srcp = (Uint32 *) info->src;
   564     int srcskip = info->s_skip;
   564     int srcskip = info->s_skip;
   565     Uint32 *dstp = (Uint32 *) info->d_pixels;
   565     Uint32 *dstp = (Uint32 *) info->dst;
   566     int dstskip = info->d_skip;
   566     int dstskip = info->dst_pitch;
   567     SDL_PixelFormat *srcfmt = info->src;
   567     SDL_PixelFormat *srcfmt = info->src;
   568     int srcbpp = srcfmt->BytesPerPixel;
   568     int srcbpp = srcfmt->BytesPerPixel;
   569     SDL_PixelFormat *dstfmt = info->dst;
   569     SDL_PixelFormat *dstfmt = info->dst;
   570     int dstbpp = dstfmt->BytesPerPixel;
   570     int dstbpp = dstfmt->BytesPerPixel;
   571     int copy_alpha = (srcfmt->Amask && dstfmt->Amask);
   571     int copy_alpha = (srcfmt->Amask && dstfmt->Amask);
   576     vector unsigned char vpermute;
   576     vector unsigned char vpermute;
   577     vector unsigned char vzero;
   577     vector unsigned char vzero;
   578     vector unsigned int vckey;
   578     vector unsigned int vckey;
   579     vector unsigned int vrgbmask;
   579     vector unsigned int vrgbmask;
   580     vpermute = calc_swizzle32(srcfmt, dstfmt);
   580     vpermute = calc_swizzle32(srcfmt, dstfmt);
   581     if (info->d_width < 16) {
   581     if (info->dst_w < 16) {
   582         if (copy_alpha) {
   582         if (copy_alpha) {
   583             BlitNtoNKeyCopyAlpha(info);
   583             BlitNtoNKeyCopyAlpha(info);
   584         } else {
   584         } else {
   585             BlitNtoNKey(info);
   585             BlitNtoNKey(info);
   586         }
   586         }
   629                 dstp = (Uint32 *) (((Uint8 *)dstp) + dstbpp); \
   629                 dstp = (Uint32 *) (((Uint8 *)dstp) + dstbpp); \
   630                 srcp = (Uint32 *) (((Uint8 *)srcp) + srcbpp); \
   630                 srcp = (Uint32 *) (((Uint8 *)srcp) + srcbpp); \
   631                 widthvar--; \
   631                 widthvar--; \
   632             } \
   632             } \
   633         }
   633         }
   634         int width = info->d_width;
   634         int width = info->dst_w;
   635         ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width);
   635         ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width);
   636         assert(width > 0);
   636         assert(width > 0);
   637         if (width > 0) {
   637         if (width > 0) {
   638             int extrawidth = (width % 4);
   638             int extrawidth = (width % 4);
   639             vector unsigned char valigner = VEC_ALIGNER(srcp);
   639             vector unsigned char valigner = VEC_ALIGNER(srcp);
   675 /* Altivec code to swizzle one 32-bit surface to a different 32-bit format. */
   675 /* Altivec code to swizzle one 32-bit surface to a different 32-bit format. */
   676 /* Use this on a G5 */
   676 /* Use this on a G5 */
   677 static void
   677 static void
   678 ConvertAltivec32to32_noprefetch(SDL_BlitInfo * info)
   678 ConvertAltivec32to32_noprefetch(SDL_BlitInfo * info)
   679 {
   679 {
   680     int height = info->d_height;
   680     int height = info->dst_h;
   681     Uint32 *src = (Uint32 *) info->s_pixels;
   681     Uint32 *src = (Uint32 *) info->src;
   682     int srcskip = info->s_skip;
   682     int srcskip = info->s_skip;
   683     Uint32 *dst = (Uint32 *) info->d_pixels;
   683     Uint32 *dst = (Uint32 *) info->dst;
   684     int dstskip = info->d_skip;
   684     int dstskip = info->dst_pitch;
   685     SDL_PixelFormat *srcfmt = info->src;
   685     SDL_PixelFormat *srcfmt = info->src;
   686     SDL_PixelFormat *dstfmt = info->dst;
   686     SDL_PixelFormat *dstfmt = info->dst;
   687     vector unsigned int vzero = vec_splat_u32(0);
   687     vector unsigned int vzero = vec_splat_u32(0);
   688     vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
   688     vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
   689     if (dstfmt->Amask && !srcfmt->Amask) {
   689     if (dstfmt->Amask && !srcfmt->Amask) {
   702         vector unsigned int vbits;
   702         vector unsigned int vbits;
   703         vector unsigned int voverflow;
   703         vector unsigned int voverflow;
   704         Uint32 bits;
   704         Uint32 bits;
   705         Uint8 r, g, b, a;
   705         Uint8 r, g, b, a;
   706 
   706 
   707         int width = info->d_width;
   707         int width = info->dst_w;
   708         int extrawidth;
   708         int extrawidth;
   709 
   709 
   710         /* do scalar until we can align... */
   710         /* do scalar until we can align... */
   711         while ((UNALIGNED_PTR(dst)) && (width)) {
   711         while ((UNALIGNED_PTR(dst)) && (width)) {
   712             bits = *(src++);
   712             bits = *(src++);
   754 ConvertAltivec32to32_prefetch(SDL_BlitInfo * info)
   754 ConvertAltivec32to32_prefetch(SDL_BlitInfo * info)
   755 {
   755 {
   756     const int scalar_dst_lead = sizeof(Uint32) * 4;
   756     const int scalar_dst_lead = sizeof(Uint32) * 4;
   757     const int vector_dst_lead = sizeof(Uint32) * 16;
   757     const int vector_dst_lead = sizeof(Uint32) * 16;
   758 
   758 
   759     int height = info->d_height;
   759     int height = info->dst_h;
   760     Uint32 *src = (Uint32 *) info->s_pixels;
   760     Uint32 *src = (Uint32 *) info->src;
   761     int srcskip = info->s_skip;
   761     int srcskip = info->s_skip;
   762     Uint32 *dst = (Uint32 *) info->d_pixels;
   762     Uint32 *dst = (Uint32 *) info->dst;
   763     int dstskip = info->d_skip;
   763     int dstskip = info->dst_pitch;
   764     SDL_PixelFormat *srcfmt = info->src;
   764     SDL_PixelFormat *srcfmt = info->src;
   765     SDL_PixelFormat *dstfmt = info->dst;
   765     SDL_PixelFormat *dstfmt = info->dst;
   766     vector unsigned int vzero = vec_splat_u32(0);
   766     vector unsigned int vzero = vec_splat_u32(0);
   767     vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
   767     vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
   768     if (dstfmt->Amask && !srcfmt->Amask) {
   768     if (dstfmt->Amask && !srcfmt->Amask) {
   781         vector unsigned int vbits;
   781         vector unsigned int vbits;
   782         vector unsigned int voverflow;
   782         vector unsigned int voverflow;
   783         Uint32 bits;
   783         Uint32 bits;
   784         Uint8 r, g, b, a;
   784         Uint8 r, g, b, a;
   785 
   785 
   786         int width = info->d_width;
   786         int width = info->dst_w;
   787         int extrawidth;
   787         int extrawidth;
   788 
   788 
   789         /* do scalar until we can align... */
   789         /* do scalar until we can align... */
   790         while ((UNALIGNED_PTR(dst)) && (width)) {
   790         while ((UNALIGNED_PTR(dst)) && (width)) {
   791             vec_dstt(src + scalar_dst_lead, DST_CTRL(2, 32, 1024),
   791             vec_dstt(src + scalar_dst_lead, DST_CTRL(2, 32, 1024),
   896     const Uint8 *map;
   896     const Uint8 *map;
   897     Uint8 *dst;
   897     Uint8 *dst;
   898     int srcskip, dstskip;
   898     int srcskip, dstskip;
   899 
   899 
   900     /* Set up some basic variables */
   900     /* Set up some basic variables */
   901     width = info->d_width;
   901     width = info->dst_w;
   902     height = info->d_height;
   902     height = info->dst_h;
   903     src = (Uint32 *) info->s_pixels;
   903     src = (Uint32 *) info->src;
   904     srcskip = info->s_skip / 4;
   904     srcskip = info->s_skip / 4;
   905     dst = info->d_pixels;
   905     dst = info->dst;
   906     dstskip = info->d_skip;
   906     dstskip = info->dst_pitch;
   907     map = info->table;
   907     map = info->table;
   908 
   908 
   909     if (map == NULL) {
   909     if (map == NULL) {
   910         while (height--) {
   910         while (height--) {
   911 #ifdef USE_DUFFS_LOOP
   911 #ifdef USE_DUFFS_LOOP
  1013     Uint32 *src;
  1013     Uint32 *src;
  1014     Uint16 *dst;
  1014     Uint16 *dst;
  1015     int srcskip, dstskip;
  1015     int srcskip, dstskip;
  1016 
  1016 
  1017     /* Set up some basic variables */
  1017     /* Set up some basic variables */
  1018     width = info->d_width;
  1018     width = info->dst_w;
  1019     height = info->d_height;
  1019     height = info->dst_h;
  1020     src = (Uint32 *) info->s_pixels;
  1020     src = (Uint32 *) info->src;
  1021     srcskip = info->s_skip / 4;
  1021     srcskip = info->s_skip / 4;
  1022     dst = (Uint16 *) info->d_pixels;
  1022     dst = (Uint16 *) info->dst;
  1023     dstskip = info->d_skip / 2;
  1023     dstskip = info->dst_pitch / 2;
  1024 
  1024 
  1025 #ifdef USE_DUFFS_LOOP
  1025 #ifdef USE_DUFFS_LOOP
  1026     while (height--) {
  1026     while (height--) {
  1027 		/* *INDENT-OFF* */
  1027 		/* *INDENT-OFF* */
  1028 		DUFFS_LOOP(
  1028 		DUFFS_LOOP(
  1137     Uint32 *src;
  1137     Uint32 *src;
  1138     Uint16 *dst;
  1138     Uint16 *dst;
  1139     int srcskip, dstskip;
  1139     int srcskip, dstskip;
  1140 
  1140 
  1141     /* Set up some basic variables */
  1141     /* Set up some basic variables */
  1142     width = info->d_width;
  1142     width = info->dst_w;
  1143     height = info->d_height;
  1143     height = info->dst_h;
  1144     src = (Uint32 *) info->s_pixels;
  1144     src = (Uint32 *) info->src;
  1145     srcskip = info->s_skip / 4;
  1145     srcskip = info->s_skip / 4;
  1146     dst = (Uint16 *) info->d_pixels;
  1146     dst = (Uint16 *) info->dst;
  1147     dstskip = info->d_skip / 2;
  1147     dstskip = info->dst_pitch / 2;
  1148 
  1148 
  1149 #ifdef USE_DUFFS_LOOP
  1149 #ifdef USE_DUFFS_LOOP
  1150     while (height--) {
  1150     while (height--) {
  1151 		/* *INDENT-OFF* */
  1151 		/* *INDENT-OFF* */
  1152 		DUFFS_LOOP(
  1152 		DUFFS_LOOP(
  1250     Uint8 *src;
  1250     Uint8 *src;
  1251     Uint32 *dst;
  1251     Uint32 *dst;
  1252     int srcskip, dstskip;
  1252     int srcskip, dstskip;
  1253 
  1253 
  1254     /* Set up some basic variables */
  1254     /* Set up some basic variables */
  1255     width = info->d_width;
  1255     width = info->dst_w;
  1256     height = info->d_height;
  1256     height = info->dst_h;
  1257     src = (Uint8 *) info->s_pixels;
  1257     src = (Uint8 *) info->src;
  1258     srcskip = info->s_skip;
  1258     srcskip = info->s_skip;
  1259     dst = (Uint32 *) info->d_pixels;
  1259     dst = (Uint32 *) info->dst;
  1260     dstskip = info->d_skip / 4;
  1260     dstskip = info->dst_pitch / 4;
  1261 
  1261 
  1262 #ifdef USE_DUFFS_LOOP
  1262 #ifdef USE_DUFFS_LOOP
  1263     while (height--) {
  1263     while (height--) {
  1264 		/* *INDENT-OFF* */
  1264 		/* *INDENT-OFF* */
  1265 		DUFFS_LOOP(
  1265 		DUFFS_LOOP(
  1872     const Uint8 *map;
  1872     const Uint8 *map;
  1873     Uint8 *dst;
  1873     Uint8 *dst;
  1874     int srcskip, dstskip;
  1874     int srcskip, dstskip;
  1875 
  1875 
  1876     /* Set up some basic variables */
  1876     /* Set up some basic variables */
  1877     width = info->d_width;
  1877     width = info->dst_w;
  1878     height = info->d_height;
  1878     height = info->dst_h;
  1879     src = (Uint32 *) info->s_pixels;
  1879     src = (Uint32 *) info->src;
  1880     srcskip = info->s_skip / 4;
  1880     srcskip = info->s_skip / 4;
  1881     dst = info->d_pixels;
  1881     dst = info->dst;
  1882     dstskip = info->d_skip;
  1882     dstskip = info->dst_pitch;
  1883     map = info->table;
  1883     map = info->table;
  1884 
  1884 
  1885 #ifdef USE_DUFFS_LOOP
  1885 #ifdef USE_DUFFS_LOOP
  1886     while (height--) {
  1886     while (height--) {
  1887 		/* *INDENT-OFF* */
  1887 		/* *INDENT-OFF* */
  1945     Uint32 Pixel;
  1945     Uint32 Pixel;
  1946     int sR, sG, sB;
  1946     int sR, sG, sB;
  1947     SDL_PixelFormat *srcfmt;
  1947     SDL_PixelFormat *srcfmt;
  1948 
  1948 
  1949     /* Set up some basic variables */
  1949     /* Set up some basic variables */
  1950     width = info->d_width;
  1950     width = info->dst_w;
  1951     height = info->d_height;
  1951     height = info->dst_h;
  1952     src = info->s_pixels;
  1952     src = info->src;
  1953     srcskip = info->s_skip;
  1953     srcskip = info->s_skip;
  1954     dst = info->d_pixels;
  1954     dst = info->dst;
  1955     dstskip = info->d_skip;
  1955     dstskip = info->dst_pitch;
  1956     map = info->table;
  1956     map = info->table;
  1957     srcfmt = info->src;
  1957     srcfmt = info->src;
  1958     srcbpp = srcfmt->BytesPerPixel;
  1958     srcbpp = srcfmt->BytesPerPixel;
  1959 
  1959 
  1960     if (map == NULL) {
  1960     if (map == NULL) {
  2026 
  2026 
  2027 /* blits 32 bit RGB<->RGBA with both surfaces having the same R,G,B fields */
  2027 /* blits 32 bit RGB<->RGBA with both surfaces having the same R,G,B fields */
  2028 static void
  2028 static void
  2029 Blit4to4MaskAlpha(SDL_BlitInfo * info)
  2029 Blit4to4MaskAlpha(SDL_BlitInfo * info)
  2030 {
  2030 {
  2031     int width = info->d_width;
  2031     int width = info->dst_w;
  2032     int height = info->d_height;
  2032     int height = info->dst_h;
  2033     Uint32 *src = (Uint32 *) info->s_pixels;
  2033     Uint32 *src = (Uint32 *) info->src;
  2034     int srcskip = info->s_skip;
  2034     int srcskip = info->s_skip;
  2035     Uint32 *dst = (Uint32 *) info->d_pixels;
  2035     Uint32 *dst = (Uint32 *) info->dst;
  2036     int dstskip = info->d_skip;
  2036     int dstskip = info->dst_pitch;
  2037     SDL_PixelFormat *srcfmt = info->src;
  2037     SDL_PixelFormat *srcfmt = info->src;
  2038     SDL_PixelFormat *dstfmt = info->dst;
  2038     SDL_PixelFormat *dstfmt = info->dst;
  2039 
  2039 
  2040     if (dstfmt->Amask) {
  2040     if (dstfmt->Amask) {
  2041         /* RGB->RGBA, SET_ALPHA */
  2041         /* RGB->RGBA, SET_ALPHA */
  2075 }
  2075 }
  2076 
  2076 
  2077 static void
  2077 static void
  2078 BlitNtoN(SDL_BlitInfo * info)
  2078 BlitNtoN(SDL_BlitInfo * info)
  2079 {
  2079 {
  2080     int width = info->d_width;
  2080     int width = info->dst_w;
  2081     int height = info->d_height;
  2081     int height = info->dst_h;
  2082     Uint8 *src = info->s_pixels;
  2082     Uint8 *src = info->src;
  2083     int srcskip = info->s_skip;
  2083     int srcskip = info->s_skip;
  2084     Uint8 *dst = info->d_pixels;
  2084     Uint8 *dst = info->dst;
  2085     int dstskip = info->d_skip;
  2085     int dstskip = info->dst_pitch;
  2086     SDL_PixelFormat *srcfmt = info->src;
  2086     SDL_PixelFormat *srcfmt = info->src;
  2087     int srcbpp = srcfmt->BytesPerPixel;
  2087     int srcbpp = srcfmt->BytesPerPixel;
  2088     SDL_PixelFormat *dstfmt = info->dst;
  2088     SDL_PixelFormat *dstfmt = info->dst;
  2089     int dstbpp = dstfmt->BytesPerPixel;
  2089     int dstbpp = dstfmt->BytesPerPixel;
  2090     unsigned alpha = dstfmt->Amask ? (info->cmod >> 24) : 0;
  2090     unsigned alpha = dstfmt->Amask ? (info->cmod >> 24) : 0;
  2110 }
  2110 }
  2111 
  2111 
  2112 static void
  2112 static void
  2113 BlitNtoNCopyAlpha(SDL_BlitInfo * info)
  2113 BlitNtoNCopyAlpha(SDL_BlitInfo * info)
  2114 {
  2114 {
  2115     int width = info->d_width;
  2115     int width = info->dst_w;
  2116     int height = info->d_height;
  2116     int height = info->dst_h;
  2117     Uint8 *src = info->s_pixels;
  2117     Uint8 *src = info->src;
  2118     int srcskip = info->s_skip;
  2118     int srcskip = info->s_skip;
  2119     Uint8 *dst = info->d_pixels;
  2119     Uint8 *dst = info->dst;
  2120     int dstskip = info->d_skip;
  2120     int dstskip = info->dst_pitch;
  2121     SDL_PixelFormat *srcfmt = info->src;
  2121     SDL_PixelFormat *srcfmt = info->src;
  2122     int srcbpp = srcfmt->BytesPerPixel;
  2122     int srcbpp = srcfmt->BytesPerPixel;
  2123     SDL_PixelFormat *dstfmt = info->dst;
  2123     SDL_PixelFormat *dstfmt = info->dst;
  2124     int dstbpp = dstfmt->BytesPerPixel;
  2124     int dstbpp = dstfmt->BytesPerPixel;
  2125     int c;
  2125     int c;
  2140 }
  2140 }
  2141 
  2141 
  2142 static void
  2142 static void
  2143 BlitNto1Key(SDL_BlitInfo * info)
  2143 BlitNto1Key(SDL_BlitInfo * info)
  2144 {
  2144 {
  2145     int width = info->d_width;
  2145     int width = info->dst_w;
  2146     int height = info->d_height;
  2146     int height = info->dst_h;
  2147     Uint8 *src = info->s_pixels;
  2147     Uint8 *src = info->src;
  2148     int srcskip = info->s_skip;
  2148     int srcskip = info->s_skip;
  2149     Uint8 *dst = info->d_pixels;
  2149     Uint8 *dst = info->dst;
  2150     int dstskip = info->d_skip;
  2150     int dstskip = info->dst_pitch;
  2151     SDL_PixelFormat *srcfmt = info->src;
  2151     SDL_PixelFormat *srcfmt = info->src;
  2152     const Uint8 *palmap = info->table;
  2152     const Uint8 *palmap = info->table;
  2153     Uint32 ckey = info->ckey;
  2153     Uint32 ckey = info->ckey;
  2154     Uint32 rgbmask = ~srcfmt->Amask;
  2154     Uint32 rgbmask = ~srcfmt->Amask;
  2155     int srcbpp;
  2155     int srcbpp;
  2206 }
  2206 }
  2207 
  2207 
  2208 static void
  2208 static void
  2209 Blit2to2Key(SDL_BlitInfo * info)
  2209 Blit2to2Key(SDL_BlitInfo * info)
  2210 {
  2210 {
  2211     int width = info->d_width;
  2211     int width = info->dst_w;
  2212     int height = info->d_height;
  2212     int height = info->dst_h;
  2213     Uint16 *srcp = (Uint16 *) info->s_pixels;
  2213     Uint16 *srcp = (Uint16 *) info->src;
  2214     int srcskip = info->s_skip;
  2214     int srcskip = info->s_skip;
  2215     Uint16 *dstp = (Uint16 *) info->d_pixels;
  2215     Uint16 *dstp = (Uint16 *) info->dst;
  2216     int dstskip = info->d_skip;
  2216     int dstskip = info->dst_pitch;
  2217     Uint32 ckey = info->ckey;
  2217     Uint32 ckey = info->ckey;
  2218     Uint32 rgbmask = ~info->src->Amask;
  2218     Uint32 rgbmask = ~info->src->Amask;
  2219 
  2219 
  2220     /* Set up some basic variables */
  2220     /* Set up some basic variables */
  2221     srcskip /= 2;
  2221     srcskip /= 2;
  2240 }
  2240 }
  2241 
  2241 
  2242 static void
  2242 static void
  2243 BlitNtoNKey(SDL_BlitInfo * info)
  2243 BlitNtoNKey(SDL_BlitInfo * info)
  2244 {
  2244 {
  2245     int width = info->d_width;
  2245     int width = info->dst_w;
  2246     int height = info->d_height;
  2246     int height = info->dst_h;
  2247     Uint8 *src = info->s_pixels;
  2247     Uint8 *src = info->src;
  2248     int srcskip = info->s_skip;
  2248     int srcskip = info->s_skip;
  2249     Uint8 *dst = info->d_pixels;
  2249     Uint8 *dst = info->dst;
  2250     int dstskip = info->d_skip;
  2250     int dstskip = info->dst_pitch;
  2251     Uint32 ckey = info->ckey;
  2251     Uint32 ckey = info->ckey;
  2252     SDL_PixelFormat *srcfmt = info->src;
  2252     SDL_PixelFormat *srcfmt = info->src;
  2253     SDL_PixelFormat *dstfmt = info->dst;
  2253     SDL_PixelFormat *dstfmt = info->dst;
  2254     int srcbpp = srcfmt->BytesPerPixel;
  2254     int srcbpp = srcfmt->BytesPerPixel;
  2255     int dstbpp = dstfmt->BytesPerPixel;
  2255     int dstbpp = dstfmt->BytesPerPixel;
  2283 }
  2283 }
  2284 
  2284 
  2285 static void
  2285 static void
  2286 BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info)
  2286 BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info)
  2287 {
  2287 {
  2288     int width = info->d_width;
  2288     int width = info->dst_w;
  2289     int height = info->d_height;
  2289     int height = info->dst_h;
  2290     Uint8 *src = info->s_pixels;
  2290     Uint8 *src = info->src;
  2291     int srcskip = info->s_skip;
  2291     int srcskip = info->s_skip;
  2292     Uint8 *dst = info->d_pixels;
  2292     Uint8 *dst = info->dst;
  2293     int dstskip = info->d_skip;
  2293     int dstskip = info->dst_pitch;
  2294     Uint32 ckey = info->ckey;
  2294     Uint32 ckey = info->ckey;
  2295     SDL_PixelFormat *srcfmt = info->src;
  2295     SDL_PixelFormat *srcfmt = info->src;
  2296     SDL_PixelFormat *dstfmt = info->dst;
  2296     SDL_PixelFormat *dstfmt = info->dst;
  2297     Uint32 rgbmask = ~srcfmt->Amask;
  2297     Uint32 rgbmask = ~srcfmt->Amask;
  2298 
  2298