SDL  2.0
SDL_blit_N.c File Reference
#include "../SDL_internal.h"
#include "SDL_video.h"
#include "SDL_endian.h"
#include "SDL_cpuinfo.h"
#include "SDL_blit.h"
#include "SDL_assert.h"
+ Include dependency graph for SDL_blit_N.c:

Go to the source code of this file.

Data Structures

struct  blit_table
 

Macros

#define HAVE_FAST_WRITE_INT8   1
 
#define GetBlitFeatures()   ((SDL_HasMMX() ? BLIT_FEATURE_HAS_MMX : 0) | (SDL_HasARMSIMD() ? BLIT_FEATURE_HAS_ARM_SIMD : 0))
 
#define HI   1
 
#define LO   0
 
#define RGB888_RGB332(dst, src)
 
#define RGB101010_RGB332(dst, src)
 
#define RGB888_RGB555(dst, src)
 
#define RGB888_RGB565(dst, src)
 
#define RGB565_32(dst, src, map)   (map[src[LO]*2] + map[src[HI]*2+1])
 
#define NO_ALPHA   1
 
#define SET_ALPHA   2
 
#define COPY_ALPHA   4
 
#define MASKOK(x, y)   (((x) == (y)) || ((y) == 0x00000000))
 

Enumerations

enum  blit_features {
  BLIT_FEATURE_NONE = 0,
  BLIT_FEATURE_HAS_MMX = 1,
  BLIT_FEATURE_HAS_ALTIVEC = 2,
  BLIT_FEATURE_ALTIVEC_DONT_USE_PREFETCH = 4,
  BLIT_FEATURE_HAS_ARM_SIMD = 8
}
 

Functions

static void Blit_RGB888_index8 (SDL_BlitInfo *info)
 
static void Blit_RGB101010_index8 (SDL_BlitInfo *info)
 
static void Blit_RGB888_RGB555 (SDL_BlitInfo *info)
 
static void Blit_RGB888_RGB565 (SDL_BlitInfo *info)
 
static void Blit_RGB565_32 (SDL_BlitInfo *info, const Uint32 *map)
 
static void Blit_RGB565_ARGB8888 (SDL_BlitInfo *info)
 
static void Blit_RGB565_ABGR8888 (SDL_BlitInfo *info)
 
static void Blit_RGB565_RGBA8888 (SDL_BlitInfo *info)
 
static void Blit_RGB565_BGRA8888 (SDL_BlitInfo *info)
 
static void BlitNto1 (SDL_BlitInfo *info)
 
static void Blit4to4MaskAlpha (SDL_BlitInfo *info)
 
static void Blit4to4CopyAlpha (SDL_BlitInfo *info)
 
static void get_permutation (SDL_PixelFormat *srcfmt, SDL_PixelFormat *dstfmt, int *_p0, int *_p1, int *_p2, int *_p3, int *_alpha_channel)
 
static void BlitNtoN (SDL_BlitInfo *info)
 
static void BlitNtoNCopyAlpha (SDL_BlitInfo *info)
 
static void BlitNto1Key (SDL_BlitInfo *info)
 
static void Blit2to2Key (SDL_BlitInfo *info)
 
static void BlitNtoNKey (SDL_BlitInfo *info)
 
static void BlitNtoNKeyCopyAlpha (SDL_BlitInfo *info)
 
static void Blit2101010toN (SDL_BlitInfo *info)
 
static void BlitNto2101010 (SDL_BlitInfo *info)
 
static void Blit_3or4_to_3or4__same_rgb (SDL_BlitInfo *info)
 
static void Blit_3or4_to_3or4__inversed_rgb (SDL_BlitInfo *info)
 
SDL_BlitFunc SDL_CalculateBlitN (SDL_Surface *surface)
 

Variables

static const Uint32 RGB565_ARGB8888_LUT [512]
 
static const Uint32 RGB565_ABGR8888_LUT [512]
 
static const Uint32 RGB565_RGBA8888_LUT [512]
 
static const Uint32 RGB565_BGRA8888_LUT [512]
 
static const struct blit_table normal_blit_1 []
 
static const struct blit_table normal_blit_2 []
 
static const struct blit_table normal_blit_3 []
 
static const struct blit_table normal_blit_4 []
 
static const struct blit_table *const normal_blit []
 

Macro Definition Documentation

◆ COPY_ALPHA

#define COPY_ALPHA   4

Definition at line 3227 of file SDL_blit_N.c.

◆ GetBlitFeatures

#define GetBlitFeatures ( )    ((SDL_HasMMX() ? BLIT_FEATURE_HAS_MMX : 0) | (SDL_HasARMSIMD() ? BLIT_FEATURE_HAS_ARM_SIMD : 0))

Definition at line 939 of file SDL_blit_N.c.

◆ HAVE_FAST_WRITE_INT8

#define HAVE_FAST_WRITE_INT8   1

Definition at line 34 of file SDL_blit_N.c.

◆ HI

#define HI   1

Definition at line 976 of file SDL_blit_N.c.

◆ LO

#define LO   0

Definition at line 977 of file SDL_blit_N.c.

◆ MASKOK

#define MASKOK (   x,
  y 
)    (((x) == (y)) || ((y) == 0x00000000))

Definition at line 3358 of file SDL_blit_N.c.

◆ NO_ALPHA

#define NO_ALPHA   1

Definition at line 3225 of file SDL_blit_N.c.

◆ RGB101010_RGB332

#define RGB101010_RGB332 (   dst,
  src 
)
Value:
{ \
dst = (Uint8)((((src)&0x38000000)>>22)| \
(((src)&0x000E0000)>>15)| \
(((src)&0x00000300)>>8)); \
}

Definition at line 1094 of file SDL_blit_N.c.

◆ RGB565_32

#define RGB565_32 (   dst,
  src,
  map 
)    (map[src[LO]*2] + map[src[HI]*2+1])

Definition at line 1459 of file SDL_blit_N.c.

◆ RGB888_RGB332

#define RGB888_RGB332 (   dst,
  src 
)
Value:
{ \
dst = (Uint8)((((src)&0x00E00000)>>16)| \
(((src)&0x0000E000)>>11)| \
(((src)&0x000000C0)>>6)); \
}

Definition at line 984 of file SDL_blit_N.c.

◆ RGB888_RGB555

#define RGB888_RGB555 (   dst,
  src 
)
Value:
{ \
*(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>9)| \
(((*src)&0x0000F800)>>6)| \
(((*src)&0x000000F8)>>3)); \
}

Definition at line 1204 of file SDL_blit_N.c.

◆ RGB888_RGB565

#define RGB888_RGB565 (   dst,
  src 
)
Value:
{ \
*(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>8)| \
(((*src)&0x0000FC00)>>5)| \
(((*src)&0x000000F8)>>3)); \
}

Definition at line 1330 of file SDL_blit_N.c.

◆ SET_ALPHA

#define SET_ALPHA   2

Definition at line 3226 of file SDL_blit_N.c.

Enumeration Type Documentation

◆ blit_features

Enumerator
BLIT_FEATURE_NONE 
BLIT_FEATURE_HAS_MMX 
BLIT_FEATURE_HAS_ALTIVEC 
BLIT_FEATURE_ALTIVEC_DONT_USE_PREFETCH 
BLIT_FEATURE_HAS_ARM_SIMD 

Definition at line 43 of file SDL_blit_N.c.

Function Documentation

◆ Blit2101010toN()

static void Blit2101010toN ( SDL_BlitInfo info)
static

Definition at line 2983 of file SDL_blit_N.c.

2984 {
2985  int width = info->dst_w;
2986  int height = info->dst_h;
2987  Uint8 *src = info->src;
2988  int srcskip = info->src_skip;
2989  Uint8 *dst = info->dst;
2990  int dstskip = info->dst_skip;
2991  SDL_PixelFormat *dstfmt = info->dst_fmt;
2992  int dstbpp = dstfmt->BytesPerPixel;
2993  Uint32 Pixel;
2994  unsigned sR, sG, sB, sA;
2995 
2996  while (height--) {
2997  /* *INDENT-OFF* */
2998  DUFFS_LOOP(
2999  {
3000  Pixel = *(Uint32 *)src;
3001  RGBA_FROM_ARGB2101010(Pixel, sR, sG, sB, sA);
3002  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA);
3003  dst += dstbpp;
3004  src += 4;
3005  },
3006  width);
3007  /* *INDENT-ON* */
3008  src += srcskip;
3009  dst += dstskip;
3010  }
3011 }

References ASSEMBLE_RGBA, SDL_PixelFormat::BytesPerPixel, SDL_BlitInfo::dst, SDL_BlitInfo::dst_fmt, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, RGBA_FROM_ARGB2101010, SDL_BlitInfo::src, and SDL_BlitInfo::src_skip.

Referenced by SDL_CalculateBlitN().

◆ Blit2to2Key()

static void Blit2to2Key ( SDL_BlitInfo info)
static

Definition at line 2573 of file SDL_blit_N.c.

2574 {
2575  int width = info->dst_w;
2576  int height = info->dst_h;
2577  Uint16 *srcp = (Uint16 *) info->src;
2578  int srcskip = info->src_skip;
2579  Uint16 *dstp = (Uint16 *) info->dst;
2580  int dstskip = info->dst_skip;
2581  Uint32 ckey = info->colorkey;
2582  Uint32 rgbmask = ~info->src_fmt->Amask;
2583 
2584  /* Set up some basic variables */
2585  srcskip /= 2;
2586  dstskip /= 2;
2587  ckey &= rgbmask;
2588 
2589  while (height--) {
2590  /* *INDENT-OFF* */
2591  DUFFS_LOOP(
2592  {
2593  if ( (*srcp & rgbmask) != ckey ) {
2594  *dstp = *srcp;
2595  }
2596  dstp++;
2597  srcp++;
2598  },
2599  width);
2600  /* *INDENT-ON* */
2601  srcp += srcskip;
2602  dstp += dstskip;
2603  }
2604 }

References SDL_PixelFormat::Amask, SDL_BlitInfo::colorkey, SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, SDL_BlitInfo::src, SDL_BlitInfo::src_fmt, and SDL_BlitInfo::src_skip.

Referenced by SDL_CalculateBlitN().

◆ Blit4to4CopyAlpha()

static void Blit4to4CopyAlpha ( SDL_BlitInfo info)
static

Definition at line 2223 of file SDL_blit_N.c.

2224 {
2225  int width = info->dst_w;
2226  int height = info->dst_h;
2227  Uint32 *src = (Uint32 *) info->src;
2228  int srcskip = info->src_skip;
2229  Uint32 *dst = (Uint32 *) info->dst;
2230  int dstskip = info->dst_skip;
2231 
2232  /* RGBA->RGBA, COPY_ALPHA */
2233  while (height--) {
2234  /* *INDENT-OFF* */
2235  DUFFS_LOOP(
2236  {
2237  *dst = *src;
2238  ++dst;
2239  ++src;
2240  },
2241  width);
2242  /* *INDENT-ON* */
2243  src = (Uint32 *) ((Uint8 *) src + srcskip);
2244  dst = (Uint32 *) ((Uint8 *) dst + dstskip);
2245  }
2246 }

References SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, SDL_BlitInfo::src, and SDL_BlitInfo::src_skip.

Referenced by SDL_CalculateBlitN().

◆ Blit4to4MaskAlpha()

