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

#define COPY_ALPHA   4

Definition at line 2521 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

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

Definition at line 878 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

#define HI   1

Definition at line 883 of file SDL_blit_N.c.

Referenced by Blit1to2().

#define LO   0

Definition at line 884 of file SDL_blit_N.c.

Referenced by Blit1to2().

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

Definition at line 2587 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

#define NO_ALPHA   1

Definition at line 2519 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

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

Definition at line 1001 of file SDL_blit_N.c.

Referenced by Blit_RGB101010_index8().

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

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

Definition at line 891 of file SDL_blit_N.c.

Referenced by Blit_RGB888_index8().

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

Definition at line 1111 of file SDL_blit_N.c.

Referenced by Blit_RGB888_RGB555().

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

Definition at line 1237 of file SDL_blit_N.c.

Referenced by Blit_RGB888_RGB565().

#define SET_ALPHA   2

Definition at line 2520 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

Function Documentation

static void Blit2101010toN ( SDL_BlitInfo info)
static

Definition at line 2456 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().

2457 {
2458  int width = info->dst_w;
2459  int height = info->dst_h;
2460  Uint8 *src = info->src;
2461  int srcskip = info->src_skip;
2462  Uint8 *dst = info->dst;
2463  int dstskip = info->dst_skip;
2464  SDL_PixelFormat *dstfmt = info->dst_fmt;
2465  int dstbpp = dstfmt->BytesPerPixel;
2466  Uint32 Pixel;
2467  unsigned sR, sG, sB, sA;
2468 
2469  while (height--) {
2470  /* *INDENT-OFF* */
2471  DUFFS_LOOP(
2472  {
2473  Pixel = *(Uint32 *)src;
2474  RGBA_FROM_ARGB2101010(Pixel, sR, sG, sB, sA);
2475  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA);
2476  dst += dstbpp;
2477  src += 4;
2478  },
2479  width);
2480  /* *INDENT-ON* */
2481  src += srcskip;
2482  dst += dstskip;
2483  }
2484 }
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
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:179
#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
uint32_t Uint32
Definition: SDL_stdinc.h:203
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
uint16_t Uint16
Definition: SDL_stdinc.h:191
int dst_skip
Definition: SDL_blit.h:64
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
uint32_t Uint32
Definition: SDL_stdinc.h:203
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
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:179
#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
uint32_t Uint32
Definition: SDL_stdinc.h:203
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
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:179
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
uint32_t Uint32
Definition: SDL_stdinc.h:203
Uint8 a
Definition: SDL_blit.h:70
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
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:179
#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
uint32_t Uint32
Definition: SDL_stdinc.h:203
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
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
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:179
#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
uint32_t Uint32
Definition: SDL_stdinc.h:203
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
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
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
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
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
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
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:179
#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
uint32_t Uint32
Definition: SDL_stdinc.h:203
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
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
uint16_t Uint16
Definition: SDL_stdinc.h:191
int dst_skip
Definition: SDL_blit.h:64
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
uint32_t Uint32
Definition: SDL_stdinc.h:203
#define RGB888_RGB555(dst, src)
Definition: SDL_blit_N.c:1111
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
uint16_t Uint16
Definition: SDL_stdinc.h:191
int dst_skip
Definition: SDL_blit.h:64
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
uint32_t Uint32
Definition: SDL_stdinc.h:203
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
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:179
#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
uint32_t Uint32
Definition: SDL_stdinc.h:203
#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
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
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:179
#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
uint32_t Uint32
Definition: SDL_stdinc.h:203
#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b)
Definition: SDL_blit.h:177
static void BlitNto2101010 ( SDL_BlitInfo info)
static

Definition at line 2488 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().

