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 GetBlitFeatures()   ((Uint32)(SDL_HasMMX() ? 1 : 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))
 

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 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)
 
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 2468 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

◆ GetBlitFeatures

#define GetBlitFeatures ( )    ((Uint32)(SDL_HasMMX() ? 1 : 0))

Definition at line 878 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

◆ HI

#define HI   1

Definition at line 883 of file SDL_blit_N.c.

Referenced by Blit1to2().

◆ LO

#define LO   0

Definition at line 884 of file SDL_blit_N.c.

Referenced by Blit1to2().

◆ MASKOK

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

Definition at line 2534 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

◆ NO_ALPHA

#define NO_ALPHA   1

Definition at line 2466 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

◆ RGB101010_RGB332

#define RGB101010_RGB332 (   dst,
  src 
)
Value:
{ \
dst = (Uint8)((((src)&0x38000000)>>22)| \
(((src)&0x000E0000)>>15)| \
(((src)&0x00000300)>>8)); \
}
GLenum src
uint8_t Uint8
Definition: SDL_stdinc.h:157

Definition at line 1001 of file SDL_blit_N.c.

Referenced by Blit_RGB101010_index8().

◆ RGB565_32

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

Definition at line 1364 of file SDL_blit_N.c.

Referenced by Blit_RGB565_32().

◆ RGB888_RGB332

#define RGB888_RGB332 (   dst,
  src 
)
Value:
{ \
dst = (Uint8)((((src)&0x00E00000)>>16)| \
(((src)&0x0000E000)>>11)| \
(((src)&0x000000C0)>>6)); \
}
GLenum src
uint8_t Uint8
Definition: SDL_stdinc.h:157

Definition at line 891 of file SDL_blit_N.c.

Referenced by Blit_RGB888_index8().

◆ RGB888_RGB555

#define RGB888_RGB555 (   dst,
  src 
)
Value:
{ \
*(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>9)| \
(((*src)&0x0000F800)>>6)| \
(((*src)&0x000000F8)>>3)); \
}
GLenum GLenum dst
GLenum src
uint16_t Uint16
Definition: SDL_stdinc.h:169

Definition at line 1111 of file SDL_blit_N.c.

Referenced by Blit_RGB888_RGB555().

◆ RGB888_RGB565

#define RGB888_RGB565 (   dst,
  src 
)
Value:
{ \
*(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>8)| \
(((*src)&0x0000FC00)>>5)| \
(((*src)&0x000000F8)>>3)); \
}
GLenum GLenum dst
GLenum src
uint16_t Uint16
Definition: SDL_stdinc.h:169

Definition at line 1237 of file SDL_blit_N.c.

Referenced by Blit_RGB888_RGB565().

◆ SET_ALPHA

#define SET_ALPHA   2

Definition at line 2467 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

Function Documentation

◆ Blit2101010toN()

static void Blit2101010toN ( SDL_BlitInfo info)
static

Definition at line 2403 of file SDL_blit_N.c.

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().

2404 {
2405  int width = info->dst_w;
2406  int height = info->dst_h;
2407  Uint8 *src = info->src;
2408  int srcskip = info->src_skip;
2409  Uint8 *dst = info->dst;
2410  int dstskip = info->dst_skip;
2411  SDL_PixelFormat *dstfmt = info->dst_fmt;
2412  int dstbpp = dstfmt->BytesPerPixel;
2413  Uint32 Pixel;
2414  unsigned sR, sG, sB, sA;
2415 
2416  while (height--) {
2417  /* *INDENT-OFF* */
2418  DUFFS_LOOP(
2419  {
2420  Pixel = *(Uint32 *)src;
2421  RGBA_FROM_ARGB2101010(Pixel, sR, sG, sB, sA);
2422  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA);
2423  dst += dstbpp;
2424  src += 4;
2425  },
2426  width);
2427  /* *INDENT-ON* */
2428  src += srcskip;
2429  dst += dstskip;
2430  }
2431 }
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:402
#define RGBA_FROM_ARGB2101010(Pixel, r, g, b, a)
Definition: SDL_blit.h:346
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
Definition: SDL_stdinc.h:157
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
Uint8 * src
Definition: SDL_blit.h:57
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572

◆ Blit2to2Key()

static void Blit2to2Key ( SDL_BlitInfo info)
static

Definition at line 2283 of file SDL_blit_N.c.

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().

2284 {
2285  int width = info->dst_w;
2286  int height = info->dst_h;
2287  Uint16 *srcp = (Uint16 *) info->src;
2288  int srcskip = info->src_skip;
2289  Uint16 *dstp = (Uint16 *) info->dst;
2290  int dstskip = info->dst_skip;
2291  Uint32 ckey = info->colorkey;
2292  Uint32 rgbmask = ~info->src_fmt->Amask;
2293 
2294  /* Set up some basic variables */
2295  srcskip /= 2;
2296  dstskip /= 2;
2297  ckey &= rgbmask;
2298 
2299  while (height--) {
2300  /* *INDENT-OFF* */
2301  DUFFS_LOOP(
2302  {
2303  if ( (*srcp & rgbmask) != ckey ) {
2304  *dstp = *srcp;
2305  }
2306  dstp++;
2307  srcp++;
2308  },
2309  width);
2310  /* *INDENT-ON* */
2311  srcp += srcskip;
2312  dstp += dstskip;
2313  }
2314 }
int src_skip
Definition: SDL_blit.h:60
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint32 colorkey
Definition: SDL_blit.h:69
Uint8 * dst
Definition: SDL_blit.h:61
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
Uint8 * src
Definition: SDL_blit.h:57
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
uint16_t Uint16
Definition: SDL_stdinc.h:169

◆ Blit4to4CopyAlpha()

static void Blit4to4CopyAlpha ( SDL_BlitInfo info)
static

Definition at line 2127 of file SDL_blit_N.c.

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().

2128 {
2129  int width = info->dst_w;
2130  int height = info->dst_h;
2131  Uint32 *src = (Uint32 *) info->src;
2132  int srcskip = info->src_skip;
2133  Uint32 *dst = (Uint32 *) info->dst;
2134  int dstskip = info->dst_skip;
2135 
2136  /* RGBA->RGBA, COPY_ALPHA */
2137  while (height--) {
2138  /* *INDENT-OFF* */
2139  DUFFS_LOOP(
2140  {
2141  *dst = *src;
2142  ++dst;
2143  ++src;
2144  },
2145  width);
2146  /* *INDENT-ON* */
2147  src = (Uint32 *) ((Uint8 *) src + srcskip);
2148  dst = (Uint32 *) ((Uint8 *) dst + dstskip);
2149  }
2150 }
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
Definition: SDL_stdinc.h:157
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
Uint8 * src
Definition: SDL_blit.h:57
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572

◆ Blit4to4MaskAlpha()

