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_RGB555_TWO(dst, src)
 
#define RGB888_RGB565(dst, src)
 
#define RGB888_RGB565_TWO(dst, src)
 
#define RGB565_32(dst, src, map)   (map[src[LO]*2] + map[src[HI]*2+1])
 
#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

§ GetBlitFeatures

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

Definition at line 874 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

§ HI

#define HI   1

Definition at line 879 of file SDL_blit_N.c.

§ LO

#define LO   0

Definition at line 880 of file SDL_blit_N.c.

§ MASKOK

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

Definition at line 2524 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)); \
}
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
GLenum src

Definition at line 997 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 1356 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)); \
}
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
GLenum src

Definition at line 887 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
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
GLenum src

Definition at line 1107 of file SDL_blit_N.c.

Referenced by Blit_RGB888_RGB555().

§ RGB888_RGB555_TWO

#define RGB888_RGB555_TWO (   dst,
  src 
)
Value:
{ \
*(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>9)| \
(((src[HI])&0x0000F800)>>6)| \
(((src[HI])&0x000000F8)>>3))<<16)| \
(((src[LO])&0x00F80000)>>9)| \
(((src[LO])&0x0000F800)>>6)| \
(((src[LO])&0x000000F8)>>3); \
}
GLenum GLenum dst
#define HI
Definition: SDL_blit_N.c:879
#define LO
Definition: SDL_blit_N.c:880
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLenum src

Definition at line 1112 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
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
GLenum src

Definition at line 1231 of file SDL_blit_N.c.

Referenced by Blit_RGB888_RGB565().

§ RGB888_RGB565_TWO

#define RGB888_RGB565_TWO (   dst,
  src 
)
Value:
{ \
*(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>8)| \
(((src[HI])&0x0000FC00)>>5)| \
(((src[HI])&0x000000F8)>>3))<<16)| \
(((src[LO])&0x00F80000)>>8)| \
(((src[LO])&0x0000FC00)>>5)| \
(((src[LO])&0x000000F8)>>3); \
}
GLenum GLenum dst
#define HI
Definition: SDL_blit_N.c:879
#define LO
Definition: SDL_blit_N.c:880
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLenum src

Definition at line 1236 of file SDL_blit_N.c.

Referenced by Blit_RGB888_RGB565().

Function Documentation

§ Blit2101010toN()

static void Blit2101010toN ( SDL_BlitInfo info)
static

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

2396 {
2397  int width = info->dst_w;
2398  int height = info->dst_h;
2399  Uint8 *src = info->src;
2400  int srcskip = info->src_skip;
2401  Uint8 *dst = info->dst;
2402  int dstskip = info->dst_skip;
2403  SDL_PixelFormat *dstfmt = info->dst_fmt;
2404  int dstbpp = dstfmt->BytesPerPixel;
2405  Uint32 Pixel;
2406  unsigned sR, sG, sB, sA;
2407 
2408  while (height--) {
2409  /* *INDENT-OFF* */
2410  DUFFS_LOOP(
2411  {
2412  Pixel = *(Uint32 *)src;
2413  RGBA_FROM_ARGB2101010(Pixel, sR, sG, sB, sA);
2414  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA);
2415  dst += dstbpp;
2416  src += 4;
2417  },
2418  width);
2419  /* *INDENT-ON* */
2420  src += srcskip;
2421  dst += dstskip;
2422  }
2423 }
GLenum GLenum dst
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
int src_skip
Definition: SDL_blit.h:60
Uint8 BytesPerPixel
Definition: SDL_pixels.h:318
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:401
#define RGBA_FROM_ARGB2101010(Pixel, r, g, b, a)
Definition: SDL_blit.h:345
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
Uint8 * src
Definition: SDL_blit.h:57
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
GLenum src

§ Blit2to2Key()

static void Blit2to2Key ( SDL_BlitInfo info)
static

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