static void Blit4to4MaskAlpha ( SDL_BlitInfo info)
static

Definition at line 2173 of file SDL_blit_N.c.

2174 {
2175  int width = info->dst_w;
2176  int height = info->dst_h;
2177  Uint32 *src = (Uint32 *) info->src;
2178  int srcskip = info->src_skip;
2179  Uint32 *dst = (Uint32 *) info->dst;
2180  int dstskip = info->dst_skip;
2181  SDL_PixelFormat *srcfmt = info->src_fmt;
2182  SDL_PixelFormat *dstfmt = info->dst_fmt;
2183 
2184  if (dstfmt->Amask) {
2185  /* RGB->RGBA, SET_ALPHA */
2186  Uint32 mask = (info->a >> dstfmt->Aloss) << dstfmt->Ashift;
2187 
2188  while (height--) {
2189  /* *INDENT-OFF* */
2190  DUFFS_LOOP(
2191  {
2192  *dst = *src | mask;
2193  ++dst;
2194  ++src;
2195  },
2196  width);
2197  /* *INDENT-ON* */
2198  src = (Uint32 *) ((Uint8 *) src + srcskip);
2199  dst = (Uint32 *) ((Uint8 *) dst + dstskip);
2200  }
2201  } else {
2202  /* RGBA->RGB, NO_ALPHA */
2203  Uint32 mask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
2204 
2205  while (height--) {
2206  /* *INDENT-OFF* */
2207  DUFFS_LOOP(
2208  {
2209  *dst = *src & mask;
2210  ++dst;
2211  ++src;
2212  },
2213  width);
2214  /* *INDENT-ON* */
2215  src = (Uint32 *) ((Uint8 *) src + srcskip);
2216  dst = (Uint32 *) ((Uint8 *) dst + dstskip);
2217  }
2218  }
2219 }

References SDL_BlitInfo::a, SDL_PixelFormat::Aloss, SDL_PixelFormat::Amask, SDL_PixelFormat::Ashift, SDL_PixelFormat::Bmask, SDL_BlitInfo::dst, SDL_BlitInfo::dst_fmt, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, SDL_PixelFormat::Gmask, SDL_PixelFormat::Rmask, SDL_BlitInfo::src, SDL_BlitInfo::src_fmt, and SDL_BlitInfo::src_skip.

Referenced by SDL_CalculateBlitN().

◆ Blit_3or4_to_3or4__inversed_rgb()

static void Blit_3or4_to_3or4__inversed_rgb ( SDL_BlitInfo info)
static

Definition at line 3121 of file SDL_blit_N.c.

3122 {
3123  int width = info->dst_w;
3124  int height = info->dst_h;
3125  Uint8 *src = info->src;
3126  int srcskip = info->src_skip;
3127  Uint8 *dst = info->dst;
3128  int dstskip = info->dst_skip;
3129  SDL_PixelFormat *srcfmt = info->src_fmt;
3130  int srcbpp = srcfmt->BytesPerPixel;
3131  SDL_PixelFormat *dstfmt = info->dst_fmt;
3132  int dstbpp = dstfmt->BytesPerPixel;
3133 
3134  if (dstfmt->Amask) {
3135  if (srcfmt->Amask) {
3136  /* COPY_ALPHA */
3137  /* Only to switch ABGR8888 <-> ARGB8888 */
3138  while (height--) {
3139 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
3140  int i0 = 0, i1 = 1, i2 = 2, i3 = 3;
3141 #else
3142  int i0 = 3, i1 = 2, i2 = 1, i3 = 0;
3143 #endif
3144  /* *INDENT-OFF* */
3145  DUFFS_LOOP(
3146  {
3147  Uint32 *dst32 = (Uint32*)dst;
3148  Uint8 s0 = src[i0];
3149  Uint8 s1 = src[i1];
3150  Uint8 s2 = src[i2];
3151  Uint32 alphashift = src[i3] << dstfmt->Ashift;
3152  /* inversed, compared to Blit_3or4_to_3or4__same_rgb */
3153  *dst32 = (s0 << 16) | (s1 << 8) | (s2) | alphashift;
3154  dst += 4;
3155  src += 4;
3156  }, width);
3157  /* *INDENT-ON* */
3158  src += srcskip;
3159  dst += dstskip;
3160  }
3161  } else {
3162  /* SET_ALPHA */
3163  Uint32 mask = info->a << dstfmt->Ashift;
3164 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
3165  int i0 = 0, i1 = 1, i2 = 2;
3166 #else
3167  int i0 = srcbpp - 1 - 0;
3168  int i1 = srcbpp - 1 - 1;
3169  int i2 = srcbpp - 1 - 2;
3170 #endif
3171  while (height--) {
3172  /* *INDENT-OFF* */
3173  DUFFS_LOOP(
3174  {
3175  Uint32 *dst32 = (Uint32*)dst;
3176  Uint8 s0 = src[i0];
3177  Uint8 s1 = src[i1];
3178  Uint8 s2 = src[i2];
3179  /* inversed, compared to Blit_3or4_to_3or4__same_rgb */
3180  *dst32 = (s0 << 16) | (s1 << 8) | (s2) | mask;
3181  dst += 4;
3182  src += srcbpp;
3183  }, width);
3184  /* *INDENT-ON* */
3185  src += srcskip;
3186  dst += dstskip;
3187  }
3188  }
3189  } else {
3190  /* NO_ALPHA */
3191 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
3192  int i0 = 0, i1 = 1, i2 = 2;
3193  int j0 = 2, j1 = 1, j2 = 0;
3194 #else
3195  int i0 = srcbpp - 1 - 0;
3196  int i1 = srcbpp - 1 - 1;
3197  int i2 = srcbpp - 1 - 2;
3198  int j0 = dstbpp - 1 - 2;
3199  int j1 = dstbpp - 1 - 1;
3200  int j2 = dstbpp - 1 - 0;
3201 #endif
3202  while (height--) {
3203  /* *INDENT-OFF* */
3204  DUFFS_LOOP(
3205  {
3206  Uint8 s0 = src[i0];
3207  Uint8 s1 = src[i1];
3208  Uint8 s2 = src[i2];
3209  /* inversed, compared to Blit_3or4_to_3or4__same_rgb */
3210  dst[j0] = s0;
3211  dst[j1] = s1;
3212  dst[j2] = s2;
3213  dst += dstbpp;
3214  src += srcbpp;
3215  }, width);
3216  /* *INDENT-ON* */
3217  src += srcskip;
3218  dst += dstskip;
3219  }
3220  }
3221 }

◆ Blit_3or4_to_3or4__same_rgb()

static void Blit_3or4_to_3or4__same_rgb ( SDL_BlitInfo info)
static

Definition at line 3047 of file SDL_blit_N.c.

3048 {
3049  int width = info->dst_w;
3050  int height = info->dst_h;
3051  Uint8 *src = info->src;
3052  int srcskip = info->src_skip;
3053  Uint8 *dst = info->dst;
3054  int dstskip = info->dst_skip;
3055  SDL_PixelFormat *srcfmt = info->src_fmt;
3056  int srcbpp = srcfmt->BytesPerPixel;
3057  SDL_PixelFormat *dstfmt = info->dst_fmt;
3058  int dstbpp = dstfmt->BytesPerPixel;
3059 
3060  if (dstfmt->Amask) {
3061  /* SET_ALPHA */
3062  Uint32 mask = info->a << dstfmt->Ashift;
3063 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
3064  int i0 = 0, i1 = 1, i2 = 2;
3065 #else
3066  int i0 = srcbpp - 1 - 0;
3067  int i1 = srcbpp - 1 - 1;
3068  int i2 = srcbpp - 1 - 2;
3069 #endif
3070  while (height--) {
3071  /* *INDENT-OFF* */
3072  DUFFS_LOOP(
3073  {
3074  Uint32 *dst32 = (Uint32*)dst;
3075  Uint8 s0 = src[i0];
3076  Uint8 s1 = src[i1];
3077  Uint8 s2 = src[i2];
3078  *dst32 = (s0) | (s1 << 8) | (s2 << 16) | mask;
3079  dst += 4;
3080  src += srcbpp;
3081  }, width);
3082  /* *INDENT-ON* */
3083  src += srcskip;
3084  dst += dstskip;
3085  }
3086  } else {
3087  /* NO_ALPHA */
3088 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
3089  int i0 = 0, i1 = 1, i2 = 2;
3090  int j0 = 0, j1 = 1, j2 = 2;
3091 #else
3092  int i0 = srcbpp - 1 - 0;
3093  int i1 = srcbpp - 1 - 1;
3094  int i2 = srcbpp - 1 - 2;
3095  int j0 = dstbpp - 1 - 0;
3096  int j1 = dstbpp - 1 - 1;
3097  int j2 = dstbpp - 1 - 2;
3098 #endif
3099  while (height--) {
3100  /* *INDENT-OFF* */
3101  DUFFS_LOOP(
3102  {
3103  Uint8 s0 = src[i0];
3104  Uint8 s1 = src[i1];
3105  Uint8 s2 = src[i2];
3106  dst[j0] = s0;
3107  dst[j1] = s1;
3108  dst[j2] = s2;
3109  dst += dstbpp;
3110  src += srcbpp;
3111  }, width);
3112  /* *INDENT-ON* */
3113  src += srcskip;
3114  dst += dstskip;
3115  }
3116  }
3117 }

References SDL_BlitInfo::a, SDL_PixelFormat::Amask, SDL_PixelFormat::Ashift, SDL_PixelFormat::BytesPerPixel, SDL_BlitInfo::dst, SDL_BlitInfo::dst_fmt, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, i1, i2, j1, SDL_BlitInfo::src, SDL_BlitInfo::src_fmt, and SDL_BlitInfo::src_skip.

◆ Blit_RGB101010_index8()

static void Blit_RGB101010_index8 ( SDL_BlitInfo info)
static

Definition at line 1099 of file SDL_blit_N.c.