static void Blit4to4MaskAlpha ( SDL_BlitInfo info)
static

Definition at line 2077 of file SDL_blit_N.c.

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().

2078 {
2079  int width = info->dst_w;
2080  int height = info->dst_h;
2081  Uint32 *src = (Uint32 *) info->src;
2082  int srcskip = info->src_skip;
2083  Uint32 *dst = (Uint32 *) info->dst;
2084  int dstskip = info->dst_skip;
2085  SDL_PixelFormat *srcfmt = info->src_fmt;
2086  SDL_PixelFormat *dstfmt = info->dst_fmt;
2087 
2088  if (dstfmt->Amask) {
2089  /* RGB->RGBA, SET_ALPHA */
2090  Uint32 mask = (info->a >> dstfmt->Aloss) << dstfmt->Ashift;
2091 
2092  while (height--) {
2093  /* *INDENT-OFF* */
2094  DUFFS_LOOP(
2095  {
2096  *dst = *src | mask;
2097  ++dst;
2098  ++src;
2099  },
2100  width);
2101  /* *INDENT-ON* */
2102  src = (Uint32 *) ((Uint8 *) src + srcskip);
2103  dst = (Uint32 *) ((Uint8 *) dst + dstskip);
2104  }
2105  } else {
2106  /* RGBA->RGB, NO_ALPHA */
2107  Uint32 mask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
2108 
2109  while (height--) {
2110  /* *INDENT-OFF* */
2111  DUFFS_LOOP(
2112  {
2113  *dst = *src & mask;
2114  ++dst;
2115  ++src;
2116  },
2117  width);
2118  /* *INDENT-ON* */
2119  src = (Uint32 *) ((Uint8 *) src + srcskip);
2120  dst = (Uint32 *) ((Uint8 *) dst + dstskip);
2121  }
2122  }
2123 }
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
Definition: SDL_stdinc.h:157
GLenum GLint GLuint mask
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
Uint8 * src
Definition: SDL_blit.h:57
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
Uint8 a
Definition: SDL_blit.h:70

◆ Blit_RGB101010_index8()

static void Blit_RGB101010_index8 ( SDL_BlitInfo info)
static

Definition at line 1007 of file SDL_blit_N.c.

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

Referenced by SDL_CalculateBlitN().

1008 {
1009 #ifndef USE_DUFFS_LOOP
1010  int c;
1011 #endif
1012  int width, height;
1013  Uint32 *src;
1014  const Uint8 *map;
1015  Uint8 *dst;
1016  int srcskip, dstskip;
1017 
1018  /* Set up some basic variables */
1019  width = info->dst_w;
1020  height = info->dst_h;
1021  src = (Uint32 *) info->src;
1022  srcskip = info->src_skip / 4;
1023  dst = info->dst;
1024  dstskip = info->dst_skip;
1025  map = info->table;
1026 
1027  if (map == NULL) {
1028  while (height--) {
1029 #ifdef USE_DUFFS_LOOP
1030  /* *INDENT-OFF* */
1031  DUFFS_LOOP(
1032  RGB101010_RGB332(*dst++, *src);
1033  , width);
1034  /* *INDENT-ON* */
1035 #else
1036  for (c = width / 4; c; --c) {
1037  /* Pack RGB into 8bit pixel */
1038  ++src;
1039  RGB101010_RGB332(*dst++, *src);
1040  ++src;
1041  RGB101010_RGB332(*dst++, *src);
1042  ++src;
1043  RGB101010_RGB332(*dst++, *src);
1044  ++src;
1045  }
1046  switch (width & 3) {
1047  case 3:
1048  RGB101010_RGB332(*dst++, *src);
1049  ++src;
1050  case 2:
1051  RGB101010_RGB332(*dst++, *src);
1052  ++src;
1053  case 1:
1054  RGB101010_RGB332(*dst++, *src);
1055  ++src;
1056  }
1057 #endif /* USE_DUFFS_LOOP */
1058  src += srcskip;
1059  dst += dstskip;
1060  }
1061  } else {
1062  int Pixel;
1063 
1064  while (height--) {
1065 #ifdef USE_DUFFS_LOOP
1066  /* *INDENT-OFF* */
1067  DUFFS_LOOP(
1068  RGB101010_RGB332(Pixel, *src);
1069  *dst++ = map[Pixel];
1070  ++src;
1071  , width);
1072  /* *INDENT-ON* */
1073 #else
1074  for (c = width / 4; c; --c) {
1075  /* Pack RGB into 8bit pixel */
1076  RGB101010_RGB332(Pixel, *src);
1077  *dst++ = map[Pixel];
1078  ++src;
1079  RGB101010_RGB332(Pixel, *src);
1080  *dst++ = map[Pixel];
1081  ++src;
1082  RGB101010_RGB332(Pixel, *src);
1083  *dst++ = map[Pixel];
1084  ++src;
1085  RGB101010_RGB332(Pixel, *src);
1086  *dst++ = map[Pixel];
1087  ++src;
1088  }
1089  switch (width & 3) {
1090  case 3:
1091  RGB101010_RGB332(Pixel, *src);
1092  *dst++ = map[Pixel];
1093  ++src;
1094  case 2:
1095  RGB101010_RGB332(Pixel, *src);
1096  *dst++ = map[Pixel];
1097  ++src;
1098  case 1:
1099  RGB101010_RGB332(Pixel, *src);
1100  *dst++ = map[Pixel];
1101  ++src;
1102  }
1103 #endif /* USE_DUFFS_LOOP */
1104  src += srcskip;
1105  dst += dstskip;
1106  }
1107  }
1108 }
Uint8 * table
Definition: SDL_blit.h:67
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint8 * dst
Definition: SDL_blit.h:61
#define RGB101010_RGB332(dst, src)
Definition: SDL_blit_N.c:1001
uint8_t Uint8
Definition: SDL_stdinc.h:157
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
#define NULL
Definition: begin_code.h:164
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
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:290

◆ Blit_RGB565_32()

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

Definition at line 1366 of file SDL_blit_N.c.

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

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