2276 {
2277  int width = info->dst_w;
2278  int height = info->dst_h;
2279  Uint16 *srcp = (Uint16 *) info->src;
2280  int srcskip = info->src_skip;
2281  Uint16 *dstp = (Uint16 *) info->dst;
2282  int dstskip = info->dst_skip;
2283  Uint32 ckey = info->colorkey;
2284  Uint32 rgbmask = ~info->src_fmt->Amask;
2285 
2286  /* Set up some basic variables */
2287  srcskip /= 2;
2288  dstskip /= 2;
2289  ckey &= rgbmask;
2290 
2291  while (height--) {
2292  /* *INDENT-OFF* */
2293  DUFFS_LOOP(
2294  {
2295  if ( (*srcp & rgbmask) != ckey ) {
2296  *dstp = *srcp;
2297  }
2298  dstp++;
2299  srcp++;
2300  },
2301  width);
2302  /* *INDENT-ON* */
2303  srcp += srcskip;
2304  dstp += dstskip;
2305  }
2306 }
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
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
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
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:499
Uint8 * src
Definition: SDL_blit.h:57
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151

§ Blit4to4CopyAlpha()

static void Blit4to4CopyAlpha ( SDL_BlitInfo info)
static

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

2120 {
2121  int width = info->dst_w;
2122  int height = info->dst_h;
2123  Uint32 *src = (Uint32 *) info->src;
2124  int srcskip = info->src_skip;
2125  Uint32 *dst = (Uint32 *) info->dst;
2126  int dstskip = info->dst_skip;
2127 
2128  /* RGBA->RGBA, COPY_ALPHA */
2129  while (height--) {
2130  /* *INDENT-OFF* */
2131  DUFFS_LOOP(
2132  {
2133  *dst = *src;
2134  ++dst;
2135  ++src;
2136  },
2137  width);
2138  /* *INDENT-ON* */
2139  src = (Uint32 *) ((Uint8 *) src + srcskip);
2140  dst = (Uint32 *) ((Uint8 *) dst + dstskip);
2141  }
2142 }
GLenum GLenum dst
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
int src_skip
Definition: SDL_blit.h:60
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
Uint8 * src
Definition: SDL_blit.h:57
GLenum src

§ Blit4to4MaskAlpha()

static void Blit4to4MaskAlpha ( SDL_BlitInfo info)
static

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

2070 {
2071  int width = info->dst_w;
2072  int height = info->dst_h;
2073  Uint32 *src = (Uint32 *) info->src;
2074  int srcskip = info->src_skip;
2075  Uint32 *dst = (Uint32 *) info->dst;
2076  int dstskip = info->dst_skip;
2077  SDL_PixelFormat *srcfmt = info->src_fmt;
2078  SDL_PixelFormat *dstfmt = info->dst_fmt;
2079 
2080  if (dstfmt->Amask) {
2081  /* RGB->RGBA, SET_ALPHA */
2082  Uint32 mask = (info->a >> dstfmt->Aloss) << dstfmt->Ashift;
2083 
2084  while (height--) {
2085  /* *INDENT-OFF* */
2086  DUFFS_LOOP(
2087  {
2088  *dst = *src | mask;
2089  ++dst;
2090  ++src;
2091  },
2092  width);
2093  /* *INDENT-ON* */
2094  src = (Uint32 *) ((Uint8 *) src + srcskip);
2095  dst = (Uint32 *) ((Uint8 *) dst + dstskip);
2096  }
2097  } else {
2098  /* RGBA->RGB, NO_ALPHA */
2099  Uint32 mask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
2100 
2101  while (height--) {
2102  /* *INDENT-OFF* */
2103  DUFFS_LOOP(
2104  {
2105  *dst = *src & mask;
2106  ++dst;
2107  ++src;
2108  },
2109  width);
2110  /* *INDENT-ON* */
2111  src = (Uint32 *) ((Uint8 *) src + srcskip);
2112  dst = (Uint32 *) ((Uint8 *) dst + dstskip);
2113  }
2114  }
2115 }
GLenum GLenum dst
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
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
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
Uint8 * src
Definition: SDL_blit.h:57
GLenum GLint GLuint mask
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
GLenum src
Uint8 a
Definition: SDL_blit.h:70

§ Blit_RGB101010_index8()

static void Blit_RGB101010_index8 ( SDL_BlitInfo info)
static

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

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

§ Blit_RGB565_32()

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

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

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

§ Blit_RGB565_ABGR8888()