2489 {
2490  int width = info->dst_w;
2491  int height = info->dst_h;
2492  Uint8 *src = info->src;
2493  int srcskip = info->src_skip;
2494  Uint8 *dst = info->dst;
2495  int dstskip = info->dst_skip;
2496  SDL_PixelFormat *srcfmt = info->src_fmt;
2497  int srcbpp = srcfmt->BytesPerPixel;
2498  Uint32 Pixel;
2499  unsigned sR, sG, sB, sA;
2500 
2501  while (height--) {
2502  /* *INDENT-OFF* */
2503  DUFFS_LOOP(
2504  {
2505  DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
2506  ARGB2101010_FROM_RGBA(Pixel, sR, sG, sB, sA);
2507  *(Uint32 *)dst = Pixel;
2508  dst += 4;
2509  src += srcbpp;
2510  },
2511  width);
2512  /* *INDENT-ON* */
2513  src += srcskip;
2514  dst += dstskip;
2515  }
2516 }
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
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:179
#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
uint32_t Uint32
Definition: SDL_stdinc.h:203
#define ARGB2101010_FROM_RGBA(Pixel, r, g, b, a)
Definition: SDL_blit.h:253
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
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:179
#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
uint32_t Uint32
Definition: SDL_stdinc.h:203
#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b)
Definition: SDL_blit.h:177
Uint8 a
Definition: SDL_blit.h:70
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
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:179
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
uint32_t Uint32
Definition: SDL_stdinc.h:203
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, SDL_PixelFormat::format, RETRIEVE_RGB_PIXEL, RGB_FROM_PIXEL, SDL_PIXELFORMAT_BGR888, SDL_PIXELFORMAT_RGB888, 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  /* Fastpath: same source/destination format, no Amask, bpp 32, loop is vectorized. ~10x faster */
2337  if (srcfmt->format == dstfmt->format &&
2338  (srcfmt->format == SDL_PIXELFORMAT_RGB888 || srcfmt->format == SDL_PIXELFORMAT_BGR888)) {
2339  Uint32 *src32 = (Uint32*)src;
2340  Uint32 *dst32 = (Uint32*)dst;
2341  srcskip /= sizeof(Uint32);
2342  dstskip /= sizeof(Uint32);
2343  while (height--) {
2344  /* *INDENT-OFF* */
2345  DUFFS_LOOP(
2346  {
2347  if (*src32 != ckey) {
2348  *dst32 = *src32;
2349  }
2350  ++src32;
2351  ++dst32;
2352  },
2353  width);
2354  /* *INDENT-ON* */
2355  src32 += srcskip;
2356  dst32 += dstskip;
2357  }
2358  return;
2359  }
2360 
2361  while (height--) {
2362  /* *INDENT-OFF* */
2363  DUFFS_LOOP(
2364  {
2365  Uint32 Pixel;
2366  unsigned sR;
2367  unsigned sG;
2368  unsigned sB;
2369  RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel);
2370  if ( (Pixel & rgbmask) != ckey ) {
2371  RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB);
2372  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, alpha);
2373  }
2374  dst += dstbpp;
2375  src += srcbpp;
2376  },
2377  width);
2378  /* *INDENT-ON* */
2379  src += srcskip;
2380  dst += dstskip;
2381  }
2382 }
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
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:179
#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
uint32_t Uint32
Definition: SDL_stdinc.h:203
Uint8 a
Definition: SDL_blit.h:70
static void BlitNtoNKeyCopyAlpha ( SDL_BlitInfo info)
static

Definition at line 2385 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_PixelFormat::format, SDL_PIXELFORMAT_ABGR8888, 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().

2386 {
2387  int width = info->dst_w;
2388  int height = info->dst_h;
2389  Uint8 *src = info->src;
2390  int srcskip = info->src_skip;
2391  Uint8 *dst = info->dst;
2392  int dstskip = info->dst_skip;
2393  Uint32 ckey = info->colorkey;
2394  SDL_PixelFormat *srcfmt = info->src_fmt;
2395  SDL_PixelFormat *dstfmt = info->dst_fmt;
2396  Uint32 rgbmask = ~srcfmt->Amask;
2397 
2398  Uint8 srcbpp;
2399  Uint8 dstbpp;
2400  Uint32 Pixel;
2401  unsigned sR, sG, sB, sA;
2402 
2403  /* Set up some basic variables */
2404  srcbpp = srcfmt->BytesPerPixel;
2405  dstbpp = dstfmt->BytesPerPixel;
2406  ckey &= rgbmask;
2407 
2408  /* Fastpath: same source/destination format, with Amask, bpp 32, loop is vectorized. ~10x faster */
2409  if (srcfmt->format == dstfmt->format &&
2410  (srcfmt->format == SDL_PIXELFORMAT_ARGB8888 ||
2411  srcfmt->format == SDL_PIXELFORMAT_ABGR8888 ||
2412  srcfmt->format == SDL_PIXELFORMAT_BGRA8888 ||
2413  srcfmt->format == SDL_PIXELFORMAT_RGBA8888)) {
2414  Uint32 *src32 = (Uint32*)src;
2415  Uint32 *dst32 = (Uint32*)dst;
2416  srcskip /= sizeof(Uint32);
2417  dstskip /= sizeof(Uint32);
2418  while (height--) {
2419  /* *INDENT-OFF* */
2420  DUFFS_LOOP(
2421  {
2422  if ((*src32 & rgbmask) != ckey) {
2423  *dst32 = *src32;
2424  }
2425  ++src32;
2426  ++dst32;
2427  },
2428  width);
2429  /* *INDENT-ON* */
2430  src32 += srcskip;
2431  dst32 += dstskip;
2432  }
2433  return;
2434  }
2435 
2436  while (height--) {
2437  /* *INDENT-OFF* */
2438  DUFFS_LOOP(
2439  {
2440  DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
2441  if ( (Pixel & rgbmask) != ckey ) {
2442  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA);
2443  }
2444  dst += dstbpp;
2445  src += srcbpp;
2446  },
2447  width);
2448  /* *INDENT-ON* */
2449  src += srcskip;
2450  dst += dstskip;
2451  }
2452 }
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
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:179
#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
uint32_t Uint32
Definition: SDL_stdinc.h:203
SDL_BlitFunc SDL_CalculateBlitN ( SDL_Surface surface)