1367 {
1368 #ifndef USE_DUFFS_LOOP
1369  int c;
1370 #endif
1371  int width, height;
1372  Uint8 *src;
1373  Uint32 *dst;
1374  int srcskip, dstskip;
1375 
1376  /* Set up some basic variables */
1377  width = info->dst_w;
1378  height = info->dst_h;
1379  src = (Uint8 *) info->src;
1380  srcskip = info->src_skip;
1381  dst = (Uint32 *) info->dst;
1382  dstskip = info->dst_skip / 4;
1383 
1384 #ifdef USE_DUFFS_LOOP
1385  while (height--) {
1386  /* *INDENT-OFF* */
1387  DUFFS_LOOP(
1388  {
1389  *dst++ = RGB565_32(dst, src, map);
1390  src += 2;
1391  },
1392  width);
1393  /* *INDENT-ON* */
1394  src += srcskip;
1395  dst += dstskip;
1396  }
1397 #else
1398  while (height--) {
1399  /* Copy in 4 pixel chunks */
1400  for (c = width / 4; c; --c) {
1401  *dst++ = RGB565_32(dst, src, map);
1402  src += 2;
1403  *dst++ = RGB565_32(dst, src, map);
1404  src += 2;
1405  *dst++ = RGB565_32(dst, src, map);
1406  src += 2;
1407  *dst++ = RGB565_32(dst, src, map);
1408  src += 2;
1409  }
1410  /* Get any leftovers */
1411  switch (width & 3) {
1412  case 3:
1413  *dst++ = RGB565_32(dst, src, map);
1414  src += 2;
1415  case 2:
1416  *dst++ = RGB565_32(dst, src, map);
1417  src += 2;
1418  case 1:
1419  *dst++ = RGB565_32(dst, src, map);
1420  src += 2;
1421  break;
1422  }
1423  src += srcskip;
1424  dst += dstskip;
1425  }
1426 #endif /* USE_DUFFS_LOOP */
1427 }
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
Definition: SDL_stdinc.h:157
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
#define RGB565_32(dst, src, map)
Definition: SDL_blit_N.c:1364
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
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:290

◆ Blit_RGB565_ABGR8888()

static void Blit_RGB565_ABGR8888 ( SDL_BlitInfo info)
static

Definition at line 1700 of file SDL_blit_N.c.

References Blit_RGB565_32().

1701 {
1703 }
static void Blit_RGB565_32(SDL_BlitInfo *info, const Uint32 *map)
Definition: SDL_blit_N.c:1366
static const Uint32 RGB565_ABGR8888_LUT[512]
Definition: SDL_blit_N.c:1568

◆ Blit_RGB565_ARGB8888()

static void Blit_RGB565_ARGB8888 ( SDL_BlitInfo info)
static

Definition at line 1562 of file SDL_blit_N.c.

References Blit_RGB565_32().

1563 {
1565 }
static void Blit_RGB565_32(SDL_BlitInfo *info, const Uint32 *map)
Definition: SDL_blit_N.c:1366
static const Uint32 RGB565_ARGB8888_LUT[512]
Definition: SDL_blit_N.c:1430

◆ Blit_RGB565_BGRA8888()

static void Blit_RGB565_BGRA8888 ( SDL_BlitInfo info)
static

Definition at line 1976 of file SDL_blit_N.c.

References Blit_RGB565_32().

1977 {
1979 }
static void Blit_RGB565_32(SDL_BlitInfo *info, const Uint32 *map)
Definition: SDL_blit_N.c:1366
static const Uint32 RGB565_BGRA8888_LUT[512]
Definition: SDL_blit_N.c:1844

◆ Blit_RGB565_RGBA8888()

static void Blit_RGB565_RGBA8888 ( SDL_BlitInfo info)
static

Definition at line 1838 of file SDL_blit_N.c.

References Blit_RGB565_32().

1839 {
1841 }
static void Blit_RGB565_32(SDL_BlitInfo *info, const Uint32 *map)
Definition: SDL_blit_N.c:1366
static const Uint32 RGB565_RGBA8888_LUT[512]
Definition: SDL_blit_N.c:1706

◆ Blit_RGB888_index8()

static void Blit_RGB888_index8 ( SDL_BlitInfo info)
static

Definition at line 897 of file SDL_blit_N.c.

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

Referenced by SDL_CalculateBlitN().

898 {
899 #ifndef USE_DUFFS_LOOP
900  int c;
901 #endif
902  int width, height;
903  Uint32 *src;
904  const Uint8 *map;
905  Uint8 *dst;
906  int srcskip, dstskip;
907 
908  /* Set up some basic variables */
909  width = info->dst_w;
910  height = info->dst_h;
911  src = (Uint32 *) info->src;
912  srcskip = info->src_skip / 4;
913  dst = info->dst;
914  dstskip = info->dst_skip;
915  map = info->table;
916 
917  if (map == NULL) {
918  while (height--) {
919 #ifdef USE_DUFFS_LOOP
920  /* *INDENT-OFF* */
921  DUFFS_LOOP(
922  RGB888_RGB332(*dst++, *src);
923  , width);
924  /* *INDENT-ON* */
925 #else
926  for (c = width / 4; c; --c) {
927  /* Pack RGB into 8bit pixel */
928  ++src;
929  RGB888_RGB332(*dst++, *src);
930  ++src;
931  RGB888_RGB332(*dst++, *src);
932  ++src;
933  RGB888_RGB332(*dst++, *src);
934  ++src;
935  }
936  switch (width & 3) {
937  case 3:
938  RGB888_RGB332(*dst++, *src);
939  ++src;
940  case 2:
941  RGB888_RGB332(*dst++, *src);
942  ++src;
943  case 1:
944  RGB888_RGB332(*dst++, *src);
945  ++src;
946  }
947 #endif /* USE_DUFFS_LOOP */
948  src += srcskip;
949  dst += dstskip;
950  }
951  } else {
952  int Pixel;
953 
954  while (height--) {
955 #ifdef USE_DUFFS_LOOP
956  /* *INDENT-OFF* */
957  DUFFS_LOOP(
958  RGB888_RGB332(Pixel, *src);
959  *dst++ = map[Pixel];
960  ++src;
961  , width);
962  /* *INDENT-ON* */
963 #else
964  for (c = width / 4; c; --c) {
965  /* Pack RGB into 8bit pixel */
966  RGB888_RGB332(Pixel, *src);
967  *dst++ = map[Pixel];
968  ++src;
969  RGB888_RGB332(Pixel, *src);
970  *dst++ = map[Pixel];
971  ++src;
972  RGB888_RGB332(Pixel, *src);
973  *dst++ = map[Pixel];
974  ++src;
975  RGB888_RGB332(Pixel, *src);
976  *dst++ = map[Pixel];
977  ++src;
978  }
979  switch (width & 3) {
980  case 3:
981  RGB888_RGB332(Pixel, *src);
982  *dst++ = map[Pixel];
983  ++src;
984  case 2:
985  RGB888_RGB332(Pixel, *src);
986  *dst++ = map[Pixel];
987  ++src;
988  case 1:
989  RGB888_RGB332(Pixel, *src);
990  *dst++ = map[Pixel];
991  ++src;
992  }
993 #endif /* USE_DUFFS_LOOP */
994  src += srcskip;
995  dst += dstskip;
996  }
997  }
998 }
Uint8 * table
Definition: SDL_blit.h:67
int src_skip
Definition: SDL_blit.h:60
#define RGB888_RGB332(dst, src)
Definition: SDL_blit_N.c:891
GLenum GLenum dst
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
Definition: SDL_stdinc.h:157
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
#define NULL
Definition: begin_code.h:164
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
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:290