1100 {
1101 #ifndef USE_DUFFS_LOOP
1102  int c;
1103 #endif
1104  int width, height;
1105  Uint32 *src;
1106  const Uint8 *map;
1107  Uint8 *dst;
1108  int srcskip, dstskip;
1109 
1110  /* Set up some basic variables */
1111  width = info->dst_w;
1112  height = info->dst_h;
1113  src = (Uint32 *) info->src;
1114  srcskip = info->src_skip / 4;
1115  dst = info->dst;
1116  dstskip = info->dst_skip;
1117  map = info->table;
1118 
1119  if (map == NULL) {
1120  while (height--) {
1121 #ifdef USE_DUFFS_LOOP
1122  /* *INDENT-OFF* */
1123  DUFFS_LOOP(
1124  RGB101010_RGB332(*dst++, *src);
1125  , width);
1126  /* *INDENT-ON* */
1127 #else
1128  for (c = width / 4; c; --c) {
1129  /* Pack RGB into 8bit pixel */
1130  ++src;
1131  RGB101010_RGB332(*dst++, *src);
1132  ++src;
1133  RGB101010_RGB332(*dst++, *src);
1134  ++src;
1135  RGB101010_RGB332(*dst++, *src);
1136  ++src;
1137  }
1138  switch (width & 3) {
1139  case 3:
1140  RGB101010_RGB332(*dst++, *src);
1141  ++src;
1142  case 2:
1143  RGB101010_RGB332(*dst++, *src);
1144  ++src;
1145  case 1:
1146  RGB101010_RGB332(*dst++, *src);
1147  ++src;
1148  }
1149 #endif /* USE_DUFFS_LOOP */
1150  src += srcskip;
1151  dst += dstskip;
1152  }
1153  } else {
1154  int Pixel;
1155 
1156  while (height--) {
1157 #ifdef USE_DUFFS_LOOP
1158  /* *INDENT-OFF* */
1159  DUFFS_LOOP(
1160  RGB101010_RGB332(Pixel, *src);
1161  *dst++ = map[Pixel];
1162  ++src;
1163  , width);
1164  /* *INDENT-ON* */
1165 #else
1166  for (c = width / 4; c; --c) {
1167  /* Pack RGB into 8bit pixel */
1168  RGB101010_RGB332(Pixel, *src);
1169  *dst++ = map[Pixel];
1170  ++src;
1171  RGB101010_RGB332(Pixel, *src);
1172  *dst++ = map[Pixel];
1173  ++src;
1174  RGB101010_RGB332(Pixel, *src);
1175  *dst++ = map[Pixel];
1176  ++src;
1177  RGB101010_RGB332(Pixel, *src);
1178  *dst++ = map[Pixel];
1179  ++src;
1180  }
1181  switch (width & 3) {
1182  case 3:
1183  RGB101010_RGB332(Pixel, *src);
1184  *dst++ = map[Pixel];
1185  ++src;
1186  case 2:
1187  RGB101010_RGB332(Pixel, *src);
1188  *dst++ = map[Pixel];
1189  ++src;
1190  case 1:
1191  RGB101010_RGB332(Pixel, *src);
1192  *dst++ = map[Pixel];
1193  ++src;
1194  }
1195 #endif /* USE_DUFFS_LOOP */
1196  src += srcskip;
1197  dst += dstskip;
1198  }
1199  }
1200 }

References SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, if, map, NULL, RGB101010_RGB332, SDL_BlitInfo::src, SDL_BlitInfo::src_skip, and SDL_BlitInfo::table.

Referenced by SDL_CalculateBlitN().

◆ Blit_RGB565_32()

static void Blit_RGB565_32 ( SDL_BlitInfo info,
const Uint32 map 
)
static

Definition at line 1460 of file SDL_blit_N.c.

1461 {
1462 #ifndef USE_DUFFS_LOOP
1463  int c;
1464 #endif
1465  int width, height;
1466  Uint8 *src;
1467  Uint32 *dst;
1468  int srcskip, dstskip;
1469 
1470  /* Set up some basic variables */
1471  width = info->dst_w;
1472  height = info->dst_h;
1473  src = info->src;
1474  srcskip = info->src_skip;
1475  dst = (Uint32 *) info->dst;
1476  dstskip = info->dst_skip / 4;
1477 
1478 #ifdef USE_DUFFS_LOOP
1479  while (height--) {
1480  /* *INDENT-OFF* */
1481  DUFFS_LOOP(
1482  {
1483  *dst++ = RGB565_32(dst, src, map);
1484  src += 2;
1485  },
1486  width);
1487  /* *INDENT-ON* */
1488  src += srcskip;
1489  dst += dstskip;
1490  }
1491 #else
1492  while (height--) {
1493  /* Copy in 4 pixel chunks */
1494  for (c = width / 4; c; --c) {
1495  *dst++ = RGB565_32(dst, src, map);
1496  src += 2;
1497  *dst++ = RGB565_32(dst, src, map);
1498  src += 2;
1499  *dst++ = RGB565_32(dst, src, map);
1500  src += 2;
1501  *dst++ = RGB565_32(dst, src, map);
1502  src += 2;
1503  }
1504  /* Get any leftovers */
1505  switch (width & 3) {
1506  case 3:
1507  *dst++ = RGB565_32(dst, src, map);
1508  src += 2;
1509  case 2:
1510  *dst++ = RGB565_32(dst, src, map);
1511  src += 2;
1512  case 1:
1513  *dst++ = RGB565_32(dst, src, map);
1514  src += 2;
1515  break;
1516  }
1517  src += srcskip;
1518  dst += dstskip;
1519  }
1520 #endif /* USE_DUFFS_LOOP */
1521 }

References SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, map, RGB565_32, SDL_BlitInfo::src, SDL_BlitInfo::src_skip, and USE_DUFFS_LOOP.

Referenced by Blit_RGB565_ABGR8888(), Blit_RGB565_ARGB8888(), Blit_RGB565_BGRA8888(), and Blit_RGB565_RGBA8888().

◆ Blit_RGB565_ABGR8888()

static void Blit_RGB565_ABGR8888 ( SDL_BlitInfo info)
static

Definition at line 1794 of file SDL_blit_N.c.

1795 {
1797 }

References Blit_RGB565_32(), and RGB565_ABGR8888_LUT.

◆ Blit_RGB565_ARGB8888()

static void Blit_RGB565_ARGB8888 ( SDL_BlitInfo info)
static

Definition at line 1656 of file SDL_blit_N.c.

1657 {
1659 }

References Blit_RGB565_32(), and RGB565_ARGB8888_LUT.

◆ Blit_RGB565_BGRA8888()

static void Blit_RGB565_BGRA8888 ( SDL_BlitInfo info)
static

Definition at line 2070 of file SDL_blit_N.c.

2071 {
2073 }

References Blit_RGB565_32(), and RGB565_BGRA8888_LUT.

◆ Blit_RGB565_RGBA8888()

static void Blit_RGB565_RGBA8888 ( SDL_BlitInfo info)
static

Definition at line 1932 of file SDL_blit_N.c.

1933 {
1935 }

References Blit_RGB565_32(), and RGB565_RGBA8888_LUT.

◆ Blit_RGB888_index8()

static void Blit_RGB888_index8 ( SDL_BlitInfo info)
static

Definition at line 989 of file SDL_blit_N.c.

990 {
991 #ifndef USE_DUFFS_LOOP
992  int c;
993 #endif
994  int width, height;
995  Uint32 *src;
996  const Uint8 *map;
997  Uint8 *dst;
998  int srcskip, dstskip;
999 
1000  /* Set up some basic variables */
1001  width = info->dst_w;
1002  height = info->dst_h;
1003  src = (Uint32 *) info->src;
1004  srcskip = info->src_skip / 4;
1005  dst = info->dst;
1006  dstskip = info->dst_skip;
1007  map = info->table;
1008 
1009  if (map == NULL) {
1010  while (height--) {
1011 #ifdef USE_DUFFS_LOOP
1012  /* *INDENT-OFF* */
1013  DUFFS_LOOP(
1014  RGB888_RGB332(*dst++, *src);
1015  , width);
1016  /* *INDENT-ON* */
1017 #else
1018  for (c = width / 4; c; --c) {
1019  /* Pack RGB into 8bit pixel */
1020  ++src;
1021  RGB888_RGB332(*dst++, *src);
1022  ++src;
1023  RGB888_RGB332(*dst++, *src);
1024  ++src;
1025  RGB888_RGB332(*dst++, *src);
1026  ++src;
1027  }
1028  switch (width & 3) {
1029  case 3:
1030  RGB888_RGB332(*dst++, *src);
1031  ++src;
1032  case 2:
1033  RGB888_RGB332(*dst++, *src);
1034  ++src;
1035  case 1:
1036  RGB888_RGB332(*dst++, *src);
1037  ++src;
1038  }
1039 #endif /* USE_DUFFS_LOOP */
1040  src += srcskip;
1041  dst += dstskip;
1042  }
1043  } else {
1044  int Pixel;
1045 
1046  while (height--) {
1047 #ifdef USE_DUFFS_LOOP
1048  /* *INDENT-OFF* */
1049  DUFFS_LOOP(
1050  RGB888_RGB332(Pixel, *src);
1051  *dst++ = map[Pixel];
1052  ++src;
1053  , width);
1054  /* *INDENT-ON* */
1055 #else
1056  for (c = width / 4; c; --c) {
1057  /* Pack RGB into 8bit pixel */
1058  RGB888_RGB332(Pixel, *src);
1059  *dst++ = map[Pixel];
1060  ++src;
1061  RGB888_RGB332(Pixel, *src);
1062  *dst++ = map[Pixel];
1063  ++src;
1064  RGB888_RGB332(Pixel, *src);
1065  *dst++ = map[Pixel];
1066  ++src;
1067  RGB888_RGB332(Pixel, *src);
1068  *dst++ = map[Pixel];
1069  ++src;
1070  }
1071  switch (width & 3) {
1072  case 3:
1073  RGB888_RGB332(Pixel, *src);
1074  *dst++ = map[Pixel];
1075  ++src;
1076  case 2:
1077  RGB888_RGB332(Pixel, *src);
1078  *dst++ = map[Pixel];
1079  ++src;
1080  case 1:
1081  RGB888_RGB332(Pixel, *src);
1082  *dst++ = map[Pixel];
1083  ++src;
1084  }
1085 #endif /* USE_DUFFS_LOOP */
1086  src += srcskip;
1087  dst += dstskip;
1088  }
1089  }
1090 }

References SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, if, map, NULL, RGB888_RGB332, SDL_BlitInfo::src, SDL_BlitInfo::src_skip, and SDL_BlitInfo::table.

Referenced by SDL_CalculateBlitN().

◆ Blit_RGB888_RGB555()

static void Blit_RGB888_RGB555 ( SDL_BlitInfo info)
static

Definition at line 1219 of file SDL_blit_N.c.

1220 {
1221 #ifndef USE_DUFFS_LOOP
1222  int c;
1223 #endif
1224  int width, height;
1225  Uint32 *src;
1226  Uint16 *dst;
1227  int srcskip, dstskip;
1228 
1229  /* Set up some basic variables */
1230  width = info->dst_w;
1231  height = info->dst_h;
1232  src = (Uint32 *) info->src;
1233  srcskip = info->src_skip / 4;
1234  dst = (Uint16 *) info->dst;
1235  dstskip = info->dst_skip / 2;
1236 
1237 #ifdef USE_DUFFS_LOOP
1238  while (height--) {
1239  /* *INDENT-OFF* */
1240  DUFFS_LOOP(
1241  RGB888_RGB555(dst, src);
1242  ++src;
1243  ++dst;
1244  , width);
1245  /* *INDENT-ON* */
1246  src += srcskip;
1247  dst += dstskip;
1248  }
1249 #else
1250  /* Memory align at 4-byte boundary, if necessary */
1251  if ((long) dst & 0x03) {
1252  /* Don't do anything if width is 0 */
1253  if (width == 0) {
1254  return;
1255  }
1256  --width;
1257 
1258  while (height--) {
1259  /* Perform copy alignment */
1260  RGB888_RGB555(dst, src);
1261  ++src;
1262  ++dst;
1263 
1264  /* Copy in 4 pixel chunks */
1265  for (c = width / 4; c; --c) {
1266  RGB888_RGB555_TWO(dst, src);
1267  src += 2;
1268  dst += 2;
1269  RGB888_RGB555_TWO(dst, src);
1270  src += 2;
1271  dst += 2;
1272  }
1273  /* Get any leftovers */
1274  switch (width & 3) {
1275  case 3:
1276  RGB888_RGB555(dst, src);
1277  ++src;
1278  ++dst;
1279  case 2:
1280  RGB888_RGB555_TWO(dst, src);
1281  src += 2;
1282  dst += 2;
1283  break;
1284  case 1:
1285  RGB888_RGB555(dst, src);
1286  ++src;
1287  ++dst;
1288  break;
1289  }
1290  src += srcskip;
1291  dst += dstskip;
1292  }
1293  } else {
1294  while (height--) {
1295  /* Copy in 4 pixel chunks */
1296  for (c = width / 4; c; --c) {
1297  RGB888_RGB555_TWO(dst, src);
1298  src += 2;
1299  dst += 2;
1300  RGB888_RGB555_TWO(dst, src);
1301  src += 2;
1302  dst += 2;
1303  }
1304  /* Get any leftovers */
1305  switch (width & 3) {
1306  case 3:
1307  RGB888_RGB555(dst, src);
1308  ++src;
1309  ++dst;
1310  case 2:
1311  RGB888_RGB555_TWO(dst, src);
1312  src += 2;
1313  dst += 2;
1314  break;
1315  case 1:
1316  RGB888_RGB555(dst, src);
1317  ++src;
1318  ++dst;
1319  break;
1320  }
1321  src += srcskip;
1322  dst += dstskip;
1323  }
1324  }
1325 #endif /* USE_DUFFS_LOOP */
1326 }

References SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, RGB888_RGB555, SDL_BlitInfo::src, and SDL_BlitInfo::src_skip.

◆ Blit_RGB888_RGB565()

static void Blit_RGB888_RGB565 ( SDL_BlitInfo info)
static

Definition at line 1345 of file SDL_blit_N.c.

1346 {
1347 #ifndef USE_DUFFS_LOOP
1348  int c;
1349 #endif
1350  int width, height;
1351  Uint32 *src;
1352  Uint16 *dst;
1353  int srcskip, dstskip;
1354 
1355  /* Set up some basic variables */
1356  width = info->dst_w;
1357  height = info->dst_h;
1358  src = (Uint32 *) info->src;
1359  srcskip = info->src_skip / 4;
1360  dst = (Uint16 *) info->dst;
1361  dstskip = info->dst_skip / 2;
1362 
1363 #ifdef USE_DUFFS_LOOP
1364  while (height--) {
1365  /* *INDENT-OFF* */
1366  DUFFS_LOOP(
1367  RGB888_RGB565(dst, src);
1368  ++src;
1369  ++dst;
1370  , width);
1371  /* *INDENT-ON* */
1372  src += srcskip;
1373  dst += dstskip;
1374  }
1375 #else
1376  /* Memory align at 4-byte boundary, if necessary */
1377  if ((long) dst & 0x03) {
1378  /* Don't do anything if width is 0 */
1379  if (width == 0) {
1380  return;
1381  }
1382  --width;
1383 
1384  while (height--) {
1385  /* Perform copy alignment */
1386  RGB888_RGB565(dst, src);
1387  ++src;
1388  ++dst;
1389 
1390  /* Copy in 4 pixel chunks */
1391  for (c = width / 4; c; --c) {
1392  RGB888_RGB565_TWO(dst, src);
1393  src += 2;
1394  dst += 2;
1395  RGB888_RGB565_TWO(dst, src);
1396  src += 2;
1397  dst += 2;
1398  }
1399  /* Get any leftovers */
1400  switch (width & 3) {
1401  case 3:
1402  RGB888_RGB565(dst, src);
1403  ++src;
1404  ++dst;
1405  case 2:
1406  RGB888_RGB565_TWO(dst, src);
1407  src += 2;
1408  dst += 2;
1409  break;
1410  case 1:
1411  RGB888_RGB565(dst, src);
1412  ++src;
1413  ++dst;
1414  break;
1415  }
1416  src += srcskip;
1417  dst += dstskip;
1418  }
1419  } else {
1420  while (height--) {
1421  /* Copy in 4 pixel chunks */
1422  for (c = width / 4; c; --c) {
1423  RGB888_RGB565_TWO(dst, src);
1424  src += 2;
1425  dst += 2;
1426  RGB888_RGB565_TWO(dst, src);
1427  src += 2;
1428  dst += 2;
1429  }
1430  /* Get any leftovers */
1431  switch (width & 3) {
1432  case 3:
1433  RGB888_RGB565(dst, src);
1434  ++src;
1435  ++dst;
1436  case 2:
1437  RGB888_RGB565_TWO(dst, src);
1438  src += 2;
1439  dst += 2;
1440  break;
1441  case 1:
1442  RGB888_RGB565(dst, src);
1443  ++src;
1444  ++dst;
1445  break;
1446  }
1447  src += srcskip;
1448  dst += dstskip;
1449  }
1450  }
1451 #endif /* USE_DUFFS_LOOP */
1452 }

References SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, RGB888_RGB565, SDL_BlitInfo::src, and SDL_BlitInfo::src_skip.

◆ BlitNto1()

static void BlitNto1 ( SDL_BlitInfo info)
static

Definition at line 2078 of file SDL_blit_N.c.

2079 {
2080 #ifndef USE_DUFFS_LOOP
2081  int c;
2082 #endif
2083  int width, height;
2084  Uint8 *src;
2085  const Uint8 *map;
2086  Uint8 *dst;
2087  int srcskip, dstskip;
2088  int srcbpp;
2089  Uint32 Pixel;
2090  int sR, sG, sB;
2091  SDL_PixelFormat *srcfmt;
2092 
2093  /* Set up some basic variables */
2094  width = info->dst_w;
2095  height = info->dst_h;
2096  src = info->src;
2097  srcskip = info->src_skip;
2098  dst = info->dst;
2099  dstskip = info->dst_skip;
2100  map = info->table;
2101  srcfmt = info->src_fmt;
2102  srcbpp = srcfmt->BytesPerPixel;
2103 
2104  if (map == NULL) {
2105  while (height--) {
2106 #ifdef USE_DUFFS_LOOP
2107  /* *INDENT-OFF* */
2108  DUFFS_LOOP(
2109  DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
2110  sR, sG, sB);
2111  if ( 1 ) {
2112  /* Pack RGB into 8bit pixel */
2113  *dst = ((sR>>5)<<(3+2))|
2114  ((sG>>5)<<(2)) |
2115  ((sB>>6)<<(0)) ;
2116  }
2117  dst++;
2118  src += srcbpp;
2119  , width);
2120  /* *INDENT-ON* */
2121 #else
2122  for (c = width; c; --c) {
2123  DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
2124  if (1) {
2125  /* Pack RGB into 8bit pixel */
2126  *dst = ((sR >> 5) << (3 + 2)) |
2127  ((sG >> 5) << (2)) | ((sB >> 6) << (0));
2128  }
2129  dst++;
2130  src += srcbpp;
2131  }
2132 #endif
2133  src += srcskip;
2134  dst += dstskip;
2135  }
2136  } else {
2137  while (height--) {
2138 #ifdef USE_DUFFS_LOOP
2139  /* *INDENT-OFF* */
2140  DUFFS_LOOP(
2141  DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
2142  sR, sG, sB);
2143  if ( 1 ) {
2144  /* Pack RGB into 8bit pixel */
2145  *dst = map[((sR>>5)<<(3+2))|
2146  ((sG>>5)<<(2)) |
2147  ((sB>>6)<<(0)) ];
2148  }
2149  dst++;
2150  src += srcbpp;
2151  , width);
2152  /* *INDENT-ON* */
2153 #else
2154  for (c = width; c; --c) {
2155  DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
2156  if (1) {
2157  /* Pack RGB into 8bit pixel */
2158  *dst = map[((sR >> 5) << (3 + 2)) |
2159  ((sG >> 5) << (2)) | ((sB >> 6) << (0))];
2160  }
2161  dst++;
2162  src += srcbpp;
2163  }
2164 #endif /* USE_DUFFS_LOOP */
2165  src += srcskip;
2166  dst += dstskip;
2167  }
2168  }
2169 }

References SDL_PixelFormat::BytesPerPixel, DISEMBLE_RGB, SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, map, NULL, SDL_BlitInfo::src, SDL_BlitInfo::src_fmt, SDL_BlitInfo::src_skip, and SDL_BlitInfo::table.

Referenced by SDL_CalculateBlitN().

◆ BlitNto1Key()

static void BlitNto1Key ( SDL_BlitInfo info)
static

Definition at line 2507 of file SDL_blit_N.c.

2508 {
2509  int width = info->dst_w;
2510  int height = info->dst_h;
2511  Uint8 *src = info->src;
2512  int srcskip = info->src_skip;
2513  Uint8 *dst = info->dst;
2514  int dstskip = info->dst_skip;
2515  SDL_PixelFormat *srcfmt = info->src_fmt;
2516  const Uint8 *palmap = info->table;
2517  Uint32 ckey = info->colorkey;
2518  Uint32 rgbmask = ~srcfmt->Amask;
2519  int srcbpp;
2520  Uint32 Pixel;
2521  unsigned sR, sG, sB;
2522 
2523  /* Set up some basic variables */
2524  srcbpp = srcfmt->BytesPerPixel;
2525  ckey &= rgbmask;
2526 
2527  if (palmap == NULL) {
2528  while (height--) {
2529  /* *INDENT-OFF* */
2530  DUFFS_LOOP(
2531  {
2532  DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
2533  sR, sG, sB);
2534  if ( (Pixel & rgbmask) != ckey ) {
2535  /* Pack RGB into 8bit pixel */
2536  *dst = (Uint8)(((sR>>5)<<(3+2))|
2537  ((sG>>5)<<(2)) |
2538  ((sB>>6)<<(0)));
2539  }
2540  dst++;
2541  src += srcbpp;
2542  },
2543  width);
2544  /* *INDENT-ON* */
2545  src += srcskip;
2546  dst += dstskip;
2547  }
2548  } else {
2549  while (height--) {
2550  /* *INDENT-OFF* */
2551  DUFFS_LOOP(
2552  {
2553  DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
2554  sR, sG, sB);
2555  if ( (Pixel & rgbmask) != ckey ) {
2556  /* Pack RGB into 8bit pixel */
2557  *dst = (Uint8)palmap[((sR>>5)<<(3+2))|
2558  ((sG>>5)<<(2)) |
2559  ((sB>>6)<<(0)) ];
2560  }
2561  dst++;
2562  src += srcbpp;
2563  },
2564  width);
2565  /* *INDENT-ON* */
2566  src += srcskip;
2567  dst += dstskip;
2568  }
2569  }
2570 }

References SDL_PixelFormat::Amask, SDL_PixelFormat::BytesPerPixel, SDL_BlitInfo::colorkey, DISEMBLE_RGB, SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, NULL, SDL_BlitInfo::src, SDL_BlitInfo::src_fmt, SDL_BlitInfo::src_skip, and SDL_BlitInfo::table.

Referenced by SDL_CalculateBlitN().

◆ BlitNto2101010()

static void BlitNto2101010 ( SDL_BlitInfo info)
static

Definition at line 3015 of file SDL_blit_N.c.