Definition at line 2590 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().

2591 {
2592  SDL_PixelFormat *srcfmt;
2593  SDL_PixelFormat *dstfmt;
2594  const struct blit_table *table;
2595  int which;
2596  SDL_BlitFunc blitfun;
2597 
2598  /* Set up data for choosing the blit */
2599  srcfmt = surface->format;
2600  dstfmt = surface->map->dst->format;
2601 
2602  /* We don't support destinations less than 8-bits */
2603  if (dstfmt->BitsPerPixel < 8) {
2604  return (NULL);
2605  }
2606 
2607  switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
2608  case 0:
2609  blitfun = NULL;
2610  if (dstfmt->BitsPerPixel == 8) {
2611  if ((srcfmt->BytesPerPixel == 4) &&
2612  (srcfmt->Rmask == 0x00FF0000) &&
2613  (srcfmt->Gmask == 0x0000FF00) &&
2614  (srcfmt->Bmask == 0x000000FF)) {
2615  blitfun = Blit_RGB888_index8;
2616  } else if ((srcfmt->BytesPerPixel == 4) &&
2617  (srcfmt->Rmask == 0x3FF00000) &&
2618  (srcfmt->Gmask == 0x000FFC00) &&
2619  (srcfmt->Bmask == 0x000003FF)) {
2620  blitfun = Blit_RGB101010_index8;
2621  } else {
2622  blitfun = BlitNto1;
2623  }
2624  } else {
2625  /* Now the meat, choose the blitter we want */
2626  int a_need = NO_ALPHA;
2627  if (dstfmt->Amask)
2628  a_need = srcfmt->Amask ? COPY_ALPHA : SET_ALPHA;
2629  table = normal_blit[srcfmt->BytesPerPixel - 1];
2630  for (which = 0; table[which].dstbpp; ++which) {
2631  if (MASKOK(srcfmt->Rmask, table[which].srcR) &&
2632  MASKOK(srcfmt->Gmask, table[which].srcG) &&
2633  MASKOK(srcfmt->Bmask, table[which].srcB) &&
2634  MASKOK(dstfmt->Rmask, table[which].dstR) &&
2635  MASKOK(dstfmt->Gmask, table[which].dstG) &&
2636  MASKOK(dstfmt->Bmask, table[which].dstB) &&
2637  dstfmt->BytesPerPixel == table[which].dstbpp &&
2638  (a_need & table[which].alpha) == a_need &&
2639  ((table[which].blit_features & GetBlitFeatures()) ==
2640  table[which].blit_features))
2641  break;
2642  }
2643  blitfun = table[which].blitfunc;
2644 
2645  if (blitfun == BlitNtoN) { /* default C fallback catch-all. Slow! */
2646  if (srcfmt->format == SDL_PIXELFORMAT_ARGB2101010) {
2647  blitfun = Blit2101010toN;
2648  } else if (dstfmt->format == SDL_PIXELFORMAT_ARGB2101010) {
2649  blitfun = BlitNto2101010;
2650  } else if (srcfmt->BytesPerPixel == 4 &&
2651  dstfmt->BytesPerPixel == 4 &&
2652  srcfmt->Rmask == dstfmt->Rmask &&
2653  srcfmt->Gmask == dstfmt->Gmask &&
2654  srcfmt->Bmask == dstfmt->Bmask) {
2655  if (a_need == COPY_ALPHA) {
2656  if (srcfmt->Amask == dstfmt->Amask) {
2657  /* Fastpath C fallback: 32bit RGBA<->RGBA blit with matching RGBA */
2658  blitfun = Blit4to4CopyAlpha;
2659  } else {
2660  blitfun = BlitNtoNCopyAlpha;
2661  }
2662  } else {
2663  /* Fastpath C fallback: 32bit RGB<->RGBA blit with matching RGB */
2664  blitfun = Blit4to4MaskAlpha;
2665  }
2666  } else if (a_need == COPY_ALPHA) {
2667  blitfun = BlitNtoNCopyAlpha;
2668  }
2669  }
2670  }
2671  return (blitfun);
2672 
2673  case SDL_COPY_COLORKEY:
2674  /* colorkey blit: Here we don't have too many options, mostly
2675  because RLE is the preferred fast way to deal with this.
2676  If a particular case turns out to be useful we'll add it. */
2677 
2678  if (srcfmt->BytesPerPixel == 2 && surface->map->identity)
2679  return Blit2to2Key;
2680  else if (dstfmt->BytesPerPixel == 1)
2681  return BlitNto1Key;
2682  else {
2683 #if SDL_ALTIVEC_BLITTERS
2684  if ((srcfmt->BytesPerPixel == 4) && (dstfmt->BytesPerPixel == 4)
2685  && SDL_HasAltiVec()) {
2686  return Blit32to32KeyAltivec;
2687  } else
2688 #endif
2689  if (srcfmt->Amask && dstfmt->Amask) {
2690  return BlitNtoNKeyCopyAlpha;
2691  } else {
2692  return BlitNtoNKey;
2693  }
2694  }
2695  }
2696 
2697  return NULL;
2698 }
SDL_BlitFunc blitfunc
Definition: SDL_blit_N.c:2528
void(* SDL_BlitFunc)(SDL_BlitInfo *info)
Definition: SDL_blit.h:73
#define SDL_HasAltiVec
Uint32 srcG
Definition: SDL_blit_N.c:2524
Uint32 srcB
Definition: SDL_blit_N.c:2524
#define MASKOK(x, y)
Definition: SDL_blit_N.c:2587
GLenum GLsizei GLenum GLenum const void * table
#define SDL_COPY_COLORKEY
Definition: SDL_blit.h:39
Uint32 blit_features
Definition: SDL_blit_N.c:2527
Uint32 dstB
Definition: SDL_blit_N.c:2526
Uint32 dstR
Definition: SDL_blit_N.c:2526
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
#define NO_ALPHA
Definition: SDL_blit_N.c:2519
static void BlitNto2101010(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2488
#define SDL_COPY_RLE_MASK
Definition: SDL_blit.h:44
Uint32 srcR
Definition: SDL_blit_N.c:2524
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:2520
Uint32 dstG
Definition: SDL_blit_N.c:2526
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:2582
static void BlitNtoNKey(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2317
#define COPY_ALPHA
Definition: SDL_blit_N.c:2521
static void Blit2101010toN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2456
static void BlitNtoNKeyCopyAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2385
#define GetBlitFeatures()
Definition: SDL_blit_N.c:878
Uint32 alpha
Definition: SDL_blit_N.c:2529
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

const struct blit_table* const normal_blit[]
static
Initial value:
= {
}
static const struct blit_table normal_blit_2[]
Definition: SDL_blit_N.c:2536
static const struct blit_table normal_blit_3[]
Definition: SDL_blit_N.c:2557
static const struct blit_table normal_blit_1[]
Definition: SDL_blit_N.c:2531
static const struct blit_table normal_blit_4[]
Definition: SDL_blit_N.c:2562

Definition at line 2582 of file SDL_blit_N.c.

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

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:2519
static void Blit_RGB565_ARGB8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1562
#define SET_ALPHA
Definition: SDL_blit_N.c:2520
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:2521
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 2536 of file SDL_blit_N.c.

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

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, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
}
#define NO_ALPHA
Definition: SDL_blit_N.c:2519
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 2562 of file SDL_blit_N.c.

const Uint32 RGB565_ABGR8888_LUT[512]
static

Definition at line 1568 of file SDL_blit_N.c.

const Uint32 RGB565_ARGB8888_LUT[512]
static

Definition at line 1430 of file SDL_blit_N.c.

const Uint32 RGB565_BGRA8888_LUT[512]
static

Definition at line 1844 of file SDL_blit_N.c.

const Uint32 RGB565_RGBA8888_LUT[512]
static

Definition at line 1706 of file SDL_blit_N.c.