◆ Blit_RGB888_RGB555()

static void Blit_RGB888_RGB555 ( SDL_BlitInfo info)
static

Definition at line 1127 of file SDL_blit_N.c.

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.

1128 {
1129 #ifndef USE_DUFFS_LOOP
1130  int c;
1131 #endif
1132  int width, height;
1133  Uint32 *src;
1134  Uint16 *dst;
1135  int srcskip, dstskip;
1136 
1137  /* Set up some basic variables */
1138  width = info->dst_w;
1139  height = info->dst_h;
1140  src = (Uint32 *) info->src;
1141  srcskip = info->src_skip / 4;
1142  dst = (Uint16 *) info->dst;
1143  dstskip = info->dst_skip / 2;
1144 
1145 #ifdef USE_DUFFS_LOOP
1146  while (height--) {
1147  /* *INDENT-OFF* */
1148  DUFFS_LOOP(
1149  RGB888_RGB555(dst, src);
1150  ++src;
1151  ++dst;
1152  , width);
1153  /* *INDENT-ON* */
1154  src += srcskip;
1155  dst += dstskip;
1156  }
1157 #else
1158  /* Memory align at 4-byte boundary, if necessary */
1159  if ((long) dst & 0x03) {
1160  /* Don't do anything if width is 0 */
1161  if (width == 0) {
1162  return;
1163  }
1164  --width;
1165 
1166  while (height--) {
1167  /* Perform copy alignment */
1168  RGB888_RGB555(dst, src);
1169  ++src;
1170  ++dst;
1171 
1172  /* Copy in 4 pixel chunks */
1173  for (c = width / 4; c; --c) {
1174  RGB888_RGB555_TWO(dst, src);
1175  src += 2;
1176  dst += 2;
1177  RGB888_RGB555_TWO(dst, src);
1178  src += 2;
1179  dst += 2;
1180  }
1181  /* Get any leftovers */
1182  switch (width & 3) {
1183  case 3:
1184  RGB888_RGB555(dst, src);
1185  ++src;
1186  ++dst;
1187  case 2:
1188  RGB888_RGB555_TWO(dst, src);
1189  src += 2;
1190  dst += 2;
1191  break;
1192  case 1:
1193  RGB888_RGB555(dst, src);
1194  ++src;
1195  ++dst;
1196  break;
1197  }
1198  src += srcskip;
1199  dst += dstskip;
1200  }
1201  } else {
1202  while (height--) {
1203  /* Copy in 4 pixel chunks */
1204  for (c = width / 4; c; --c) {
1205  RGB888_RGB555_TWO(dst, src);
1206  src += 2;
1207  dst += 2;
1208  RGB888_RGB555_TWO(dst, src);
1209  src += 2;
1210  dst += 2;
1211  }
1212  /* Get any leftovers */
1213  switch (width & 3) {
1214  case 3:
1215  RGB888_RGB555(dst, src);
1216  ++src;
1217  ++dst;
1218  case 2:
1219  RGB888_RGB555_TWO(dst, src);
1220  src += 2;
1221  dst += 2;
1222  break;
1223  case 1:
1224  RGB888_RGB555(dst, src);
1225  ++src;
1226  ++dst;
1227  break;
1228  }
1229  src += srcskip;
1230  dst += dstskip;
1231  }
1232  }
1233 #endif /* USE_DUFFS_LOOP */
1234 }
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint8 * dst
Definition: SDL_blit.h:61
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
uint16_t Uint16
Definition: SDL_stdinc.h:169
#define RGB888_RGB555(dst, src)
Definition: SDL_blit_N.c:1111

◆ Blit_RGB888_RGB565()

static void Blit_RGB888_RGB565 ( SDL_BlitInfo info)
static

Definition at line 1253 of file SDL_blit_N.c.

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.

1254 {
1255 #ifndef USE_DUFFS_LOOP
1256  int c;
1257 #endif
1258  int width, height;
1259  Uint32 *src;
1260  Uint16 *dst;
1261  int srcskip, dstskip;
1262 
1263  /* Set up some basic variables */
1264  width = info->dst_w;
1265  height = info->dst_h;
1266  src = (Uint32 *) info->src;
1267  srcskip = info->src_skip / 4;
1268  dst = (Uint16 *) info->dst;
1269  dstskip = info->dst_skip / 2;
1270 
1271 #ifdef USE_DUFFS_LOOP
1272  while (height--) {
1273  /* *INDENT-OFF* */
1274  DUFFS_LOOP(
1275  RGB888_RGB565(dst, src);
1276  ++src;
1277  ++dst;
1278  , width);
1279  /* *INDENT-ON* */
1280  src += srcskip;
1281  dst += dstskip;
1282  }
1283 #else
1284  /* Memory align at 4-byte boundary, if necessary */
1285  if ((long) dst & 0x03) {
1286  /* Don't do anything if width is 0 */
1287  if (width == 0) {
1288  return;
1289  }
1290  --width;
1291 
1292  while (height--) {
1293  /* Perform copy alignment */
1294  RGB888_RGB565(dst, src);
1295  ++src;
1296  ++dst;
1297 
1298  /* Copy in 4 pixel chunks */
1299  for (c = width / 4; c; --c) {
1300  RGB888_RGB565_TWO(dst, src);
1301  src += 2;
1302  dst += 2;
1303  RGB888_RGB565_TWO(dst, src);
1304  src += 2;
1305  dst += 2;
1306  }
1307  /* Get any leftovers */
1308  switch (width & 3) {
1309  case 3:
1310  RGB888_RGB565(dst, src);
1311  ++src;
1312  ++dst;
1313  case 2:
1314  RGB888_RGB565_TWO(dst, src);
1315  src += 2;
1316  dst += 2;
1317  break;
1318  case 1:
1319  RGB888_RGB565(dst, src);
1320  ++src;
1321  ++dst;
1322  break;
1323  }
1324  src += srcskip;
1325  dst += dstskip;
1326  }
1327  } else {
1328  while (height--) {
1329  /* Copy in 4 pixel chunks */
1330  for (c = width / 4; c; --c) {
1331  RGB888_RGB565_TWO(dst, src);
1332  src += 2;
1333  dst += 2;
1334  RGB888_RGB565_TWO(dst, src);
1335  src += 2;
1336  dst += 2;
1337  }
1338  /* Get any leftovers */
1339  switch (width & 3) {
1340  case 3:
1341  RGB888_RGB565(dst, src);
1342  ++src;
1343  ++dst;
1344  case 2:
1345  RGB888_RGB565_TWO(dst, src);
1346  src += 2;
1347  dst += 2;
1348  break;
1349  case 1:
1350  RGB888_RGB565(dst, src);
1351  ++src;
1352  ++dst;
1353  break;
1354  }
1355  src += srcskip;
1356  dst += dstskip;
1357  }
1358  }
1359 #endif /* USE_DUFFS_LOOP */
1360 }
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
#define RGB888_RGB565(dst, src)
Definition: SDL_blit_N.c:1237
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint8 * dst
Definition: SDL_blit.h:61
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
uint16_t Uint16
Definition: SDL_stdinc.h:169