3016 {
3017  int width = info->dst_w;
3018  int height = info->dst_h;
3019  Uint8 *src = info->src;
3020  int srcskip = info->src_skip;
3021  Uint8 *dst = info->dst;
3022  int dstskip = info->dst_skip;
3023  SDL_PixelFormat *srcfmt = info->src_fmt;
3024  int srcbpp = srcfmt->BytesPerPixel;
3025  Uint32 Pixel;
3026  unsigned sR, sG, sB, sA;
3027 
3028  while (height--) {
3029  /* *INDENT-OFF* */
3030  DUFFS_LOOP(
3031  {
3032  DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
3033  ARGB2101010_FROM_RGBA(Pixel, sR, sG, sB, sA);
3034  *(Uint32 *)dst = Pixel;
3035  dst += 4;
3036  src += srcbpp;
3037  },
3038  width);
3039  /* *INDENT-ON* */
3040  src += srcskip;
3041  dst += dstskip;
3042  }
3043 }

References ARGB2101010_FROM_RGBA, SDL_PixelFormat::BytesPerPixel, DISEMBLE_RGBA, SDL_BlitInfo::dst, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, SDL_BlitInfo::src, SDL_BlitInfo::src_fmt, and SDL_BlitInfo::src_skip.

Referenced by SDL_CalculateBlitN().

◆ BlitNtoN()

static void BlitNtoN ( SDL_BlitInfo info)
static

Definition at line 2330 of file SDL_blit_N.c.

2331 {
2332  int width = info->dst_w;
2333  int height = info->dst_h;
2334  Uint8 *src = info->src;
2335  int srcskip = info->src_skip;
2336  Uint8 *dst = info->dst;
2337  int dstskip = info->dst_skip;
2338  SDL_PixelFormat *srcfmt = info->src_fmt;
2339  int srcbpp = srcfmt->BytesPerPixel;
2340  SDL_PixelFormat *dstfmt = info->dst_fmt;
2341  int dstbpp = dstfmt->BytesPerPixel;
2342  unsigned alpha = dstfmt->Amask ? info->a : 0;
2343 
2344 #if HAVE_FAST_WRITE_INT8
2345  /* Blit with permutation: 4->4 */
2346  if (srcbpp == 4 && dstbpp == 4 &&
2347  srcfmt->format != SDL_PIXELFORMAT_ARGB2101010 &&
2348  dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) {
2349 
2350  /* Find the appropriate permutation */
2351  int alpha_channel, p0, p1, p2, p3;
2352  get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, &alpha_channel);
2353 
2354  while (height--) {
2355  /* *INDENT-OFF* */
2356  DUFFS_LOOP(
2357  {
2358  dst[0] = src[p0];
2359  dst[1] = src[p1];
2360  dst[2] = src[p2];
2361  dst[3] = src[p3];
2362  dst[alpha_channel] = alpha;
2363  src += 4;
2364  dst += 4;
2365  }, width);
2366  /* *INDENT-ON* */
2367  src += srcskip;
2368  dst += dstskip;
2369  }
2370  return;
2371  }
2372 #endif
2373 
2374  /* Blit with permutation: 4->3 */
2375  if (srcbpp == 4 && dstbpp == 3 &&
2376  srcfmt->format != SDL_PIXELFORMAT_ARGB2101010) {
2377 
2378  /* Find the appropriate permutation */
2379  int p0, p1, p2, p3;
2380  get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, NULL);
2381 
2382  while (height--) {
2383  /* *INDENT-OFF* */
2384  DUFFS_LOOP(
2385  {
2386  dst[0] = src[p0];
2387  dst[1] = src[p1];
2388  dst[2] = src[p2];
2389  src += 4;
2390  dst += 3;
2391  }, width);
2392  /* *INDENT-ON* */
2393  src += srcskip;
2394  dst += dstskip;
2395  }
2396  return;
2397  }
2398 
2399 #if HAVE_FAST_WRITE_INT8
2400  /* Blit with permutation: 3->4 */
2401  if (srcbpp == 3 && dstbpp == 4 &&
2402  dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) {
2403 
2404  /* Find the appropriate permutation */
2405  int alpha_channel, p0, p1, p2, p3;
2406  get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, &alpha_channel);
2407 
2408  while (height--) {
2409  /* *INDENT-OFF* */
2410  DUFFS_LOOP(
2411  {
2412  dst[0] = src[p0];
2413  dst[1] = src[p1];
2414  dst[2] = src[p2];
2415  dst[3] = src[p3];
2416  dst[alpha_channel] = alpha;
2417  src += 3;
2418  dst += 4;
2419  }, width);
2420  /* *INDENT-ON* */
2421  src += srcskip;
2422  dst += dstskip;
2423  }
2424  return;
2425  }
2426 #endif
2427 
2428  while (height--) {
2429  /* *INDENT-OFF* */
2430  DUFFS_LOOP(
2431  {
2432  Uint32 Pixel;
2433  unsigned sR;
2434  unsigned sG;
2435  unsigned sB;
2436  DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
2437  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, alpha);
2438  dst += dstbpp;
2439  src += srcbpp;
2440  },
2441  width);
2442  /* *INDENT-ON* */
2443  src += srcskip;
2444  dst += dstskip;
2445  }
2446 }

References SDL_BlitInfo::a, SDL_PixelFormat::Amask, ASSEMBLE_RGBA, SDL_PixelFormat::BytesPerPixel, DISEMBLE_RGB, SDL_BlitInfo::dst, SDL_BlitInfo::dst_fmt, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, SDL_PixelFormat::format, get_permutation(), NULL, SDL_PIXELFORMAT_ARGB2101010, SDL_BlitInfo::src, SDL_BlitInfo::src_fmt, and SDL_BlitInfo::src_skip.

Referenced by SDL_CalculateBlitN().

◆ BlitNtoNCopyAlpha()

static void BlitNtoNCopyAlpha ( SDL_BlitInfo info)
static

Definition at line 2449 of file SDL_blit_N.c.

2450 {
2451  int width = info->dst_w;
2452  int height = info->dst_h;
2453  Uint8 *src = info->src;
2454  int srcskip = info->src_skip;
2455  Uint8 *dst = info->dst;
2456  int dstskip = info->dst_skip;
2457  SDL_PixelFormat *srcfmt = info->src_fmt;
2458  int srcbpp = srcfmt->BytesPerPixel;
2459  SDL_PixelFormat *dstfmt = info->dst_fmt;
2460  int dstbpp = dstfmt->BytesPerPixel;
2461  int c;
2462 
2463 #if HAVE_FAST_WRITE_INT8
2464  /* Blit with permutation: 4->4 */
2465  if (srcbpp == 4 && dstbpp == 4 &&
2466  srcfmt->format != SDL_PIXELFORMAT_ARGB2101010 &&
2467  dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) {
2468 
2469  /* Find the appropriate permutation */
2470  int p0, p1, p2, p3;
2471  get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, NULL);
2472 
2473  while (height--) {
2474  /* *INDENT-OFF* */
2475  DUFFS_LOOP(
2476  {
2477  dst[0] = src[p0];
2478  dst[1] = src[p1];
2479  dst[2] = src[p2];
2480  dst[3] = src[p3];
2481  src += 4;
2482  dst += 4;
2483  }, width);
2484  /* *INDENT-ON* */
2485  src += srcskip;
2486  dst += dstskip;
2487  }
2488  return;
2489  }
2490 #endif
2491 
2492  while (height--) {
2493  for (c = width; c; --c) {
2494  Uint32 Pixel;
2495  unsigned sR, sG, sB, sA;
2496  DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
2497  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA);
2498  dst += dstbpp;
2499  src += srcbpp;
2500  }
2501  src += srcskip;
2502  dst += dstskip;
2503  }
2504 }

References ASSEMBLE_RGBA, SDL_PixelFormat::BytesPerPixel, DISEMBLE_RGBA, SDL_BlitInfo::dst, SDL_BlitInfo::dst_fmt, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, SDL_PixelFormat::format, get_permutation(), NULL, SDL_PIXELFORMAT_ARGB2101010, SDL_BlitInfo::src, SDL_BlitInfo::src_fmt, and SDL_BlitInfo::src_skip.

Referenced by SDL_CalculateBlitN().

◆ BlitNtoNKey()

static void BlitNtoNKey ( SDL_BlitInfo info)
static

Definition at line 2607 of file SDL_blit_N.c.