static void Blit_RGB565_ABGR8888 ( SDL_BlitInfo info)
static

Definition at line 1692 of file SDL_blit_N.c.

References Blit_RGB565_32().

1693 {
1695 }
static void Blit_RGB565_32(SDL_BlitInfo *info, const Uint32 *map)
Definition: SDL_blit_N.c:1358
static const Uint32 RGB565_ABGR8888_LUT[512]
Definition: SDL_blit_N.c:1560

§ Blit_RGB565_ARGB8888()

static void Blit_RGB565_ARGB8888 ( SDL_BlitInfo info)
static

Definition at line 1554 of file SDL_blit_N.c.

References Blit_RGB565_32().

1555 {
1557 }
static void Blit_RGB565_32(SDL_BlitInfo *info, const Uint32 *map)
Definition: SDL_blit_N.c:1358
static const Uint32 RGB565_ARGB8888_LUT[512]
Definition: SDL_blit_N.c:1422

§ Blit_RGB565_BGRA8888()

static void Blit_RGB565_BGRA8888 ( SDL_BlitInfo info)
static

Definition at line 1968 of file SDL_blit_N.c.

References Blit_RGB565_32().

1969 {
1971 }
static void Blit_RGB565_32(SDL_BlitInfo *info, const Uint32 *map)
Definition: SDL_blit_N.c:1358
static const Uint32 RGB565_BGRA8888_LUT[512]
Definition: SDL_blit_N.c:1836

§ Blit_RGB565_RGBA8888()

static void Blit_RGB565_RGBA8888 ( SDL_BlitInfo info)
static

Definition at line 1830 of file SDL_blit_N.c.

References Blit_RGB565_32().

1831 {
1833 }
static void Blit_RGB565_32(SDL_BlitInfo *info, const Uint32 *map)
Definition: SDL_blit_N.c:1358
static const Uint32 RGB565_RGBA8888_LUT[512]
Definition: SDL_blit_N.c:1698

§ Blit_RGB888_index8()

static void Blit_RGB888_index8 ( SDL_BlitInfo info)
static

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

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

§ Blit_RGB888_RGB555()

static void Blit_RGB888_RGB555 ( SDL_BlitInfo info)
static

Definition at line 1121 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, RGB888_RGB555_TWO, SDL_BlitInfo::src, and SDL_BlitInfo::src_skip.

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

§ Blit_RGB888_RGB565()

static void Blit_RGB888_RGB565 ( SDL_BlitInfo info)
static

Definition at line 1245 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, RGB888_RGB565_TWO, SDL_BlitInfo::src, and SDL_BlitInfo::src_skip.

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

§ BlitNto1()

static void BlitNto1 ( SDL_BlitInfo info)
static

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

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

§ BlitNto1Key()

static void BlitNto1Key ( SDL_BlitInfo info)
static

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

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

§ BlitNto2101010()

static void BlitNto2101010 ( SDL_BlitInfo info)
static

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

2428 {
2429  int width = info->dst_w;
2430  int height = info->dst_h;
2431  Uint8 *src = info->src;
2432  int srcskip = info->src_skip;
2433  Uint8 *dst = info->dst;
2434  int dstskip = info->dst_skip;
2435  SDL_PixelFormat *srcfmt = info->src_fmt;
2436  int srcbpp = srcfmt->BytesPerPixel;
2437  Uint32 Pixel;
2438  unsigned sR, sG, sB, sA;
2439 
2440  while (height--) {
2441  /* *INDENT-OFF* */
2442  DUFFS_LOOP(
2443  {
2444  DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
2445  ARGB2101010_FROM_RGBA(Pixel, sR, sG, sB, sA);
2446  *(Uint32 *)dst = Pixel;
2447  dst += 4;
2448  src += srcbpp;
2449  },
2450  width);
2451  /* *INDENT-ON* */
2452  src += srcskip;
2453  dst += dstskip;
2454  }
2455 }
GLenum GLenum dst
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
int src_skip
Definition: SDL_blit.h:60
Uint8 BytesPerPixel
Definition: SDL_pixels.h:318
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
Uint8 * dst
Definition: SDL_blit.h:61
#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a)
Definition: SDL_blit.h:352
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
Uint8 * src
Definition: SDL_blit.h:57
#define ARGB2101010_FROM_RGBA(Pixel, r, g, b, a)
Definition: SDL_blit.h:252
GLenum src