◆ BlitNto1()

static void BlitNto1 ( SDL_BlitInfo info)
static

Definition at line 1982 of file SDL_blit_N.c.

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().

1983 {
1984 #ifndef USE_DUFFS_LOOP
1985  int c;
1986 #endif
1987  int width, height;
1988  Uint8 *src;
1989  const Uint8 *map;
1990  Uint8 *dst;
1991  int srcskip, dstskip;
1992  int srcbpp;
1993  Uint32 Pixel;
1994  int sR, sG, sB;
1995  SDL_PixelFormat *srcfmt;
1996 
1997  /* Set up some basic variables */
1998  width = info->dst_w;
1999  height = info->dst_h;
2000  src = info->src;
2001  srcskip = info->src_skip;
2002  dst = info->dst;
2003  dstskip = info->dst_skip;
2004  map = info->table;
2005  srcfmt = info->src_fmt;
2006  srcbpp = srcfmt->BytesPerPixel;
2007 
2008  if (map == NULL) {
2009  while (height--) {
2010 #ifdef USE_DUFFS_LOOP
2011  /* *INDENT-OFF* */
2012  DUFFS_LOOP(
2013  DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
2014  sR, sG, sB);
2015  if ( 1 ) {
2016  /* Pack RGB into 8bit pixel */
2017  *dst = ((sR>>5)<<(3+2))|
2018  ((sG>>5)<<(2)) |
2019  ((sB>>6)<<(0)) ;
2020  }
2021  dst++;
2022  src += srcbpp;
2023  , width);
2024  /* *INDENT-ON* */
2025 #else
2026  for (c = width; c; --c) {
2027  DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
2028  if (1) {
2029  /* Pack RGB into 8bit pixel */
2030  *dst = ((sR >> 5) << (3 + 2)) |
2031  ((sG >> 5) << (2)) | ((sB >> 6) << (0));
2032  }
2033  dst++;
2034  src += srcbpp;
2035  }
2036 #endif
2037  src += srcskip;
2038  dst += dstskip;
2039  }
2040  } else {
2041  while (height--) {
2042 #ifdef USE_DUFFS_LOOP
2043  /* *INDENT-OFF* */
2044  DUFFS_LOOP(
2045  DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
2046  sR, sG, sB);
2047  if ( 1 ) {
2048  /* Pack RGB into 8bit pixel */
2049  *dst = map[((sR>>5)<<(3+2))|
2050  ((sG>>5)<<(2)) |
2051  ((sB>>6)<<(0)) ];
2052  }
2053  dst++;
2054  src += srcbpp;
2055  , width);
2056  /* *INDENT-ON* */
2057 #else
2058  for (c = width; c; --c) {
2059  DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
2060  if (1) {
2061  /* Pack RGB into 8bit pixel */
2062  *dst = map[((sR >> 5) << (3 + 2)) |
2063  ((sG >> 5) << (2)) | ((sB >> 6) << (0))];
2064  }
2065  dst++;
2066  src += srcbpp;
2067  }
2068 #endif /* USE_DUFFS_LOOP */
2069  src += srcskip;
2070  dst += dstskip;
2071  }
2072  }
2073 }
Uint8 * table
Definition: SDL_blit.h:67
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
Definition: SDL_stdinc.h:157
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
#define NULL
Definition: begin_code.h:164
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b)
Definition: SDL_blit.h:177
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:290

◆ BlitNto1Key()

static void BlitNto1Key ( SDL_BlitInfo info)
static

Definition at line 2217 of file SDL_blit_N.c.

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().

2218 {
2219  int width = info->dst_w;
2220  int height = info->dst_h;
2221  Uint8 *src = info->src;
2222  int srcskip = info->src_skip;
2223  Uint8 *dst = info->dst;
2224  int dstskip = info->dst_skip;
2225  SDL_PixelFormat *srcfmt = info->src_fmt;
2226  const Uint8 *palmap = info->table;
2227  Uint32 ckey = info->colorkey;
2228  Uint32 rgbmask = ~srcfmt->Amask;
2229  int srcbpp;
2230  Uint32 Pixel;
2231  unsigned sR, sG, sB;
2232 
2233  /* Set up some basic variables */
2234  srcbpp = srcfmt->BytesPerPixel;
2235  ckey &= rgbmask;
2236 
2237  if (palmap == NULL) {
2238  while (height--) {
2239  /* *INDENT-OFF* */
2240  DUFFS_LOOP(
2241  {
2242  DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
2243  sR, sG, sB);
2244  if ( (Pixel & rgbmask) != ckey ) {
2245  /* Pack RGB into 8bit pixel */
2246  *dst = (Uint8)(((sR>>5)<<(3+2))|
2247  ((sG>>5)<<(2)) |
2248  ((sB>>6)<<(0)));
2249  }
2250  dst++;
2251  src += srcbpp;
2252  },
2253  width);
2254  /* *INDENT-ON* */
2255  src += srcskip;
2256  dst += dstskip;
2257  }
2258  } else {
2259  while (height--) {
2260  /* *INDENT-OFF* */
2261  DUFFS_LOOP(
2262  {
2263  DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
2264  sR, sG, sB);
2265  if ( (Pixel & rgbmask) != ckey ) {
2266  /* Pack RGB into 8bit pixel */
2267  *dst = (Uint8)palmap[((sR>>5)<<(3+2))|
2268  ((sG>>5)<<(2)) |
2269  ((sB>>6)<<(0)) ];
2270  }
2271  dst++;
2272  src += srcbpp;
2273  },
2274  width);
2275  /* *INDENT-ON* */
2276  src += srcskip;
2277  dst += dstskip;
2278  }
2279  }
2280 }
Uint8 * table
Definition: SDL_blit.h:67
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint32 colorkey
Definition: SDL_blit.h:69
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
Definition: SDL_stdinc.h:157
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
Uint8 * src
Definition: SDL_blit.h:57
#define NULL
Definition: begin_code.h:164
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b)
Definition: SDL_blit.h:177

◆ BlitNto2101010()

static void BlitNto2101010 ( SDL_BlitInfo info)
static

Definition at line 2435 of file SDL_blit_N.c.

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().