2608 {
2609  int width = info->dst_w;
2610  int height = info->dst_h;
2611  Uint8 *src = info->src;
2612  int srcskip = info->src_skip;
2613  Uint8 *dst = info->dst;
2614  int dstskip = info->dst_skip;
2615  Uint32 ckey = info->colorkey;
2616  SDL_PixelFormat *srcfmt = info->src_fmt;
2617  SDL_PixelFormat *dstfmt = info->dst_fmt;
2618  int srcbpp = srcfmt->BytesPerPixel;
2619  int dstbpp = dstfmt->BytesPerPixel;
2620  unsigned alpha = dstfmt->Amask ? info->a : 0;
2621  Uint32 rgbmask = ~srcfmt->Amask;
2622  int sfmt = srcfmt->format;
2623  int dfmt = dstfmt->format;
2624 
2625  /* Set up some basic variables */
2626  ckey &= rgbmask;
2627 
2628  /* BPP 4, same rgb */
2629  if (srcbpp == 4 && dstbpp == 4 && srcfmt->Rmask == dstfmt->Rmask && srcfmt->Gmask == dstfmt->Gmask && srcfmt->Bmask == dstfmt->Bmask) {
2630  Uint32 *src32 = (Uint32*)src;
2631  Uint32 *dst32 = (Uint32*)dst;
2632 
2633  if (dstfmt->Amask) {
2634  /* RGB->RGBA, SET_ALPHA */
2635  Uint32 mask = info->a << dstfmt->Ashift;
2636  while (height--) {
2637  /* *INDENT-OFF* */
2638  DUFFS_LOOP(
2639  {
2640  if ((*src32 & rgbmask) != ckey) {
2641  *dst32 = *src32 | mask;
2642  }
2643  ++dst32;
2644  ++src32;
2645  }, width);
2646  /* *INDENT-ON* */
2647  src32 = (Uint32 *) ((Uint8 *) src32 + srcskip);
2648  dst32 = (Uint32 *) ((Uint8 *) dst32 + dstskip);
2649  }
2650  return;
2651  } else {
2652  /* RGBA->RGB, NO_ALPHA */
2653  Uint32 mask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
2654  while (height--) {
2655  /* *INDENT-OFF* */
2656  DUFFS_LOOP(
2657  {
2658  if ((*src32 & rgbmask) != ckey) {
2659  *dst32 = *src32 & mask;
2660  }
2661  ++dst32;
2662  ++src32;
2663  }, width);
2664  /* *INDENT-ON* */
2665  src32 = (Uint32 *) ((Uint8 *) src32 + srcskip);
2666  dst32 = (Uint32 *) ((Uint8 *) dst32 + dstskip);
2667  }
2668  return;
2669  }
2670  }
2671 
2672 #if HAVE_FAST_WRITE_INT8
2673  /* Blit with permutation: 4->4 */
2674  if (srcbpp == 4 && dstbpp == 4 &&
2675  srcfmt->format != SDL_PIXELFORMAT_ARGB2101010 &&
2676  dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) {
2677 
2678  /* Find the appropriate permutation */
2679  int alpha_channel, p0, p1, p2, p3;
2680  get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, &alpha_channel);
2681 
2682  while (height--) {
2683  /* *INDENT-OFF* */
2684  DUFFS_LOOP(
2685  {
2686  Uint32 *src32 = (Uint32*)src;
2687 
2688  if ((*src32 & rgbmask) != ckey) {
2689  dst[0] = src[p0];
2690  dst[1] = src[p1];
2691  dst[2] = src[p2];
2692  dst[3] = src[p3];
2693  dst[alpha_channel] = alpha;
2694  }
2695  src += 4;
2696  dst += 4;
2697  }, width);
2698  /* *INDENT-ON* */
2699  src += srcskip;
2700  dst += dstskip;
2701  }
2702  return;
2703  }
2704 #endif
2705 
2706  /* BPP 3, same rgb triplet */
2707  if ((sfmt == SDL_PIXELFORMAT_RGB24 && dfmt == SDL_PIXELFORMAT_RGB24) ||
2708  (sfmt == SDL_PIXELFORMAT_BGR24 && dfmt == SDL_PIXELFORMAT_BGR24)) {
2709 
2710 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
2711  Uint8 k0 = ckey & 0xFF;
2712  Uint8 k1 = (ckey >> 8) & 0xFF;
2713  Uint8 k2 = (ckey >> 16) & 0xFF;
2714 #else
2715  Uint8 k0 = (ckey >> 16) & 0xFF;
2716  Uint8 k1 = (ckey >> 8) & 0xFF;
2717  Uint8 k2 = ckey & 0xFF;
2718 #endif
2719 
2720  while (height--) {
2721  /* *INDENT-OFF* */
2722  DUFFS_LOOP(
2723  {
2724  Uint8 s0 = src[0];
2725  Uint8 s1 = src[1];
2726  Uint8 s2 = src[2];
2727 
2728  if (k0 != s0 || k1 != s1 || k2 != s2) {
2729  dst[0] = s0;
2730  dst[1] = s1;
2731  dst[2] = s2;
2732  }
2733  src += 3;
2734  dst += 3;
2735  },
2736  width);
2737  /* *INDENT-ON* */
2738  src += srcskip;
2739  dst += dstskip;
2740  }
2741  return;
2742  }
2743 
2744  /* BPP 3, inversed rgb triplet */
2745  if ((sfmt == SDL_PIXELFORMAT_RGB24 && dfmt == SDL_PIXELFORMAT_BGR24) ||
2746  (sfmt == SDL_PIXELFORMAT_BGR24 && dfmt == SDL_PIXELFORMAT_RGB24)) {
2747 
2748 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
2749  Uint8 k0 = ckey & 0xFF;
2750  Uint8 k1 = (ckey >> 8) & 0xFF;
2751  Uint8 k2 = (ckey >> 16) & 0xFF;
2752 #else
2753  Uint8 k0 = (ckey >> 16) & 0xFF;
2754  Uint8 k1 = (ckey >> 8) & 0xFF;
2755  Uint8 k2 = ckey & 0xFF;
2756 #endif
2757 
2758  while (height--) {
2759  /* *INDENT-OFF* */
2760  DUFFS_LOOP(
2761  {
2762  Uint8 s0 = src[0];
2763  Uint8 s1 = src[1];
2764  Uint8 s2 = src[2];
2765  if (k0 != s0 || k1 != s1 || k2 != s2) {
2766  /* Inversed RGB */
2767  dst[0] = s2;
2768  dst[1] = s1;
2769  dst[2] = s0;
2770  }
2771  src += 3;
2772  dst += 3;
2773  },
2774  width);
2775  /* *INDENT-ON* */
2776  src += srcskip;
2777  dst += dstskip;
2778  }
2779  return;
2780  }
2781 
2782  /* Blit with permutation: 4->3 */
2783  if (srcbpp == 4 && dstbpp == 3 &&
2784  srcfmt->format != SDL_PIXELFORMAT_ARGB2101010) {
2785 
2786  /* Find the appropriate permutation */
2787  int p0, p1, p2, p3;
2788  get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, NULL);
2789 
2790  while (height--) {
2791  /* *INDENT-OFF* */
2792  DUFFS_LOOP(
2793  {
2794  Uint32 *src32 = (Uint32*)src;
2795  if ((*src32 & rgbmask) != ckey) {
2796  dst[0] = src[p0];
2797  dst[1] = src[p1];
2798  dst[2] = src[p2];
2799  }
2800  src += 4;
2801  dst += 3;
2802  }, width);
2803  /* *INDENT-ON* */
2804  src += srcskip;
2805  dst += dstskip;
2806  }
2807  return;
2808  }
2809 
2810 #if HAVE_FAST_WRITE_INT8
2811  /* Blit with permutation: 3->4 */
2812  if (srcbpp == 3 && dstbpp == 4 &&
2813  dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) {
2814 
2815 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
2816  Uint8 k0 = ckey & 0xFF;
2817  Uint8 k1 = (ckey >> 8) & 0xFF;
2818  Uint8 k2 = (ckey >> 16) & 0xFF;
2819 #else
2820  Uint8 k0 = (ckey >> 16) & 0xFF;
2821  Uint8 k1 = (ckey >> 8) & 0xFF;
2822  Uint8 k2 = ckey & 0xFF;
2823 #endif
2824 
2825  /* Find the appropriate permutation */
2826  int alpha_channel, p0, p1, p2, p3;
2827  get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, &alpha_channel);
2828 
2829  while (height--) {
2830  /* *INDENT-OFF* */
2831  DUFFS_LOOP(
2832  {
2833  Uint8 s0 = src[0];
2834  Uint8 s1 = src[1];
2835  Uint8 s2 = src[2];
2836 
2837  if (k0 != s0 || k1 != s1 || k2 != s2) {
2838  dst[0] = src[p0];
2839  dst[1] = src[p1];
2840  dst[2] = src[p2];
2841  dst[3] = src[p3];
2842  dst[alpha_channel] = alpha;
2843  }
2844  src += 3;
2845  dst += 4;
2846  }, width);
2847  /* *INDENT-ON* */
2848  src += srcskip;
2849  dst += dstskip;
2850  }
2851  return;
2852  }
2853 #endif
2854 
2855  while (height--) {
2856  /* *INDENT-OFF* */
2857  DUFFS_LOOP(
2858  {
2859  Uint32 Pixel;
2860  unsigned sR;
2861  unsigned sG;
2862  unsigned sB;
2863  RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel);
2864  if ( (Pixel & rgbmask) != ckey ) {
2865  RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB);
2866  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, alpha);
2867  }
2868  dst += dstbpp;
2869  src += srcbpp;
2870  },
2871  width);
2872  /* *INDENT-ON* */
2873  src += srcskip;
2874  dst += dstskip;
2875  }
2876 }

References SDL_BlitInfo::a, SDL_PixelFormat::Amask, SDL_PixelFormat::Ashift, ASSEMBLE_RGBA, SDL_PixelFormat::Bmask, SDL_PixelFormat::BytesPerPixel, SDL_BlitInfo::colorkey, SDL_BlitInfo::dst, SDL_BlitInfo::dst_fmt, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, SDL_PixelFormat::format, get_permutation(), SDL_PixelFormat::Gmask, NULL, RETRIEVE_RGB_PIXEL, RGB_FROM_PIXEL, SDL_PixelFormat::Rmask, SDL_PIXELFORMAT_ARGB2101010, SDL_PIXELFORMAT_BGR24, SDL_PIXELFORMAT_RGB24, SDL_BlitInfo::src, SDL_BlitInfo::src_fmt, and SDL_BlitInfo::src_skip.

Referenced by SDL_CalculateBlitN().

◆ BlitNtoNKeyCopyAlpha()

static void BlitNtoNKeyCopyAlpha ( SDL_BlitInfo info)
static

Definition at line 2879 of file SDL_blit_N.c.

2880 {
2881  int width = info->dst_w;
2882  int height = info->dst_h;
2883  Uint8 *src = info->src;
2884  int srcskip = info->src_skip;
2885  Uint8 *dst = info->dst;
2886  int dstskip = info->dst_skip;
2887  Uint32 ckey = info->colorkey;
2888  SDL_PixelFormat *srcfmt = info->src_fmt;
2889  SDL_PixelFormat *dstfmt = info->dst_fmt;
2890  Uint32 rgbmask = ~srcfmt->Amask;
2891 
2892  Uint8 srcbpp;
2893  Uint8 dstbpp;
2894  Uint32 Pixel;
2895  unsigned sR, sG, sB, sA;
2896 
2897  /* Set up some basic variables */
2898  srcbpp = srcfmt->BytesPerPixel;
2899  dstbpp = dstfmt->BytesPerPixel;
2900  ckey &= rgbmask;
2901 
2902  /* Fastpath: same source/destination format, with Amask, bpp 32, loop is vectorized. ~10x faster */
2903  if (srcfmt->format == dstfmt->format) {
2904 
2905  if (srcfmt->format == SDL_PIXELFORMAT_ARGB8888 ||
2906  srcfmt->format == SDL_PIXELFORMAT_ABGR8888 ||
2907  srcfmt->format == SDL_PIXELFORMAT_BGRA8888 ||
2908  srcfmt->format == SDL_PIXELFORMAT_RGBA8888) {
2909 
2910  Uint32 *src32 = (Uint32*)src;
2911  Uint32 *dst32 = (Uint32*)dst;
2912  while (height--) {
2913  /* *INDENT-OFF* */
2914  DUFFS_LOOP(
2915  {
2916  if ((*src32 & rgbmask) != ckey) {
2917  *dst32 = *src32;
2918  }
2919  ++src32;
2920  ++dst32;
2921  },
2922  width);
2923  /* *INDENT-ON* */
2924  src32 = (Uint32 *)((Uint8 *)src32 + srcskip);
2925  dst32 = (Uint32 *)((Uint8 *)dst32 + dstskip);
2926  }
2927  }
2928  return;
2929  }
2930 
2931 #if HAVE_FAST_WRITE_INT8
2932  /* Blit with permutation: 4->4 */
2933  if (srcbpp == 4 && dstbpp == 4 &&
2934  srcfmt->format != SDL_PIXELFORMAT_ARGB2101010 &&
2935  dstfmt->format != SDL_PIXELFORMAT_ARGB2101010) {
2936 
2937  /* Find the appropriate permutation */
2938  int p0, p1, p2, p3;
2939  get_permutation(srcfmt, dstfmt, &p0, &p1, &p2, &p3, NULL);
2940 
2941  while (height--) {
2942  /* *INDENT-OFF* */
2943  DUFFS_LOOP(
2944  {
2945  Uint32 *src32 = (Uint32*)src;
2946  if ((*src32 & rgbmask) != ckey) {
2947  dst[0] = src[p0];
2948  dst[1] = src[p1];
2949  dst[2] = src[p2];
2950  dst[3] = src[p3];
2951  }
2952  src += 4;
2953  dst += 4;
2954  }, width);
2955  /* *INDENT-ON* */
2956  src += srcskip;
2957  dst += dstskip;
2958  }
2959  return;
2960  }
2961 #endif
2962 
2963  while (height--) {
2964  /* *INDENT-OFF* */
2965  DUFFS_LOOP(
2966  {
2967  DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
2968  if ( (Pixel & rgbmask) != ckey ) {
2969  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA);
2970  }
2971  dst += dstbpp;
2972  src += srcbpp;
2973  },
2974  width);
2975  /* *INDENT-ON* */
2976  src += srcskip;
2977  dst += dstskip;
2978  }
2979 }