§ BlitNtoN()

static void BlitNtoN ( SDL_BlitInfo info)
static

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

2146 {
2147  int width = info->dst_w;
2148  int height = info->dst_h;
2149  Uint8 *src = info->src;
2150  int srcskip = info->src_skip;
2151  Uint8 *dst = info->dst;
2152  int dstskip = info->dst_skip;
2153  SDL_PixelFormat *srcfmt = info->src_fmt;
2154  int srcbpp = srcfmt->BytesPerPixel;
2155  SDL_PixelFormat *dstfmt = info->dst_fmt;
2156  int dstbpp = dstfmt->BytesPerPixel;
2157  unsigned alpha = dstfmt->Amask ? info->a : 0;
2158 
2159  while (height--) {
2160  /* *INDENT-OFF* */
2161  DUFFS_LOOP(
2162  {
2163  Uint32 Pixel;
2164  unsigned sR;
2165  unsigned sG;
2166  unsigned sB;
2167  DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
2168  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, alpha);
2169  dst += dstbpp;
2170  src += srcbpp;
2171  },
2172  width);
2173  /* *INDENT-ON* */
2174  src += srcskip;
2175  dst += dstskip;
2176  }
2177 }
GLenum GLenum dst
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
int src_skip
Definition: SDL_blit.h:60
Uint8 BytesPerPixel
Definition: SDL_pixels.h:318
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:401
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
GLfloat GLfloat GLfloat alpha
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
Uint8 * src
Definition: SDL_blit.h:57
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b)
Definition: SDL_blit.h:176
GLenum src
Uint8 a
Definition: SDL_blit.h:70

§ BlitNtoNCopyAlpha()

static void BlitNtoNCopyAlpha ( SDL_BlitInfo info)
static

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

2181 {
2182  int width = info->dst_w;
2183  int height = info->dst_h;
2184  Uint8 *src = info->src;
2185  int srcskip = info->src_skip;
2186  Uint8 *dst = info->dst;
2187  int dstskip = info->dst_skip;
2188  SDL_PixelFormat *srcfmt = info->src_fmt;
2189  int srcbpp = srcfmt->BytesPerPixel;
2190  SDL_PixelFormat *dstfmt = info->dst_fmt;
2191  int dstbpp = dstfmt->BytesPerPixel;
2192  int c;
2193 
2194  while (height--) {
2195  for (c = width; c; --c) {
2196  Uint32 Pixel;
2197  unsigned sR, sG, sB, sA;
2198  DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
2199  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA);
2200  dst += dstbpp;
2201  src += srcbpp;
2202  }
2203  src += srcskip;
2204  dst += dstskip;
2205  }
2206 }
GLenum GLenum dst
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
int src_skip
Definition: SDL_blit.h:60
Uint8 BytesPerPixel
Definition: SDL_pixels.h:318
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:401
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
Uint8 * dst
Definition: SDL_blit.h:61
#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a)
Definition: SDL_blit.h:352
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
const GLubyte * c
Uint8 * src
Definition: SDL_blit.h:57
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
GLenum src

§ BlitNtoNKey()

static void BlitNtoNKey ( SDL_BlitInfo info)
static

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