2436 {
2437  int width = info->dst_w;
2438  int height = info->dst_h;
2439  Uint8 *src = info->src;
2440  int srcskip = info->src_skip;
2441  Uint8 *dst = info->dst;
2442  int dstskip = info->dst_skip;
2443  SDL_PixelFormat *srcfmt = info->src_fmt;
2444  int srcbpp = srcfmt->BytesPerPixel;
2445  Uint32 Pixel;
2446  unsigned sR, sG, sB, sA;
2447 
2448  while (height--) {
2449  /* *INDENT-OFF* */
2450  DUFFS_LOOP(
2451  {
2452  DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
2453  ARGB2101010_FROM_RGBA(Pixel, sR, sG, sB, sA);
2454  *(Uint32 *)dst = Pixel;
2455  dst += 4;
2456  src += srcbpp;
2457  },
2458  width);
2459  /* *INDENT-ON* */
2460  src += srcskip;
2461  dst += dstskip;
2462  }
2463 }
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint8 * dst
Definition: SDL_blit.h:61
#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a)
Definition: SDL_blit.h:353
uint8_t Uint8
Definition: SDL_stdinc.h:157
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
Uint8 * src
Definition: SDL_blit.h:57
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
#define ARGB2101010_FROM_RGBA(Pixel, r, g, b, a)
Definition: SDL_blit.h:253

◆ BlitNtoN()

static void BlitNtoN ( SDL_BlitInfo info)
static

Definition at line 2153 of file SDL_blit_N.c.

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_BlitInfo::src, SDL_BlitInfo::src_fmt, and SDL_BlitInfo::src_skip.

Referenced by SDL_CalculateBlitN().

2154 {
2155  int width = info->dst_w;
2156  int height = info->dst_h;
2157  Uint8 *src = info->src;
2158  int srcskip = info->src_skip;
2159  Uint8 *dst = info->dst;
2160  int dstskip = info->dst_skip;
2161  SDL_PixelFormat *srcfmt = info->src_fmt;
2162  int srcbpp = srcfmt->BytesPerPixel;
2163  SDL_PixelFormat *dstfmt = info->dst_fmt;
2164  int dstbpp = dstfmt->BytesPerPixel;
2165  unsigned alpha = dstfmt->Amask ? info->a : 0;
2166 
2167  while (height--) {
2168  /* *INDENT-OFF* */
2169  DUFFS_LOOP(
2170  {
2171  Uint32 Pixel;
2172  unsigned sR;
2173  unsigned sG;
2174  unsigned sB;
2175  DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
2176  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, alpha);
2177  dst += dstbpp;
2178  src += srcbpp;
2179  },
2180  width);
2181  /* *INDENT-ON* */
2182  src += srcskip;
2183  dst += dstskip;
2184  }
2185 }
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:402
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLfloat GLfloat GLfloat alpha
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
Definition: SDL_stdinc.h:157
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
Uint8 * src
Definition: SDL_blit.h:57
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b)
Definition: SDL_blit.h:177
Uint8 a
Definition: SDL_blit.h:70

◆ BlitNtoNCopyAlpha()

static void BlitNtoNCopyAlpha ( SDL_BlitInfo info)
static

Definition at line 2188 of file SDL_blit_N.c.

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, SDL_BlitInfo::src, SDL_BlitInfo::src_fmt, and SDL_BlitInfo::src_skip.

Referenced by SDL_CalculateBlitN().

2189 {
2190  int width = info->dst_w;
2191  int height = info->dst_h;
2192  Uint8 *src = info->src;
2193  int srcskip = info->src_skip;
2194  Uint8 *dst = info->dst;
2195  int dstskip = info->dst_skip;
2196  SDL_PixelFormat *srcfmt = info->src_fmt;
2197  int srcbpp = srcfmt->BytesPerPixel;
2198  SDL_PixelFormat *dstfmt = info->dst_fmt;
2199  int dstbpp = dstfmt->BytesPerPixel;
2200  int c;
2201 
2202  while (height--) {
2203  for (c = width; c; --c) {
2204  Uint32 Pixel;
2205  unsigned sR, sG, sB, sA;
2206  DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
2207  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA);
2208  dst += dstbpp;
2209  src += srcbpp;
2210  }
2211  src += srcskip;
2212  dst += dstskip;
2213  }
2214 }
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:402
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint8 * dst
Definition: SDL_blit.h:61
#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a)
Definition: SDL_blit.h:353
uint8_t Uint8
Definition: SDL_stdinc.h:157
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572

◆ BlitNtoNKey()

static void BlitNtoNKey ( SDL_BlitInfo info)
static

Definition at line 2317 of file SDL_blit_N.c.

References SDL_BlitInfo::a, SDL_PixelFormat::Amask, ASSEMBLE_RGBA, 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, RETRIEVE_RGB_PIXEL, RGB_FROM_PIXEL, SDL_BlitInfo::src, SDL_BlitInfo::src_fmt, and SDL_BlitInfo::src_skip.

Referenced by SDL_CalculateBlitN().

2318 {
2319  int width = info->dst_w;
2320  int height = info->dst_h;
2321  Uint8 *src = info->src;
2322  int srcskip = info->src_skip;
2323  Uint8 *dst = info->dst;
2324  int dstskip = info->dst_skip;
2325  Uint32 ckey = info->colorkey;
2326  SDL_PixelFormat *srcfmt = info->src_fmt;
2327  SDL_PixelFormat *dstfmt = info->dst_fmt;
2328  int srcbpp = srcfmt->BytesPerPixel;
2329  int dstbpp = dstfmt->BytesPerPixel;
2330  unsigned alpha = dstfmt->Amask ? info->a : 0;
2331  Uint32 rgbmask = ~srcfmt->Amask;
2332 
2333  /* Set up some basic variables */
2334  ckey &= rgbmask;
2335 
2336  while (height--) {
2337  /* *INDENT-OFF* */
2338  DUFFS_LOOP(
2339  {
2340  Uint32 Pixel;
2341  unsigned sR;
2342  unsigned sG;
2343  unsigned sB;
2344  RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel);
2345  if ( (Pixel & rgbmask) != ckey ) {
2346  RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB);
2347  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, alpha);
2348  }
2349  dst += dstbpp;
2350  src += srcbpp;
2351  },
2352  width);
2353  /* *INDENT-ON* */
2354  src += srcskip;
2355  dst += dstskip;
2356  }
2357 }
int src_skip
Definition: SDL_blit.h:60
#define RETRIEVE_RGB_PIXEL(buf, bpp, Pixel)
Definition: SDL_blit.h:146
GLenum GLenum dst
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:402
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLfloat GLfloat GLfloat alpha
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint32 colorkey
Definition: SDL_blit.h:69
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
Definition: SDL_stdinc.h:157
#define RGB_FROM_PIXEL(Pixel, fmt, r, g, b)
Definition: SDL_blit.h:122
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
Uint8 * src
Definition: SDL_blit.h:57
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
Uint8 a
Definition: SDL_blit.h:70

◆ BlitNtoNKeyCopyAlpha()