References SDL_PixelFormat::Amask, ASSEMBLE_RGBA, SDL_PixelFormat::BytesPerPixel, SDL_BlitInfo::colorkey, DISEMBLE_RGBA, SDL_BlitInfo::dst, SDL_BlitInfo::dst_fmt, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, SDL_PixelFormat::format, get_permutation(), NULL, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB2101010, SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_RGBA8888, SDL_BlitInfo::src, SDL_BlitInfo::src_fmt, and SDL_BlitInfo::src_skip.

Referenced by SDL_CalculateBlitN().

◆ get_permutation()

static void get_permutation ( SDL_PixelFormat srcfmt,
SDL_PixelFormat dstfmt,
int *  _p0,
int *  _p1,
int *  _p2,
int *  _p3,
int *  _alpha_channel 
)
static

Definition at line 2250 of file SDL_blit_N.c.

2252 {
2253  int alpha_channel = 0, p0, p1, p2, p3;
2254 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
2255  int Pixel = 0x04030201; /* identity permutation */
2256 #else
2257  int Pixel = 0x01020304; /* identity permutation */
2258  int srcbpp = srcfmt->BytesPerPixel;
2259  int dstbpp = dstfmt->BytesPerPixel;
2260 #endif
2261 
2262  if (srcfmt->Amask) {
2263  RGBA_FROM_PIXEL(Pixel, srcfmt, p0, p1, p2, p3);
2264  } else {
2265  RGB_FROM_PIXEL(Pixel, srcfmt, p0, p1, p2);
2266  p3 = 0;
2267  }
2268 
2269  if (dstfmt->Amask) {
2270  if (srcfmt->Amask) {
2271  PIXEL_FROM_RGBA(Pixel, dstfmt, p0, p1, p2, p3);
2272  } else {
2273  PIXEL_FROM_RGBA(Pixel, dstfmt, p0, p1, p2, 0);
2274  }
2275  } else {
2276  PIXEL_FROM_RGB(Pixel, dstfmt, p0, p1, p2);
2277  }
2278 
2279 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
2280  p0 = Pixel & 0xFF;
2281  p1 = (Pixel >> 8) & 0xFF;
2282  p2 = (Pixel >> 16) & 0xFF;
2283  p3 = (Pixel >> 24) & 0xFF;
2284 #else
2285  p3 = Pixel & 0xFF;
2286  p2 = (Pixel >> 8) & 0xFF;
2287  p1 = (Pixel >> 16) & 0xFF;
2288  p0 = (Pixel >> 24) & 0xFF;
2289 #endif
2290 
2291  if (p0 == 0) {
2292  p0 = 1;
2293  alpha_channel = 0;
2294  } else if (p1 == 0) {
2295  p1 = 1;
2296  alpha_channel = 1;
2297  } else if (p2 == 0) {
2298  p2 = 1;
2299  alpha_channel = 2;
2300  } else if (p3 == 0) {
2301  p3 = 1;
2302  alpha_channel = 3;
2303  }
2304 
2305 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
2306 #else
2307  if (srcbpp == 3 && dstbpp == 4) {
2308  if (p0 != 1) p0--;
2309  if (p1 != 1) p1--;
2310  if (p2 != 1) p2--;
2311  if (p3 != 1) p3--;
2312  } else if (srcbpp == 4 && dstbpp == 3) {
2313  p0 = p1;
2314  p1 = p2;
2315  p2 = p3;
2316  }
2317 #endif
2318  *_p0 = p0 - 1;
2319  *_p1 = p1 - 1;
2320  *_p2 = p2 - 1;
2321  *_p3 = p3 - 1;
2322 
2323  if (_alpha_channel) {
2324  *_alpha_channel = alpha_channel;
2325  }
2326 }

References SDL_PixelFormat::Amask, SDL_PixelFormat::BytesPerPixel, PIXEL_FROM_RGB, PIXEL_FROM_RGBA, RGB_FROM_PIXEL, and RGBA_FROM_PIXEL.

Referenced by BlitNtoN(), BlitNtoNCopyAlpha(), BlitNtoNKey(), and BlitNtoNKeyCopyAlpha().

◆ SDL_CalculateBlitN()

SDL_BlitFunc SDL_CalculateBlitN ( SDL_Surface surface)

Definition at line 3360 of file SDL_blit_N.c.

3361 {
3362  SDL_PixelFormat *srcfmt;
3363  SDL_PixelFormat *dstfmt;
3364  const struct blit_table *table;
3365  int which;
3366  SDL_BlitFunc blitfun;
3367 
3368  /* Set up data for choosing the blit */
3369  srcfmt = surface->format;
3370  dstfmt = surface->map->dst->format;
3371 
3372  /* We don't support destinations less than 8-bits */
3373  if (dstfmt->BitsPerPixel < 8) {
3374  return (NULL);
3375  }
3376 
3377  switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
3378  case 0:
3379  blitfun = NULL;
3380  if (dstfmt->BitsPerPixel == 8) {
3381  if ((srcfmt->BytesPerPixel == 4) &&
3382  (srcfmt->Rmask == 0x00FF0000) &&
3383  (srcfmt->Gmask == 0x0000FF00) &&
3384  (srcfmt->Bmask == 0x000000FF)) {
3385  blitfun = Blit_RGB888_index8;
3386  } else if ((srcfmt->BytesPerPixel == 4) &&
3387  (srcfmt->Rmask == 0x3FF00000) &&
3388  (srcfmt->Gmask == 0x000FFC00) &&
3389  (srcfmt->Bmask == 0x000003FF)) {
3390  blitfun = Blit_RGB101010_index8;
3391  } else {
3392  blitfun = BlitNto1;
3393  }
3394  } else {
3395  /* Now the meat, choose the blitter we want */
3396  Uint32 a_need = NO_ALPHA;
3397  if (dstfmt->Amask)
3398  a_need = srcfmt->Amask ? COPY_ALPHA : SET_ALPHA;
3399  table = normal_blit[srcfmt->BytesPerPixel - 1];
3400  for (which = 0; table[which].dstbpp; ++which) {
3401  if (MASKOK(srcfmt->Rmask, table[which].srcR) &&
3402  MASKOK(srcfmt->Gmask, table[which].srcG) &&
3403  MASKOK(srcfmt->Bmask, table[which].srcB) &&
3404  MASKOK(dstfmt->Rmask, table[which].dstR) &&
3405  MASKOK(dstfmt->Gmask, table[which].dstG) &&
3406  MASKOK(dstfmt->Bmask, table[which].dstB) &&
3407  dstfmt->BytesPerPixel == table[which].dstbpp &&
3408  (a_need & table[which].alpha) == a_need &&
3409  ((table[which].blit_features & GetBlitFeatures()) ==
3410  table[which].blit_features))
3411  break;
3412  }
3413  blitfun = table[which].blitfunc;
3414 
3415  if (blitfun == BlitNtoN) { /* default C fallback catch-all. Slow! */
3416  if (srcfmt->format == SDL_PIXELFORMAT_ARGB2101010) {
3417  blitfun = Blit2101010toN;
3418  } else if (dstfmt->format == SDL_PIXELFORMAT_ARGB2101010) {
3419  blitfun = BlitNto2101010;
3420  } else if (srcfmt->BytesPerPixel == 4 &&
3421  dstfmt->BytesPerPixel == 4 &&
3422  srcfmt->Rmask == dstfmt->Rmask &&
3423  srcfmt->Gmask == dstfmt->Gmask &&
3424  srcfmt->Bmask == dstfmt->Bmask) {
3425  if (a_need == COPY_ALPHA) {
3426  if (srcfmt->Amask == dstfmt->Amask) {
3427  /* Fastpath C fallback: 32bit RGBA<->RGBA blit with matching RGBA */
3428  blitfun = Blit4to4CopyAlpha;
3429  } else {
3430  blitfun = BlitNtoNCopyAlpha;
3431  }
3432  } else {
3433  /* Fastpath C fallback: 32bit RGB<->RGBA blit with matching RGB */
3434  blitfun = Blit4to4MaskAlpha;
3435  }
3436  } else if (a_need == COPY_ALPHA) {
3437  blitfun = BlitNtoNCopyAlpha;
3438  }
3439  }
3440  }
3441  return (blitfun);
3442 
3443  case SDL_COPY_COLORKEY:
3444  /* colorkey blit: Here we don't have too many options, mostly
3445  because RLE is the preferred fast way to deal with this.
3446  If a particular case turns out to be useful we'll add it. */
3447 
3448  if (srcfmt->BytesPerPixel == 2 && surface->map->identity)
3449  return Blit2to2Key;
3450  else if (dstfmt->BytesPerPixel == 1)
3451  return BlitNto1Key;
3452  else {
3453 #if SDL_ALTIVEC_BLITTERS
3454  if ((srcfmt->BytesPerPixel == 4) && (dstfmt->BytesPerPixel == 4)
3455  && SDL_HasAltiVec()) {
3456  return Blit32to32KeyAltivec;
3457  } else
3458 #endif
3459  if (srcfmt->Amask && dstfmt->Amask) {
3460  return BlitNtoNKeyCopyAlpha;
3461  } else {
3462  return BlitNtoNKey;
3463  }
3464  }
3465  }
3466 
3467  return NULL;
3468 }

References SDL_PixelFormat::Amask, SDL_PixelFormat::BitsPerPixel, Blit2101010toN(), Blit2to2Key(), Blit4to4CopyAlpha(), Blit4to4MaskAlpha(), Blit_RGB101010_index8(), Blit_RGB888_index8(), blit_table::blitfunc, BlitNto1(), BlitNto1Key(), BlitNto2101010(), BlitNtoN(), BlitNtoNCopyAlpha(), BlitNtoNKey(), BlitNtoNKeyCopyAlpha(), SDL_PixelFormat::Bmask, SDL_PixelFormat::BytesPerPixel, COPY_ALPHA, SDL_PixelFormat::format, GetBlitFeatures, SDL_PixelFormat::Gmask, MASKOK, NO_ALPHA, normal_blit, NULL, SDL_PixelFormat::Rmask, SDL_COPY_COLORKEY, SDL_COPY_RLE_MASK, SDL_HasAltiVec, SDL_PIXELFORMAT_ARGB2101010, and SET_ALPHA.

Referenced by SDL_CalculateBlit().

Variable Documentation

◆ normal_blit

const struct blit_table* const normal_blit[]
static
Initial value:

Definition at line 3352 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

◆ normal_blit_1