2310 {
2311  int width = info->dst_w;
2312  int height = info->dst_h;
2313  Uint8 *src = info->src;
2314  int srcskip = info->src_skip;
2315  Uint8 *dst = info->dst;
2316  int dstskip = info->dst_skip;
2317  Uint32 ckey = info->colorkey;
2318  SDL_PixelFormat *srcfmt = info->src_fmt;
2319  SDL_PixelFormat *dstfmt = info->dst_fmt;
2320  int srcbpp = srcfmt->BytesPerPixel;
2321  int dstbpp = dstfmt->BytesPerPixel;
2322  unsigned alpha = dstfmt->Amask ? info->a : 0;
2323  Uint32 rgbmask = ~srcfmt->Amask;
2324 
2325  /* Set up some basic variables */
2326  ckey &= rgbmask;
2327 
2328  while (height--) {
2329  /* *INDENT-OFF* */
2330  DUFFS_LOOP(
2331  {
2332  Uint32 Pixel;
2333  unsigned sR;
2334  unsigned sG;
2335  unsigned sB;
2336  RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel);
2337  if ( (Pixel & rgbmask) != ckey ) {
2338  RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB);
2339  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, alpha);
2340  }
2341  dst += dstbpp;
2342  src += srcbpp;
2343  },
2344  width);
2345  /* *INDENT-ON* */
2346  src += srcskip;
2347  dst += dstskip;
2348  }
2349 }
GLenum GLenum dst
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
int src_skip
Definition: SDL_blit.h:60
#define RETRIEVE_RGB_PIXEL(buf, bpp, Pixel)
Definition: SDL_blit.h:145
Uint8 BytesPerPixel
Definition: SDL_pixels.h:318
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:401
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
GLfloat GLfloat GLfloat alpha
Uint32 colorkey
Definition: SDL_blit.h:69
Uint8 * dst
Definition: SDL_blit.h:61
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
#define RGB_FROM_PIXEL(Pixel, fmt, r, g, b)
Definition: SDL_blit.h:121
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
Uint8 * src
Definition: SDL_blit.h:57
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
GLenum src
Uint8 a
Definition: SDL_blit.h:70

§ BlitNtoNKeyCopyAlpha()

static void BlitNtoNKeyCopyAlpha ( SDL_BlitInfo info)
static

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

2353 {
2354  int width = info->dst_w;
2355  int height = info->dst_h;
2356  Uint8 *src = info->src;
2357  int srcskip = info->src_skip;
2358  Uint8 *dst = info->dst;
2359  int dstskip = info->dst_skip;
2360  Uint32 ckey = info->colorkey;
2361  SDL_PixelFormat *srcfmt = info->src_fmt;
2362  SDL_PixelFormat *dstfmt = info->dst_fmt;
2363  Uint32 rgbmask = ~srcfmt->Amask;
2364 
2365  Uint8 srcbpp;
2366  Uint8 dstbpp;
2367  Uint32 Pixel;
2368  unsigned sR, sG, sB, sA;
2369 
2370  /* Set up some basic variables */
2371  srcbpp = srcfmt->BytesPerPixel;
2372  dstbpp = dstfmt->BytesPerPixel;
2373  ckey &= rgbmask;
2374 
2375  while (height--) {
2376  /* *INDENT-OFF* */
2377  DUFFS_LOOP(
2378  {
2379  DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
2380  if ( (Pixel & rgbmask) != ckey ) {
2381  ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA);
2382  }
2383  dst += dstbpp;
2384  src += srcbpp;
2385  },
2386  width);
2387  /* *INDENT-ON* */
2388  src += srcskip;
2389  dst += dstskip;
2390  }
2391 }
GLenum GLenum dst
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
int src_skip
Definition: SDL_blit.h:60
Uint8 BytesPerPixel
Definition: SDL_pixels.h:318
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:401
int dst_skip
Definition: SDL_blit.h:64
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
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:352
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
Uint8 * src
Definition: SDL_blit.h:57
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
GLenum src

§ SDL_CalculateBlitN()

SDL_BlitFunc SDL_CalculateBlitN ( SDL_Surface surface)

Definition at line 2527 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, blit_table::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, blit_table::NO_ALPHA, NULL, SDL_PixelFormat::Rmask, SDL_COPY_COLORKEY, SDL_COPY_RLE_MASK, SDL_HasAltiVec, SDL_PIXELFORMAT_ARGB2101010, blit_table::SET_ALPHA, blit_table::srcB, blit_table::srcG, and blit_table::srcR.

Referenced by SDL_CalculateBlit().