static void BlitNtoNKeyCopyAlpha ( SDL_BlitInfo info)
static

Definition at line 2360 of file SDL_blit_N.c.

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_BlitInfo::src, SDL_BlitInfo::src_fmt, and SDL_BlitInfo::src_skip.

Referenced by SDL_CalculateBlitN().

2361 {
2362  int width = info->dst_w;
2363  int height = info->dst_h;
2364  Uint8 *src = info->src;
2365  int srcskip = info->src_skip;
2366  Uint8 *dst = info->dst;
2367  int dstskip = info->dst_skip;
2368  Uint32 ckey = info->colorkey;
2369  SDL_PixelFormat *srcfmt = info->src_fmt;
2370  SDL_PixelFormat *dstfmt = info->dst_fmt;
2371  Uint32 rgbmask = ~srcfmt->Amask;
2372 
2373  Uint8 srcbpp;
2374  Uint8 dstbpp;
2375  Uint32 Pixel;
2376  unsigned sR, sG, sB, sA;
2377 
2378  /* Set up some basic variables */
2379  srcbpp = srcfmt->BytesPerPixel;
2380  dstbpp = dstfmt->BytesPerPixel;
2381  ckey &= rgbmask;
2382 
2383  while (height--) {
2384  /* *INDENT-OFF* */
2385  DUFFS_LOOP(
2386  {
2387  DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
2388  if ( (Pixel & rgbmask) != ckey ) {
2389  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA);
2390  }
2391  dst += dstbpp;
2392  src += srcbpp;
2393  },
2394  width);
2395  /* *INDENT-ON* */
2396  src += srcskip;
2397  dst += dstskip;
2398  }
2399 }
int src_skip
Definition: SDL_blit.h:60
GLenum GLenum dst
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:402
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
Definition: SDL_stdinc.h:181
GLenum src
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
Uint32 colorkey
Definition: SDL_blit.h:69
Uint8 * dst
Definition: SDL_blit.h:61
#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a)
Definition: SDL_blit.h:353
uint8_t Uint8
Definition: SDL_stdinc.h:157
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
Uint8 * src
Definition: SDL_blit.h:57
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572

◆ SDL_CalculateBlitN()

SDL_BlitFunc SDL_CalculateBlitN ( SDL_Surface surface)

Definition at line 2537 of file SDL_blit_N.c.

References blit_table::alpha, SDL_PixelFormat::Amask, SDL_PixelFormat::BitsPerPixel, Blit2101010toN(), Blit2to2Key(), Blit4to4CopyAlpha(), Blit4to4MaskAlpha(), blit_table::blit_features, 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_BlitMap::dst, blit_table::dstB, blit_table::dstbpp, blit_table::dstG, blit_table::dstR, SDL_BlitInfo::flags, SDL_Surface::format, SDL_PixelFormat::format, GetBlitFeatures, SDL_PixelFormat::Gmask, SDL_BlitMap::identity, SDL_BlitMap::info, SDL_Surface::map, MASKOK, NO_ALPHA, NULL, SDL_PixelFormat::Rmask, SDL_COPY_COLORKEY, SDL_COPY_RLE_MASK, SDL_HasAltiVec, SDL_PIXELFORMAT_ARGB2101010, SET_ALPHA, blit_table::srcB, blit_table::srcG, and blit_table::srcR.

Referenced by SDL_CalculateBlit().