const struct blit_table normal_blit_1[]
static
Initial value:
= {
{0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
}

Definition at line 3121 of file SDL_blit_N.c.

◆ normal_blit_2

const struct blit_table normal_blit_2[]
static
Initial value:
= {
{0x0000F800, 0x000007E0, 0x0000001F, 4, 0x00FF0000, 0x0000FF00, 0x000000FF,
{0x0000F800, 0x000007E0, 0x0000001F, 4, 0x000000FF, 0x0000FF00, 0x00FF0000,
{0x0000F800, 0x000007E0, 0x0000001F, 4, 0xFF000000, 0x00FF0000, 0x0000FF00,
{0x0000F800, 0x000007E0, 0x0000001F, 4, 0x0000FF00, 0x00FF0000, 0xFF000000,
{0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
}

Definition at line 3121 of file SDL_blit_N.c.

◆ normal_blit_3

const struct blit_table normal_blit_3[]
static

Definition at line 3121 of file SDL_blit_N.c.

◆ normal_blit_4

const struct blit_table normal_blit_4[]
static

Definition at line 3121 of file SDL_blit_N.c.

◆ RGB565_ABGR8888_LUT

const Uint32 RGB565_ABGR8888_LUT[512]
static

Definition at line 1662 of file SDL_blit_N.c.

Referenced by Blit_RGB565_ABGR8888().

◆ RGB565_ARGB8888_LUT

const Uint32 RGB565_ARGB8888_LUT[512]
static

Definition at line 1524 of file SDL_blit_N.c.

Referenced by Blit_RGB565_ARGB8888().

◆ RGB565_BGRA8888_LUT

const Uint32 RGB565_BGRA8888_LUT[512]
static

Definition at line 1938 of file SDL_blit_N.c.

Referenced by Blit_RGB565_BGRA8888().

◆ RGB565_RGBA8888_LUT

const Uint32 RGB565_RGBA8888_LUT[512]
static

Definition at line 1800 of file SDL_blit_N.c.

Referenced by Blit_RGB565_RGBA8888().

Blit_RGB101010_index8
static void Blit_RGB101010_index8(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1099
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:58
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:61
SDL_PixelFormat::Ashift
Uint8 Ashift
Definition: SDL_pixels.h:336
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:179
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11096
COPY_ALPHA
#define COPY_ALPHA
Definition: SDL_blit_N.c:3226
ASSEMBLE_RGBA
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:403
Blit_RGB565_RGBA8888
static void Blit_RGB565_RGBA8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1932
RGB888_RGB565
#define RGB888_RGB565(dst, src)
Definition: SDL_blit_N.c:1329
SDL_PixelFormat::BitsPerPixel
Uint8 BitsPerPixel
Definition: SDL_pixels.h:322
ARGB2101010_FROM_RGBA
#define ARGB2101010_FROM_RGBA(Pixel, r, g, b, a)
Definition: SDL_blit.h:254
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:323
BLIT_FEATURE_HAS_ARM_SIMD
@ BLIT_FEATURE_HAS_ARM_SIMD
Definition: SDL_blit_N.c:48
i1
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint i1
Definition: SDL_glfuncs.h:141
SDL_HasAltiVec
#define SDL_HasAltiVec
Definition: SDL_dynapi_overrides.h:104
RGB565_BGRA8888_LUT
static const Uint32 RGB565_BGRA8888_LUT[512]
Definition: SDL_blit_N.c:1938
mask
GLenum GLint GLuint mask
Definition: SDL_opengl_glext.h:660
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:191
RGB101010_RGB332
#define RGB101010_RGB332(dst, src)
Definition: SDL_blit_N.c:1093
RGBA_FROM_ARGB2101010
#define RGBA_FROM_ARGB2101010(Pixel, r, g, b, a)
Definition: SDL_blit.h:347
if
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
Definition: pixman-arm-neon-asm.h:469
normal_blit_4
static const struct blit_table normal_blit_4[]
Definition: SDL_blit_N.c:3304
PIXEL_FROM_RGBA
#define PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a)
Definition: SDL_blit.h:396
USE_DUFFS_LOOP
#define USE_DUFFS_LOOP
Definition: SDL_blit.h:468
NULL
#define NULL
Definition: begin_code.h:167
surface
EGLSurface surface
Definition: eglext.h:248
SDL_PixelFormat::format
Uint32 format
Definition: SDL_pixels.h:320
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
normal_blit
static const struct blit_table *const normal_blit[]
Definition: SDL_blit_N.c:3352
RETRIEVE_RGB_PIXEL
#define RETRIEVE_RGB_PIXEL(buf, bpp, Pixel)
Definition: SDL_blit.h:147
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:63
MASKOK
#define MASKOK(x, y)
Definition: SDL_blit_N.c:3357
Blit_RGB888_index8
static void Blit_RGB888_index8(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:989
BlitNtoNKey
static void BlitNtoNKey(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2607
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:63
BLIT_FEATURE_ALTIVEC_DONT_USE_PREFETCH
@ BLIT_FEATURE_ALTIVEC_DONT_USE_PREFETCH
Definition: SDL_blit_N.c:47
SDL_COPY_COLORKEY
#define SDL_COPY_COLORKEY
Definition: SDL_blit.h:40
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
SDL_PixelFormat::Rmask
Uint32 Rmask
Definition: SDL_pixels.h:325
map
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint GLint GLint j2 GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLfloat *params GLenum GLint GLenum GLenum GLvoid *pixels GLenum GLint GLenum GLint *params GLenum GLenum GLint *params GLenum GLsizei const GLvoid *pointer GLenum GLenum const GLint *params GLenum GLfloat GLfloat GLint GLint const GLfloat *points GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat *points GLint GLfloat GLfloat GLint GLfloat GLfloat v2 GLenum GLenum const GLint *params GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum map
Definition: SDL_glfuncs.h:291
Blit2101010toN
static void Blit2101010toN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2983
Blit4to4CopyAlpha
static void Blit4to4CopyAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2223
SDL_COPY_RLE_MASK
#define SDL_COPY_RLE_MASK
Definition: SDL_blit.h:45
DISEMBLE_RGBA
#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a)
Definition: SDL_blit.h:354
i2
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint i2
Definition: SDL_glfuncs.h:141
s1
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
Definition: SDL_opengl_glext.h:8586
Blit_RGB565_ARGB8888
static void Blit_RGB565_ARGB8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1656
alpha
GLfloat GLfloat GLfloat alpha
Definition: SDL_opengl_glext.h:415
blit_features
blit_features
Definition: SDL_blit_N.c:43
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1740
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:62
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:501
get_permutation
static void get_permutation(SDL_PixelFormat *srcfmt, SDL_PixelFormat *dstfmt, int *_p0, int *_p1, int *_p2, int *_p3, int *_alpha_channel)
Definition: SDL_blit_N.c:2250
s0
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s0
Definition: SDL_opengl_glext.h:8586
BlitNtoN
static void BlitNtoN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2330
NO_ALPHA
#define NO_ALPHA
Definition: SDL_blit_N.c:3224
SDL_BlitInfo::src_fmt
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:66
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_PIXELFORMAT_ARGB2101010
@ SDL_PIXELFORMAT_ARGB2101010
Definition: SDL_pixels.h:263
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:65
SDL_BlitInfo::table
Uint8 * table
Definition: SDL_blit.h:68
Blit4to4MaskAlpha
static void Blit4to4MaskAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2173
SET_ALPHA
#define SET_ALPHA
Definition: SDL_blit_N.c:3225
RGB565_32
#define RGB565_32(dst, src, map)
Definition: SDL_blit_N.c:1458
BLIT_FEATURE_NONE
@ BLIT_FEATURE_NONE
Definition: SDL_blit_N.c:44
BLIT_FEATURE_HAS_ALTIVEC
@ BLIT_FEATURE_HAS_ALTIVEC
Definition: SDL_blit_N.c:46
blit_table::blitfunc
SDL_BlitFunc blitfunc
Definition: SDL_blit_N.c:3233
BLIT_FEATURE_HAS_MMX
@ BLIT_FEATURE_HAS_MMX
Definition: SDL_blit_N.c:45
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:328
normal_blit_2
static const struct blit_table normal_blit_2[]
Definition: SDL_blit_N.c:3241
SDL_PIXELFORMAT_ARGB8888
@ SDL_PIXELFORMAT_ARGB8888
Definition: SDL_pixels.h:251
SDL_PixelFormat
Definition: SDL_pixels.h:319
SDL_BlitInfo::a
Uint8 a
Definition: SDL_blit.h:71
SDL_PixelFormat::Gmask
Uint32 Gmask
Definition: SDL_pixels.h:326
BlitNto1Key
static void BlitNto1Key(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2507
SDL_BlitInfo::dst_fmt
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:67
GetBlitFeatures
#define GetBlitFeatures()
Definition: SDL_blit_N.c:938
normal_blit_1
static const struct blit_table normal_blit_1[]
Definition: SDL_blit_N.c:3236
DISEMBLE_RGB
#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b)
Definition: SDL_blit.h:178
Blit_RGB565_ABGR8888
static void Blit_RGB565_ABGR8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1794
RGB888_RGB555
#define RGB888_RGB555(dst, src)
Definition: SDL_blit_N.c:1203
SDL_PixelFormat::Bmask
Uint32 Bmask
Definition: SDL_pixels.h:327
normal_blit_3
static const struct blit_table normal_blit_3[]
Definition: SDL_blit_N.c:3268
BlitNtoNCopyAlpha
static void BlitNtoNCopyAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2449
src
GLenum src
Definition: SDL_opengl_glext.h:1740
BlitNto2101010
static void BlitNto2101010(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:3015
BlitNtoNKeyCopyAlpha
static void BlitNtoNKeyCopyAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2879
SDL_PIXELFORMAT_RGBA8888
@ SDL_PIXELFORMAT_RGBA8888
Definition: SDL_pixels.h:254
PIXEL_FROM_RGB
#define PIXEL_FROM_RGB(Pixel, fmt, r, g, b)
Definition: SDL_blit.h:219
j1
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint GLint j1
Definition: SDL_glfuncs.h:141
blit_table::dstbpp
int dstbpp
Definition: SDL_blit_N.c:3230
SDL_PixelFormat::Aloss
Uint8 Aloss
Definition: SDL_pixels.h:332
Blit_RGB565_32
static void Blit_RGB565_32(SDL_BlitInfo *info, const Uint32 *map)
Definition: SDL_blit_N.c:1460
SDL_PIXELFORMAT_RGB24
@ SDL_PIXELFORMAT_RGB24
Definition: SDL_pixels.h:233
SDL_BlitInfo::colorkey
Uint32 colorkey
Definition: SDL_blit.h:70
Blit_RGB565_BGRA8888
static void Blit_RGB565_BGRA8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2070
SDL_PIXELFORMAT_BGRA8888
@ SDL_PIXELFORMAT_BGRA8888
Definition: SDL_pixels.h:260
SDL_PIXELFORMAT_BGR24
@ SDL_PIXELFORMAT_BGR24
Definition: SDL_pixels.h:236
RGB565_RGBA8888_LUT
static const Uint32 RGB565_RGBA8888_LUT[512]
Definition: SDL_blit_N.c:1800
RGB_FROM_PIXEL
#define RGB_FROM_PIXEL(Pixel, fmt, r, g, b)
Definition: SDL_blit.h:123
RGB565_ABGR8888_LUT
static const Uint32 RGB565_ABGR8888_LUT[512]
Definition: SDL_blit_N.c:1662
RGB565_ARGB8888_LUT
static const Uint32 RGB565_ARGB8888_LUT[512]
Definition: SDL_blit_N.c:1524
RGB888_RGB332
#define RGB888_RGB332(dst, src)
Definition: SDL_blit_N.c:983
blit_table
Definition: SDL_blit_N.c:3228
Blit2to2Key
static void Blit2to2Key(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2573
SDL_PIXELFORMAT_ABGR8888
@ SDL_PIXELFORMAT_ABGR8888
Definition: SDL_pixels.h:257
table
GLenum GLsizei GLenum GLenum const void * table
Definition: SDL_opengl_glext.h:3121
RGBA_FROM_PIXEL
#define RGBA_FROM_PIXEL(Pixel, fmt, r, g, b, a)
Definition: SDL_blit.h:305
BlitNto1
static void BlitNto1(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2078
SDL_BlitFunc
void(* SDL_BlitFunc)(SDL_BlitInfo *info)
Definition: SDL_blit.h:74