2528 {
2529  SDL_PixelFormat *srcfmt;
2530  SDL_PixelFormat *dstfmt;
2531  const struct blit_table *table;
2532  int which;
2533  SDL_BlitFunc blitfun;
2534 
2535  /* Set up data for choosing the blit */
2536  srcfmt = surface->format;
2537  dstfmt = surface->map->dst->format;
2538 
2539  /* We don't support destinations less than 8-bits */
2540  if (dstfmt->BitsPerPixel < 8) {
2541  return (NULL);
2542  }
2543 
2544  switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
2545  case 0:
2546  blitfun = NULL;
2547  if (dstfmt->BitsPerPixel == 8) {
2548  if ((srcfmt->BytesPerPixel == 4) &&
2549  (srcfmt->Rmask == 0x00FF0000) &&
2550  (srcfmt->Gmask == 0x0000FF00) &&
2551  (srcfmt->Bmask == 0x000000FF)) {
2552  blitfun = Blit_RGB888_index8;
2553  } else if ((srcfmt->BytesPerPixel == 4) &&
2554  (srcfmt->Rmask == 0x3FF00000) &&
2555  (srcfmt->Gmask == 0x000FFC00) &&
2556  (srcfmt->Bmask == 0x000003FF)) {
2557  blitfun = Blit_RGB101010_index8;
2558  } else {
2559  blitfun = BlitNto1;
2560  }
2561  } else {
2562  /* Now the meat, choose the blitter we want */
2563  int a_need = NO_ALPHA;
2564  if (dstfmt->Amask)
2565  a_need = srcfmt->Amask ? COPY_ALPHA : SET_ALPHA;
2566  table = normal_blit[srcfmt->BytesPerPixel - 1];
2567  for (which = 0; table[which].dstbpp; ++which) {
2568  if (MASKOK(srcfmt->Rmask, table[which].srcR) &&
2569  MASKOK(srcfmt->Gmask, table[which].srcG) &&
2570  MASKOK(srcfmt->Bmask, table[which].srcB) &&
2571  MASKOK(dstfmt->Rmask, table[which].dstR) &&
2572  MASKOK(dstfmt->Gmask, table[which].dstG) &&
2573  MASKOK(dstfmt->Bmask, table[which].dstB) &&
2574  dstfmt->BytesPerPixel == table[which].dstbpp &&
2575  (a_need & table[which].alpha) == a_need &&
2576  ((table[which].blit_features & GetBlitFeatures()) ==
2577  table[which].blit_features))
2578  break;
2579  }
2580  blitfun = table[which].blitfunc;
2581 
2582  if (blitfun == BlitNtoN) { /* default C fallback catch-all. Slow! */
2583  if (srcfmt->format == SDL_PIXELFORMAT_ARGB2101010) {
2584  blitfun = Blit2101010toN;
2585  } else if (dstfmt->format == SDL_PIXELFORMAT_ARGB2101010) {
2586  blitfun = BlitNto2101010;
2587  } else if (srcfmt->BytesPerPixel == 4 &&
2588  dstfmt->BytesPerPixel == 4 &&
2589  srcfmt->Rmask == dstfmt->Rmask &&
2590  srcfmt->Gmask == dstfmt->Gmask &&
2591  srcfmt->Bmask == dstfmt->Bmask) {
2592  if (a_need == COPY_ALPHA) {
2593  if (srcfmt->Amask == dstfmt->Amask) {
2594  /* Fastpath C fallback: 32bit RGBA<->RGBA blit with matching RGBA */
2595  blitfun = Blit4to4CopyAlpha;
2596  } else {
2597  blitfun = BlitNtoNCopyAlpha;
2598  }
2599  } else {
2600  /* Fastpath C fallback: 32bit RGB<->RGBA blit with matching RGB */
2601  blitfun = Blit4to4MaskAlpha;
2602  }
2603  } else if (a_need == COPY_ALPHA) {
2604  blitfun = BlitNtoNCopyAlpha;
2605  }
2606  }
2607  }
2608  return (blitfun);
2609 
2610  case SDL_COPY_COLORKEY:
2611  /* colorkey blit: Here we don't have too many options, mostly
2612  because RLE is the preferred fast way to deal with this.
2613  If a particular case turns out to be useful we'll add it. */
2614 
2615  if (srcfmt->BytesPerPixel == 2 && surface->map->identity)
2616  return Blit2to2Key;
2617  else if (dstfmt->BytesPerPixel == 1)
2618  return BlitNto1Key;
2619  else {
2620 #if SDL_ALTIVEC_BLITTERS
2621  if ((srcfmt->BytesPerPixel == 4) && (dstfmt->BytesPerPixel == 4)
2622  && SDL_HasAltiVec()) {
2623  return Blit32to32KeyAltivec;
2624  } else
2625 #endif
2626  if (srcfmt->Amask && dstfmt->Amask) {
2627  return BlitNtoNKeyCopyAlpha;
2628  } else {
2629  return BlitNtoNKey;
2630  }
2631  }
2632  }
2633 
2634  return NULL;
2635 }
SDL_BlitFunc blitfunc
Definition: SDL_blit_N.c:2464
#define SDL_HasAltiVec
Uint32 srcG
Definition: SDL_blit_N.c:2460
Uint32 srcB
Definition: SDL_blit_N.c:2460
#define MASKOK(x, y)
Definition: SDL_blit_N.c:2524
GLenum GLsizei GLenum GLenum const void * table
#define SDL_COPY_COLORKEY
Definition: SDL_blit.h:39
Uint32 blit_features
Definition: SDL_blit_N.c:2463
Uint32 dstB
Definition: SDL_blit_N.c:2462
Uint32 dstR
Definition: SDL_blit_N.c:2462
Uint8 BytesPerPixel
Definition: SDL_pixels.h:318
static void BlitNto2101010(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2427
#define SDL_COPY_RLE_MASK
Definition: SDL_blit.h:44
Uint32 srcR
Definition: SDL_blit_N.c:2460
static void BlitNtoNCopyAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2180
struct SDL_BlitMap * map
Definition: SDL_surface.h:88
Uint32 dstG
Definition: SDL_blit_N.c:2462
static void Blit2to2Key(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2275
Uint8 BitsPerPixel
Definition: SDL_pixels.h:317
static void Blit4to4MaskAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2069
static void BlitNto1Key(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2209
static void Blit_RGB888_index8(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:893
SDL_Surface * dst
Definition: SDL_blit.h:87
#define NULL
Definition: begin_code.h:143
SDL_PixelFormat * format
Definition: SDL_surface.h:72
static const struct blit_table *const normal_blit[]
Definition: SDL_blit_N.c:2519
static void BlitNtoNKey(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2309
static void Blit2101010toN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2395
static void BlitNtoNKeyCopyAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2352
#define GetBlitFeatures()
Definition: SDL_blit_N.c:874
void(* SDL_BlitFunc)(SDL_BlitInfo *info)
Definition: SDL_blit.h:73
static void Blit_RGB101010_index8(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1003
static void Blit4to4CopyAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2119
static void BlitNtoN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2145
enum blit_table::@27 alpha
int identity
Definition: SDL_blit.h:88
SDL_BlitInfo info
Definition: SDL_blit.h:91
static void BlitNto1(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1974

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:2473
static const struct blit_table normal_blit_3[]
Definition: SDL_blit_N.c:2494
static const struct blit_table normal_blit_1[]
Definition: SDL_blit_N.c:2468
static const struct blit_table normal_blit_4[]
Definition: SDL_blit_N.c:2499

Definition at line 2519 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:2145

Definition at line 2468 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}
}
static void Blit_RGB565_ARGB8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1554
static void Blit_RGB565_RGBA8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1830
static void Blit_RGB565_BGRA8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1968
static void BlitNtoN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2145
static void Blit_RGB565_ABGR8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1692

Definition at line 2473 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:2145

Definition at line 2494 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}
}
static void BlitNtoN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2145
static void Blit_RGB888_RGB555(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1121
static void Blit_RGB888_RGB565(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1245

Definition at line 2499 of file SDL_blit_N.c.

§ RGB565_ABGR8888_LUT

const Uint32 RGB565_ABGR8888_LUT[512]
static

Definition at line 1560 of file SDL_blit_N.c.

§ RGB565_ARGB8888_LUT

const Uint32 RGB565_ARGB8888_LUT[512]
static

Definition at line 1422 of file SDL_blit_N.c.

§ RGB565_BGRA8888_LUT

const Uint32 RGB565_BGRA8888_LUT[512]
static

Definition at line 1836 of file SDL_blit_N.c.

§ RGB565_RGBA8888_LUT

const Uint32 RGB565_RGBA8888_LUT[512]
static

Definition at line 1698 of file SDL_blit_N.c.