2538 {
2539  SDL_PixelFormat *srcfmt;
2540  SDL_PixelFormat *dstfmt;
2541  const struct blit_table *table;
2542  int which;
2543  SDL_BlitFunc blitfun;
2544 
2545  /* Set up data for choosing the blit */
2546  srcfmt = surface->format;
2547  dstfmt = surface->map->dst->format;
2548 
2549  /* We don't support destinations less than 8-bits */
2550  if (dstfmt->BitsPerPixel < 8) {
2551  return (NULL);
2552  }
2553 
2554  switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
2555  case 0:
2556  blitfun = NULL;
2557  if (dstfmt->BitsPerPixel == 8) {
2558  if ((srcfmt->BytesPerPixel == 4) &&
2559  (srcfmt->Rmask == 0x00FF0000) &&
2560  (srcfmt->Gmask == 0x0000FF00) &&
2561  (srcfmt->Bmask == 0x000000FF)) {
2562  blitfun = Blit_RGB888_index8;
2563  } else if ((srcfmt->BytesPerPixel == 4) &&
2564  (srcfmt->Rmask == 0x3FF00000) &&
2565  (srcfmt->Gmask == 0x000FFC00) &&
2566  (srcfmt->Bmask == 0x000003FF)) {
2567  blitfun = Blit_RGB101010_index8;
2568  } else {
2569  blitfun = BlitNto1;
2570  }
2571  } else {
2572  /* Now the meat, choose the blitter we want */
2573  int a_need = NO_ALPHA;
2574  if (dstfmt->Amask)
2575  a_need = srcfmt->Amask ? COPY_ALPHA : SET_ALPHA;
2576  table = normal_blit[srcfmt->BytesPerPixel - 1];
2577  for (which = 0; table[which].dstbpp; ++which) {
2578  if (MASKOK(srcfmt->Rmask, table[which].srcR) &&
2579  MASKOK(srcfmt->Gmask, table[which].srcG) &&
2580  MASKOK(srcfmt->Bmask, table[which].srcB) &&
2581  MASKOK(dstfmt->Rmask, table[which].dstR) &&
2582  MASKOK(dstfmt->Gmask, table[which].dstG) &&
2583  MASKOK(dstfmt->Bmask, table[which].dstB) &&
2584  dstfmt->BytesPerPixel == table[which].dstbpp &&
2585  (a_need & table[which].alpha) == a_need &&
2586  ((table[which].blit_features & GetBlitFeatures()) ==
2587  table[which].blit_features))
2588  break;
2589  }
2590  blitfun = table[which].blitfunc;
2591 
2592  if (blitfun == BlitNtoN) { /* default C fallback catch-all. Slow! */
2593  if (srcfmt->format == SDL_PIXELFORMAT_ARGB2101010) {
2594  blitfun = Blit2101010toN;
2595  } else if (dstfmt->format == SDL_PIXELFORMAT_ARGB2101010) {
2596  blitfun = BlitNto2101010;
2597  } else if (srcfmt->BytesPerPixel == 4 &&
2598  dstfmt->BytesPerPixel == 4 &&
2599  srcfmt->Rmask == dstfmt->Rmask &&
2600  srcfmt->Gmask == dstfmt->Gmask &&
2601  srcfmt->Bmask == dstfmt->Bmask) {
2602  if (a_need == COPY_ALPHA) {
2603  if (srcfmt->Amask == dstfmt->Amask) {
2604  /* Fastpath C fallback: 32bit RGBA<->RGBA blit with matching RGBA */
2605  blitfun = Blit4to4CopyAlpha;
2606  } else {
2607  blitfun = BlitNtoNCopyAlpha;
2608  }
2609  } else {
2610  /* Fastpath C fallback: 32bit RGB<->RGBA blit with matching RGB */
2611  blitfun = Blit4to4MaskAlpha;
2612  }
2613  } else if (a_need == COPY_ALPHA) {
2614  blitfun = BlitNtoNCopyAlpha;
2615  }
2616  }
2617  }
2618  return (blitfun);
2619 
2620  case SDL_COPY_COLORKEY:
2621  /* colorkey blit: Here we don't have too many options, mostly
2622  because RLE is the preferred fast way to deal with this.
2623  If a particular case turns out to be useful we'll add it. */
2624 
2625  if (srcfmt->BytesPerPixel == 2 && surface->map->identity)
2626  return Blit2to2Key;
2627  else if (dstfmt->BytesPerPixel == 1)
2628  return BlitNto1Key;
2629  else {
2630 #if SDL_ALTIVEC_BLITTERS
2631  if ((srcfmt->BytesPerPixel == 4) && (dstfmt->BytesPerPixel == 4)
2632  && SDL_HasAltiVec()) {
2633  return Blit32to32KeyAltivec;
2634  } else
2635 #endif
2636  if (srcfmt->Amask && dstfmt->Amask) {
2637  return BlitNtoNKeyCopyAlpha;
2638  } else {
2639  return BlitNtoNKey;
2640  }
2641  }
2642  }
2643 
2644  return NULL;
2645 }
SDL_BlitFunc blitfunc
Definition: SDL_blit_N.c:2475
#define SDL_HasAltiVec
Uint32 srcG
Definition: SDL_blit_N.c:2471
Uint32 srcB
Definition: SDL_blit_N.c:2471
#define MASKOK(x, y)
Definition: SDL_blit_N.c:2534
GLenum GLsizei GLenum GLenum const void * table
#define SDL_COPY_COLORKEY
Definition: SDL_blit.h:39
Uint32 blit_features
Definition: SDL_blit_N.c:2474
Uint32 dstB
Definition: SDL_blit_N.c:2473
Uint32 dstR
Definition: SDL_blit_N.c:2473
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
#define NO_ALPHA
Definition: SDL_blit_N.c:2466
static void BlitNto2101010(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2435
#define SDL_COPY_RLE_MASK
Definition: SDL_blit.h:44
Uint32 srcR
Definition: SDL_blit_N.c:2471
static void BlitNtoNCopyAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2188
struct SDL_BlitMap * map
Definition: SDL_surface.h:88
#define SET_ALPHA
Definition: SDL_blit_N.c:2467
Uint32 dstG
Definition: SDL_blit_N.c:2473
static void Blit2to2Key(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2283
Uint8 BitsPerPixel
Definition: SDL_pixels.h:319
static void Blit4to4MaskAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2077
static void BlitNto1Key(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2217
static void Blit_RGB888_index8(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:897
SDL_Surface * dst
Definition: SDL_blit.h:88
#define NULL
Definition: begin_code.h:164
SDL_PixelFormat * format
Definition: SDL_surface.h:72
static const struct blit_table *const normal_blit[]
Definition: SDL_blit_N.c:2529
static void BlitNtoNKey(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2317
#define COPY_ALPHA
Definition: SDL_blit_N.c:2468
static void Blit2101010toN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2403
static void BlitNtoNKeyCopyAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2360
#define GetBlitFeatures()
Definition: SDL_blit_N.c:878
void(* SDL_BlitFunc)(SDL_BlitInfo *info)
Definition: SDL_blit.h:73
Uint32 alpha
Definition: SDL_blit_N.c:2476
static void Blit_RGB101010_index8(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1007
static void Blit4to4CopyAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2127
static void BlitNtoN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2153
int identity
Definition: SDL_blit.h:89
SDL_BlitInfo info
Definition: SDL_blit.h:92
static void BlitNto1(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1982

Variable Documentation

◆ normal_blit

const struct blit_table* const normal_blit[]
static
Initial value:
= {
}
static const struct blit_table normal_blit_2[]
Definition: SDL_blit_N.c:2483
static const struct blit_table normal_blit_3[]
Definition: SDL_blit_N.c:2504
static const struct blit_table normal_blit_1[]
Definition: SDL_blit_N.c:2478
static const struct blit_table normal_blit_4[]
Definition: SDL_blit_N.c:2509

Definition at line 2529 of file SDL_blit_N.c.

◆ normal_blit_1

const struct blit_table normal_blit_1[]
static
Initial value:
= {
{0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
}
static void BlitNtoN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2153

Definition at line 2478 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}
}
#define NO_ALPHA
Definition: SDL_blit_N.c:2466
static void Blit_RGB565_ARGB8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1562
#define SET_ALPHA
Definition: SDL_blit_N.c:2467
static void Blit_RGB565_RGBA8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1838
static void Blit_RGB565_BGRA8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1976
#define COPY_ALPHA
Definition: SDL_blit_N.c:2468
static void BlitNtoN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2153
static void Blit_RGB565_ABGR8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1700

Definition at line 2483 of file SDL_blit_N.c.

◆ normal_blit_3

const struct blit_table normal_blit_3[]
static
Initial value:
= {
{0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
}
static void BlitNtoN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2153

Definition at line 2504 of file SDL_blit_N.c.

◆ normal_blit_4

const struct blit_table normal_blit_4[]
static
Initial value:
= {
{0x00FF0000, 0x0000FF00, 0x000000FF, 2, 0x0000F800, 0x000007E0, 0x0000001F,
{0x00FF0000, 0x0000FF00, 0x000000FF, 2, 0x00007C00, 0x000003E0, 0x0000001F,
0, Blit_RGB888_RGB555, NO_ALPHA},
{0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
}
#define NO_ALPHA
Definition: SDL_blit_N.c:2466
static void BlitNtoN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2153
static void Blit_RGB888_RGB555(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1127
static void Blit_RGB888_RGB565(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1253

Definition at line 2509 of file SDL_blit_N.c.

◆ RGB565_ABGR8888_LUT

const Uint32 RGB565_ABGR8888_LUT[512]
static

Definition at line 1568 of file SDL_blit_N.c.

◆ RGB565_ARGB8888_LUT

const Uint32 RGB565_ARGB8888_LUT[512]
static

Definition at line 1430 of file SDL_blit_N.c.

◆ RGB565_BGRA8888_LUT

const Uint32 RGB565_BGRA8888_LUT[512]
static

Definition at line 1844 of file SDL_blit_N.c.

◆ RGB565_RGBA8888_LUT

const Uint32 RGB565_RGBA8888_LUT[512]
static

Definition at line 1706 of file SDL_blit_N.c.