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

Go to the source code of this file.

## Data Structures

struct | blit_table

## Macros

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

## Functions

static void | Blit_RGB888_index8 (SDL_BlitInfo *info)
static void | Blit_RGB101010_index8 (SDL_BlitInfo *info)
static void | Blit_RGB888_RGB555 (SDL_BlitInfo *info)
static void | Blit_RGB888_RGB565 (SDL_BlitInfo *info)
static void | Blit_RGB565_32 (SDL_BlitInfo *info, const Uint32 *map)
static void | Blit_RGB565_ARGB8888 (SDL_BlitInfo *info)
static void | Blit_RGB565_ABGR8888 (SDL_BlitInfo *info)
static void | Blit_RGB565_RGBA8888 (SDL_BlitInfo *info)
static void | Blit_RGB565_BGRA8888 (SDL_BlitInfo *info)
static void | BlitNto1 (SDL_BlitInfo *info)
static void | Blit4to4MaskAlpha (SDL_BlitInfo *info)
static void | Blit4to4CopyAlpha (SDL_BlitInfo *info)
static void | BlitNtoN (SDL_BlitInfo *info)
static void | BlitNtoNCopyAlpha (SDL_BlitInfo *info)
static void | BlitNto1Key (SDL_BlitInfo *info)
static void | Blit2to2Key (SDL_BlitInfo *info)
static void | BlitNtoNKey (SDL_BlitInfo *info)
static void | BlitNtoNKeyCopyAlpha (SDL_BlitInfo *info)
static void | Blit2101010toN (SDL_BlitInfo *info)
static void | BlitNto2101010 (SDL_BlitInfo *info)
SDL_BlitFunc | SDL_CalculateBlitN (SDL_Surface *surface)

## Variables

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

## Macro Definition Documentation

## COPY_ALPHA

#define COPY_ALPHA 4

Definition at line 2468 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

## GetBlitFeatures

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

Definition at line 878 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

## HI

#define HI 1

Definition at line 883 of file SDL_blit_N.c.

Referenced by Blit1to2().

## LO

#define LO 0

Definition at line 884 of file SDL_blit_N.c.

Referenced by Blit1to2().

## MASKOK

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

Definition at line 2534 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

## NO_ALPHA

#define NO_ALPHA 1

Definition at line 2466 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

## RGB101010_RGB332

#define RGB101010_RGB332 | ( |  | dst,
|  |  | src
| ) |  |

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

Definition at line 1001 of file SDL_blit_N.c.

Referenced by Blit_RGB101010_index8().

## RGB565_32

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

Definition at line 1364 of file SDL_blit_N.c.

Referenced by Blit_RGB565_32().

## RGB888_RGB332

#define RGB888_RGB332 | ( |  | dst,
|  |  | src
| ) |  |

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

Definition at line 891 of file SDL_blit_N.c.

Referenced by Blit_RGB888_index8().

## RGB888_RGB555

#define RGB888_RGB555 | ( |  | dst,
|  |  | src
| ) |  |

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

Definition at line 1111 of file SDL_blit_N.c.

Referenced by Blit_RGB888_RGB555().

## RGB888_RGB565

#define RGB888_RGB565 | ( |  | dst,
|  |  | src
| ) |  |

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

Definition at line 1237 of file SDL_blit_N.c.

Referenced by Blit_RGB888_RGB565().

## SET_ALPHA

#define SET_ALPHA 2

Definition at line 2467 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

## Function Documentation

## Blit2101010toN()

static void Blit2101010toN | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 2403 of file SDL_blit_N.c.

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

Referenced by SDL_CalculateBlitN().

{
int width = info->dst_w;
int height = info->dst_h;
Uint8 *src = info->src;
int srcskip = info->src_skip;
Uint8 *dst = info->dst;
int dstskip = info->dst_skip;
SDL_PixelFormat *dstfmt = info->dst_fmt;
int dstbpp = dstfmt->BytesPerPixel;
Uint32 Pixel;
unsigned sR, sG, sB, sA;
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP(
{
Pixel = *(Uint32 *)src;
RGBA_FROM_ARGB2101010(Pixel, sR, sG, sB, sA);
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA);
dst += dstbpp;
src += 4;
},
width);
/* *INDENT-ON* */
src += srcskip;
dst += dstskip;
}
}
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
ASSEMBLE_RGBA
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:402
RGBA_FROM_ARGB2101010
#define RGBA_FROM_ARGB2101010(Pixel, r, g, b, a)
Definition: SDL_blit.h:346
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
blit_table::dstbpp
int dstbpp
Definition: SDL_blit_N.c:2472
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
SDL_BlitInfo::dst_fmt
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_PixelFormat
Definition: SDL_pixels.h:315
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62

## Blit2to2Key()

static void Blit2to2Key | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 2283 of file SDL_blit_N.c.

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

Referenced by SDL_CalculateBlitN().

{
int width = info->dst_w;
int height = info->dst_h;
Uint16 *srcp = (Uint16 *) info->src;
int srcskip = info->src_skip;
Uint16 *dstp = (Uint16 *) info->dst;
int dstskip = info->dst_skip;
Uint32 ckey = info->colorkey;
Uint32 rgbmask = ~info->src_fmt->Amask;
/* Set up some basic variables */
srcskip /= 2;
dstskip /= 2;
ckey &= rgbmask;
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP(
{
if ( (*srcp & rgbmask) != ckey ) {
*dstp = *srcp;
}
dstp++;
srcp++;
},
width);
/* *INDENT-ON* */
srcp += srcskip;
dstp += dstskip;
}
}
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
SDL_BlitInfo::src_fmt
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_BlitInfo::colorkey
Uint32 colorkey
Definition: SDL_blit.h:69
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:169
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:325
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62

## Blit4to4CopyAlpha()

static void Blit4to4CopyAlpha | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 2127 of file SDL_blit_N.c.

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

Referenced by SDL_CalculateBlitN().

{
int width = info->dst_w;
int height = info->dst_h;
Uint32 *src = (Uint32 *) info->src;
int srcskip = info->src_skip;
Uint32 *dst = (Uint32 *) info->dst;
int dstskip = info->dst_skip;
/* RGBA->RGBA, COPY_ALPHA */
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP(
{
*dst = *src;
++dst;
++src;
},
width);
/* *INDENT-ON* */
src = (Uint32 *) ((Uint8 *) src + srcskip);
dst = (Uint32 *) ((Uint8 *) dst + dstskip);
}
}
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62

## Blit4to4MaskAlpha()

static void Blit4to4MaskAlpha | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 2077 of file SDL_blit_N.c.

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

Referenced by SDL_CalculateBlitN().

{
int width = info->dst_w;
int height = info->dst_h;
Uint32 *src = (Uint32 *) info->src;
int srcskip = info->src_skip;
Uint32 *dst = (Uint32 *) info->dst;
int dstskip = info->dst_skip;
SDL_PixelFormat *srcfmt = info->src_fmt;
SDL_PixelFormat *dstfmt = info->dst_fmt;
if (dstfmt->Amask) {
/* RGB->RGBA, SET_ALPHA */
Uint32 mask = (info->a >> dstfmt->Aloss) << dstfmt->Ashift;
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP(
{
*dst = *src | mask;
++dst;
++src;
},
width);
/* *INDENT-ON* */
src = (Uint32 *) ((Uint8 *) src + srcskip);
dst = (Uint32 *) ((Uint8 *) dst + dstskip);
}
} else {
/* RGBA->RGB, NO_ALPHA */
Uint32 mask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP(
{
*dst = *src & mask;
++dst;
++src;
},
width);
/* *INDENT-ON* */
src = (Uint32 *) ((Uint8 *) src + srcskip);
dst = (Uint32 *) ((Uint8 *) dst + dstskip);
}
}
}
SDL_PixelFormat::Aloss
Uint8 Aloss
Definition: SDL_pixels.h:329
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_PixelFormat::Gmask
Uint32 Gmask
Definition: SDL_pixels.h:323
SDL_BlitInfo::src_fmt
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
SDL_PixelFormat::Bmask
Uint32 Bmask
Definition: SDL_pixels.h:324
SDL_PixelFormat::Ashift
Uint8 Ashift
Definition: SDL_pixels.h:333
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
mask
GLenum GLint GLuint mask
Definition: SDL_opengl_glext.h:657
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
SDL_BlitInfo::dst_fmt
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
SDL_PixelFormat::Rmask
Uint32 Rmask
Definition: SDL_pixels.h:322
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_PixelFormat
Definition: SDL_pixels.h:315
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:325
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
SDL_BlitInfo::a
Uint8 a
Definition: SDL_blit.h:70

## Blit_RGB101010_index8()

static void Blit_RGB101010_index8 | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 1007 of file SDL_blit_N.c.

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

Referenced by SDL_CalculateBlitN().

{
#ifndef USE_DUFFS_LOOP
int c;
#endif
int width, height;
Uint32 *src;
const Uint8 *map;
Uint8 *dst;
int srcskip, dstskip;
/* Set up some basic variables */
width = info->dst_w;
height = info->dst_h;
src = (Uint32 *) info->src;
srcskip = info->src_skip / 4;
dst = info->dst;
dstskip = info->dst_skip;
map = info->table;
if (map == NULL) {
while (height--) {
#ifdef USE_DUFFS_LOOP
/* *INDENT-OFF* */
DUFFS_LOOP(
RGB101010_RGB332(*dst++, *src);
, width);
/* *INDENT-ON* */
#else
for (c = width / 4; c; --c) {
/* Pack RGB into 8bit pixel */
++src;
RGB101010_RGB332(*dst++, *src);
++src;
RGB101010_RGB332(*dst++, *src);
++src;
RGB101010_RGB332(*dst++, *src);
++src;
}
switch (width & 3) {
case 3:
RGB101010_RGB332(*dst++, *src);
++src;
case 2:
RGB101010_RGB332(*dst++, *src);
++src;
case 1:
RGB101010_RGB332(*dst++, *src);
++src;
}
#endif /* USE_DUFFS_LOOP */
src += srcskip;
dst += dstskip;
}
} else {
int Pixel;
while (height--) {
#ifdef USE_DUFFS_LOOP
/* *INDENT-OFF* */
DUFFS_LOOP(
RGB101010_RGB332(Pixel, *src);
*dst++ = map[Pixel];
++src;
, width);
/* *INDENT-ON* */
#else
for (c = width / 4; c; --c) {
/* Pack RGB into 8bit pixel */
RGB101010_RGB332(Pixel, *src);
*dst++ = map[Pixel];
++src;
RGB101010_RGB332(Pixel, *src);
*dst++ = map[Pixel];
++src;
RGB101010_RGB332(Pixel, *src);
*dst++ = map[Pixel];
++src;
RGB101010_RGB332(Pixel, *src);
*dst++ = map[Pixel];
++src;
}
switch (width & 3) {
case 3:
RGB101010_RGB332(Pixel, *src);
*dst++ = map[Pixel];
++src;
case 2:
RGB101010_RGB332(Pixel, *src);
*dst++ = map[Pixel];
++src;
case 1:
RGB101010_RGB332(Pixel, *src);
*dst++ = map[Pixel];
++src;
}
#endif /* USE_DUFFS_LOOP */
src += srcskip;
dst += dstskip;
}
}
}
SDL_BlitInfo::table
Uint8 * table
Definition: SDL_blit.h:67
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
RGB101010_RGB332
#define RGB101010_RGB332(dst, src)
Definition: SDL_blit_N.c:1001
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
NULL
#define NULL
Definition: begin_code.h:164
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
map
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint GLint GLint j2 GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLfloat *params GLenum GLint GLenum GLenum GLvoid *pixels GLenum GLint GLenum GLint *params GLenum GLenum GLint *params GLenum GLsizei const GLvoid *pointer GLenum GLenum const GLint *params GLenum GLfloat GLfloat GLint GLint const GLfloat *points GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat *points GLint GLfloat GLfloat GLint GLfloat GLfloat v2 GLenum GLenum const GLint *params GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum map
Definition: SDL_glfuncs.h:290

## Blit_RGB565_32()

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

static

Definition at line 1366 of file SDL_blit_N.c.

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

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

{
#ifndef USE_DUFFS_LOOP
int c;
#endif
int width, height;
Uint8 *src;
Uint32 *dst;
int srcskip, dstskip;
/* Set up some basic variables */
width = info->dst_w;
height = info->dst_h;
src = (Uint8 *) info->src;
srcskip = info->src_skip;
dst = (Uint32 *) info->dst;
dstskip = info->dst_skip / 4;
#ifdef USE_DUFFS_LOOP
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP(
{
*dst++ = RGB565_32(dst, src, map);
src += 2;
},
width);
/* *INDENT-ON* */
src += srcskip;
dst += dstskip;
}
#else
while (height--) {
/* Copy in 4 pixel chunks */
for (c = width / 4; c; --c) {
*dst++ = RGB565_32(dst, src, map);
src += 2;
*dst++ = RGB565_32(dst, src, map);
src += 2;
*dst++ = RGB565_32(dst, src, map);
src += 2;
*dst++ = RGB565_32(dst, src, map);
src += 2;
}
/* Get any leftovers */
switch (width & 3) {
case 3:
*dst++ = RGB565_32(dst, src, map);
src += 2;
case 2:
*dst++ = RGB565_32(dst, src, map);
src += 2;
case 1:
*dst++ = RGB565_32(dst, src, map);
src += 2;
break;
}
src += srcskip;
dst += dstskip;
}
#endif /* USE_DUFFS_LOOP */
}
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
RGB565_32
#define RGB565_32(dst, src, map)
Definition: SDL_blit_N.c:1364
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
map
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint GLint GLint j2 GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLfloat *params GLenum GLint GLenum GLenum GLvoid *pixels GLenum GLint GLenum GLint *params GLenum GLenum GLint *params GLenum GLsizei const GLvoid *pointer GLenum GLenum const GLint *params GLenum GLfloat GLfloat GLint GLint const GLfloat *points GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat *points GLint GLfloat GLfloat GLint GLfloat GLfloat v2 GLenum GLenum const GLint *params GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum map
Definition: SDL_glfuncs.h:290

## Blit_RGB565_ABGR8888()

static void Blit_RGB565_ABGR8888 | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 1700 of file SDL_blit_N.c.

References Blit_RGB565_32().

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

## Blit_RGB565_ARGB8888()

static void Blit_RGB565_ARGB8888 | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 1562 of file SDL_blit_N.c.

References Blit_RGB565_32().

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

## Blit_RGB565_BGRA8888()

static void Blit_RGB565_BGRA8888 | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 1976 of file SDL_blit_N.c.

References Blit_RGB565_32().

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

## Blit_RGB565_RGBA8888()

static void Blit_RGB565_RGBA8888 | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 1838 of file SDL_blit_N.c.

References Blit_RGB565_32().

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

## Blit_RGB888_index8()

static void Blit_RGB888_index8 | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 897 of file SDL_blit_N.c.

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

Referenced by SDL_CalculateBlitN().

{
#ifndef USE_DUFFS_LOOP
int c;
#endif
int width, height;
Uint32 *src;
const Uint8 *map;
Uint8 *dst;
int srcskip, dstskip;
/* Set up some basic variables */
width = info->dst_w;
height = info->dst_h;
src = (Uint32 *) info->src;
srcskip = info->src_skip / 4;
dst = info->dst;
dstskip = info->dst_skip;
map = info->table;
if (map == NULL) {
while (height--) {
#ifdef USE_DUFFS_LOOP
/* *INDENT-OFF* */
DUFFS_LOOP(
RGB888_RGB332(*dst++, *src);
, width);
/* *INDENT-ON* */
#else
for (c = width / 4; c; --c) {
/* Pack RGB into 8bit pixel */
++src;
RGB888_RGB332(*dst++, *src);
++src;
RGB888_RGB332(*dst++, *src);
++src;
RGB888_RGB332(*dst++, *src);
++src;
}
switch (width & 3) {
case 3:
RGB888_RGB332(*dst++, *src);
++src;
case 2:
RGB888_RGB332(*dst++, *src);
++src;
case 1:
RGB888_RGB332(*dst++, *src);
++src;
}
#endif /* USE_DUFFS_LOOP */
src += srcskip;
dst += dstskip;
}
} else {
int Pixel;
while (height--) {
#ifdef USE_DUFFS_LOOP
/* *INDENT-OFF* */
DUFFS_LOOP(
RGB888_RGB332(Pixel, *src);
*dst++ = map[Pixel];
++src;
, width);
/* *INDENT-ON* */
#else
for (c = width / 4; c; --c) {
/* Pack RGB into 8bit pixel */
RGB888_RGB332(Pixel, *src);
*dst++ = map[Pixel];
++src;
RGB888_RGB332(Pixel, *src);
*dst++ = map[Pixel];
++src;
RGB888_RGB332(Pixel, *src);
*dst++ = map[Pixel];
++src;
RGB888_RGB332(Pixel, *src);
*dst++ = map[Pixel];
++src;
}
switch (width & 3) {
case 3:
RGB888_RGB332(Pixel, *src);
*dst++ = map[Pixel];
++src;
case 2:
RGB888_RGB332(Pixel, *src);
*dst++ = map[Pixel];
++src;
case 1:
RGB888_RGB332(Pixel, *src);
*dst++ = map[Pixel];
++src;
}
#endif /* USE_DUFFS_LOOP */
src += srcskip;
dst += dstskip;
}
}
}
SDL_BlitInfo::table
Uint8 * table
Definition: SDL_blit.h:67
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
RGB888_RGB332
#define RGB888_RGB332(dst, src)
Definition: SDL_blit_N.c:891
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
NULL
#define NULL
Definition: begin_code.h:164
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
map
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint GLint GLint j2 GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLfloat *params GLenum GLint GLenum GLenum GLvoid *pixels GLenum GLint GLenum GLint *params GLenum GLenum GLint *params GLenum GLsizei const GLvoid *pointer GLenum GLenum const GLint *params GLenum GLfloat GLfloat GLint GLint const GLfloat *points GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat *points GLint GLfloat GLfloat GLint GLfloat GLfloat v2 GLenum GLenum const GLint *params GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum map
Definition: SDL_glfuncs.h:290

## Blit_RGB888_RGB555()

static void Blit_RGB888_RGB555 | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 1127 of file SDL_blit_N.c.

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

{
#ifndef USE_DUFFS_LOOP
int c;
#endif
int width, height;
Uint32 *src;
Uint16 *dst;
int srcskip, dstskip;
/* Set up some basic variables */
width = info->dst_w;
height = info->dst_h;
src = (Uint32 *) info->src;
srcskip = info->src_skip / 4;
dst = (Uint16 *) info->dst;
dstskip = info->dst_skip / 2;
#ifdef USE_DUFFS_LOOP
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP(
RGB888_RGB555(dst, src);
++src;
++dst;
, width);
/* *INDENT-ON* */
src += srcskip;
dst += dstskip;
}
#else
/* Memory align at 4-byte boundary, if necessary */
if ((long) dst & 0x03) {
/* Don't do anything if width is 0 */
if (width == 0) {
return;
}
--width;
while (height--) {
/* Perform copy alignment */
RGB888_RGB555(dst, src);
++src;
++dst;
/* Copy in 4 pixel chunks */
for (c = width / 4; c; --c) {
RGB888_RGB555_TWO(dst, src);
src += 2;
dst += 2;
RGB888_RGB555_TWO(dst, src);
src += 2;
dst += 2;
}
/* Get any leftovers */
switch (width & 3) {
case 3:
RGB888_RGB555(dst, src);
++src;
++dst;
case 2:
RGB888_RGB555_TWO(dst, src);
src += 2;
dst += 2;
break;
case 1:
RGB888_RGB555(dst, src);
++src;
++dst;
break;
}
src += srcskip;
dst += dstskip;
}
} else {
while (height--) {
/* Copy in 4 pixel chunks */
for (c = width / 4; c; --c) {
RGB888_RGB555_TWO(dst, src);
src += 2;
dst += 2;
RGB888_RGB555_TWO(dst, src);
src += 2;
dst += 2;
}
/* Get any leftovers */
switch (width & 3) {
case 3:
RGB888_RGB555(dst, src);
++src;
++dst;
case 2:
RGB888_RGB555_TWO(dst, src);
src += 2;
dst += 2;
break;
case 1:
RGB888_RGB555(dst, src);
++src;
++dst;
break;
}
src += srcskip;
dst += dstskip;
}
}
#endif /* USE_DUFFS_LOOP */
}
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:169
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
RGB888_RGB555
#define RGB888_RGB555(dst, src)
Definition: SDL_blit_N.c:1111

## Blit_RGB888_RGB565()

static void Blit_RGB888_RGB565 | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 1253 of file SDL_blit_N.c.

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

{
#ifndef USE_DUFFS_LOOP
int c;
#endif
int width, height;
Uint32 *src;
Uint16 *dst;
int srcskip, dstskip;
/* Set up some basic variables */
width = info->dst_w;
height = info->dst_h;
src = (Uint32 *) info->src;
srcskip = info->src_skip / 4;
dst = (Uint16 *) info->dst;
dstskip = info->dst_skip / 2;
#ifdef USE_DUFFS_LOOP
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP(
RGB888_RGB565(dst, src);
++src;
++dst;
, width);
/* *INDENT-ON* */
src += srcskip;
dst += dstskip;
}
#else
/* Memory align at 4-byte boundary, if necessary */
if ((long) dst & 0x03) {
/* Don't do anything if width is 0 */
if (width == 0) {
return;
}
--width;
while (height--) {
/* Perform copy alignment */
RGB888_RGB565(dst, src);
++src;
++dst;
/* Copy in 4 pixel chunks */
for (c = width / 4; c; --c) {
RGB888_RGB565_TWO(dst, src);
src += 2;
dst += 2;
RGB888_RGB565_TWO(dst, src);
src += 2;
dst += 2;
}
/* Get any leftovers */
switch (width & 3) {
case 3:
RGB888_RGB565(dst, src);
++src;
++dst;
case 2:
RGB888_RGB565_TWO(dst, src);
src += 2;
dst += 2;
break;
case 1:
RGB888_RGB565(dst, src);
++src;
++dst;
break;
}
src += srcskip;
dst += dstskip;
}
} else {
while (height--) {
/* Copy in 4 pixel chunks */
for (c = width / 4; c; --c) {
RGB888_RGB565_TWO(dst, src);
src += 2;
dst += 2;
RGB888_RGB565_TWO(dst, src);
src += 2;
dst += 2;
}
/* Get any leftovers */
switch (width & 3) {
case 3:
RGB888_RGB565(dst, src);
++src;
++dst;
case 2:
RGB888_RGB565_TWO(dst, src);
src += 2;
dst += 2;
break;
case 1:
RGB888_RGB565(dst, src);
++src;
++dst;
break;
}
src += srcskip;
dst += dstskip;
}
}
#endif /* USE_DUFFS_LOOP */
}
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
RGB888_RGB565
#define RGB888_RGB565(dst, src)
Definition: SDL_blit_N.c:1237
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
Uint16
uint16_t Uint16
Definition: SDL_stdinc.h:169
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62

## BlitNto1()

static void BlitNto1 | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 1982 of file SDL_blit_N.c.

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

Referenced by SDL_CalculateBlitN().

{
#ifndef USE_DUFFS_LOOP
int c;
#endif
int width, height;
Uint8 *src;
const Uint8 *map;
Uint8 *dst;
int srcskip, dstskip;
int srcbpp;
Uint32 Pixel;
int sR, sG, sB;
SDL_PixelFormat *srcfmt;
/* Set up some basic variables */
width = info->dst_w;
height = info->dst_h;
src = info->src;
srcskip = info->src_skip;
dst = info->dst;
dstskip = info->dst_skip;
map = info->table;
srcfmt = info->src_fmt;
srcbpp = srcfmt->BytesPerPixel;
if (map == NULL) {
while (height--) {
#ifdef USE_DUFFS_LOOP
/* *INDENT-OFF* */
DUFFS_LOOP(
DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
sR, sG, sB);
if ( 1 ) {
/* Pack RGB into 8bit pixel */
*dst = ((sR>>5)<<(3+2))|
((sG>>5)<<(2)) |
((sB>>6)<<(0)) ;
}
dst++;
src += srcbpp;
, width);
/* *INDENT-ON* */
#else
for (c = width; c; --c) {
DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
if (1) {
/* Pack RGB into 8bit pixel */
*dst = ((sR >> 5) << (3 + 2)) |
((sG >> 5) << (2)) | ((sB >> 6) << (0));
}
dst++;
src += srcbpp;
}
#endif
src += srcskip;
dst += dstskip;
}
} else {
while (height--) {
#ifdef USE_DUFFS_LOOP
/* *INDENT-OFF* */
DUFFS_LOOP(
DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
sR, sG, sB);
if ( 1 ) {
/* Pack RGB into 8bit pixel */
*dst = map[((sR>>5)<<(3+2))|
((sG>>5)<<(2)) |
((sB>>6)<<(0)) ];
}
dst++;
src += srcbpp;
, width);
/* *INDENT-ON* */
#else
for (c = width; c; --c) {
DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
if (1) {
/* Pack RGB into 8bit pixel */
*dst = map[((sR >> 5) << (3 + 2)) |
((sG >> 5) << (2)) | ((sB >> 6) << (0))];
}
dst++;
src += srcbpp;
}
#endif /* USE_DUFFS_LOOP */
src += srcskip;
dst += dstskip;
}
}
}
SDL_BlitInfo::table
Uint8 * table
Definition: SDL_blit.h:67
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
SDL_BlitInfo::src_fmt
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
NULL
#define NULL
Definition: begin_code.h:164
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_PixelFormat
Definition: SDL_pixels.h:315
DISEMBLE_RGB
#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b)
Definition: SDL_blit.h:177
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
map
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint GLint GLint j2 GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLfloat *params GLenum GLint GLenum GLenum GLvoid *pixels GLenum GLint GLenum GLint *params GLenum GLenum GLint *params GLenum GLsizei const GLvoid *pointer GLenum GLenum const GLint *params GLenum GLfloat GLfloat GLint GLint const GLfloat *points GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat *points GLint GLfloat GLfloat GLint GLfloat GLfloat v2 GLenum GLenum const GLint *params GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum map
Definition: SDL_glfuncs.h:290

## BlitNto1Key()

static void BlitNto1Key | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 2217 of file SDL_blit_N.c.

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

Referenced by SDL_CalculateBlitN().

{
int width = info->dst_w;
int height = info->dst_h;
Uint8 *src = info->src;
int srcskip = info->src_skip;
Uint8 *dst = info->dst;
int dstskip = info->dst_skip;
SDL_PixelFormat *srcfmt = info->src_fmt;
const Uint8 *palmap = info->table;
Uint32 ckey = info->colorkey;
Uint32 rgbmask = ~srcfmt->Amask;
int srcbpp;
Uint32 Pixel;
unsigned sR, sG, sB;
/* Set up some basic variables */
srcbpp = srcfmt->BytesPerPixel;
ckey &= rgbmask;
if (palmap == NULL) {
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP(
{
DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
sR, sG, sB);
if ( (Pixel & rgbmask) != ckey ) {
/* Pack RGB into 8bit pixel */
*dst = (Uint8)(((sR>>5)<<(3+2))|
((sG>>5)<<(2)) |
((sB>>6)<<(0)));
}
dst++;
src += srcbpp;
},
width);
/* *INDENT-ON* */
src += srcskip;
dst += dstskip;
}
} else {
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP(
{
DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel,
sR, sG, sB);
if ( (Pixel & rgbmask) != ckey ) {
/* Pack RGB into 8bit pixel */
*dst = (Uint8)palmap[((sR>>5)<<(3+2))|
((sG>>5)<<(2)) |
((sB>>6)<<(0)) ];
}
dst++;
src += srcbpp;
},
width);
/* *INDENT-ON* */
src += srcskip;
dst += dstskip;
}
}
}
SDL_BlitInfo::table
Uint8 * table
Definition: SDL_blit.h:67
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
SDL_BlitInfo::src_fmt
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_BlitInfo::colorkey
Uint32 colorkey
Definition: SDL_blit.h:69
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
NULL
#define NULL
Definition: begin_code.h:164
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_PixelFormat
Definition: SDL_pixels.h:315
DISEMBLE_RGB
#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b)
Definition: SDL_blit.h:177
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:325
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62

## BlitNto2101010()

static void BlitNto2101010 | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 2435 of file SDL_blit_N.c.

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

Referenced by SDL_CalculateBlitN().

{
int width = info->dst_w;
int height = info->dst_h;
Uint8 *src = info->src;
int srcskip = info->src_skip;
Uint8 *dst = info->dst;
int dstskip = info->dst_skip;
SDL_PixelFormat *srcfmt = info->src_fmt;
int srcbpp = srcfmt->BytesPerPixel;
Uint32 Pixel;
unsigned sR, sG, sB, sA;
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP(
{
DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
ARGB2101010_FROM_RGBA(Pixel, sR, sG, sB, sA);
*(Uint32 *)dst = Pixel;
dst += 4;
src += srcbpp;
},
width);
/* *INDENT-ON* */
src += srcskip;
dst += dstskip;
}
}
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
SDL_BlitInfo::src_fmt
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
DISEMBLE_RGBA
#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a)
Definition: SDL_blit.h:353
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_PixelFormat
Definition: SDL_pixels.h:315
ARGB2101010_FROM_RGBA
#define ARGB2101010_FROM_RGBA(Pixel, r, g, b, a)
Definition: SDL_blit.h:253
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62

## BlitNtoN()

static void BlitNtoN | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 2153 of file SDL_blit_N.c.

References SDL_BlitInfo::a, SDL_PixelFormat::Amask, ASSEMBLE_RGBA, SDL_PixelFormat::BytesPerPixel, DISEMBLE_RGB, SDL_BlitInfo::dst, SDL_BlitInfo::dst_fmt, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, SDL_BlitInfo::src, SDL_BlitInfo::src_fmt, and SDL_BlitInfo::src_skip.

Referenced by SDL_CalculateBlitN().

{
int width = info->dst_w;
int height = info->dst_h;
Uint8 *src = info->src;
int srcskip = info->src_skip;
Uint8 *dst = info->dst;
int dstskip = info->dst_skip;
SDL_PixelFormat *srcfmt = info->src_fmt;
int srcbpp = srcfmt->BytesPerPixel;
SDL_PixelFormat *dstfmt = info->dst_fmt;
int dstbpp = dstfmt->BytesPerPixel;
unsigned alpha = dstfmt->Amask ? info->a : 0;
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP(
{
Uint32 Pixel;
unsigned sR;
unsigned sG;
unsigned sB;
DISEMBLE_RGB(src, srcbpp, srcfmt, Pixel, sR, sG, sB);
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, alpha);
dst += dstbpp;
src += srcbpp;
},
width);
/* *INDENT-ON* */
src += srcskip;
dst += dstskip;
}
}
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
SDL_BlitInfo::src_fmt
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
ASSEMBLE_RGBA
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:402
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
blit_table::dstbpp
int dstbpp
Definition: SDL_blit_N.c:2472
alpha
GLfloat GLfloat GLfloat alpha
Definition: SDL_opengl_glext.h:412
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
SDL_BlitInfo::dst_fmt
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_PixelFormat
Definition: SDL_pixels.h:315
DISEMBLE_RGB
#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b)
Definition: SDL_blit.h:177
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:325
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
SDL_BlitInfo::a
Uint8 a
Definition: SDL_blit.h:70

## BlitNtoNCopyAlpha()

static void BlitNtoNCopyAlpha | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 2188 of file SDL_blit_N.c.

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

Referenced by SDL_CalculateBlitN().

{
int width = info->dst_w;
int height = info->dst_h;
Uint8 *src = info->src;
int srcskip = info->src_skip;
Uint8 *dst = info->dst;
int dstskip = info->dst_skip;
SDL_PixelFormat *srcfmt = info->src_fmt;
int srcbpp = srcfmt->BytesPerPixel;
SDL_PixelFormat *dstfmt = info->dst_fmt;
int dstbpp = dstfmt->BytesPerPixel;
int c;
while (height--) {
for (c = width; c; --c) {
Uint32 Pixel;
unsigned sR, sG, sB, sA;
DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA);
dst += dstbpp;
src += srcbpp;
}
src += srcskip;
dst += dstskip;
}
}
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
SDL_BlitInfo::src_fmt
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
ASSEMBLE_RGBA
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:402
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
blit_table::dstbpp
int dstbpp
Definition: SDL_blit_N.c:2472
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
DISEMBLE_RGBA
#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a)
Definition: SDL_blit.h:353
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
SDL_BlitInfo::dst_fmt
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_PixelFormat
Definition: SDL_pixels.h:315
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62

## BlitNtoNKey()

static void BlitNtoNKey | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 2317 of file SDL_blit_N.c.

References SDL_BlitInfo::a, SDL_PixelFormat::Amask, ASSEMBLE_RGBA, SDL_PixelFormat::BytesPerPixel, SDL_BlitInfo::colorkey, SDL_BlitInfo::dst, SDL_BlitInfo::dst_fmt, SDL_BlitInfo::dst_h, SDL_BlitInfo::dst_skip, SDL_BlitInfo::dst_w, DUFFS_LOOP, RETRIEVE_RGB_PIXEL, RGB_FROM_PIXEL, SDL_BlitInfo::src, SDL_BlitInfo::src_fmt, and SDL_BlitInfo::src_skip.

Referenced by SDL_CalculateBlitN().

{
int width = info->dst_w;
int height = info->dst_h;
Uint8 *src = info->src;
int srcskip = info->src_skip;
Uint8 *dst = info->dst;
int dstskip = info->dst_skip;
Uint32 ckey = info->colorkey;
SDL_PixelFormat *srcfmt = info->src_fmt;
SDL_PixelFormat *dstfmt = info->dst_fmt;
int srcbpp = srcfmt->BytesPerPixel;
int dstbpp = dstfmt->BytesPerPixel;
unsigned alpha = dstfmt->Amask ? info->a : 0;
Uint32 rgbmask = ~srcfmt->Amask;
/* Set up some basic variables */
ckey &= rgbmask;
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP(
{
Uint32 Pixel;
unsigned sR;
unsigned sG;
unsigned sB;
RETRIEVE_RGB_PIXEL(src, srcbpp, Pixel);
if ( (Pixel & rgbmask) != ckey ) {
RGB_FROM_PIXEL(Pixel, srcfmt, sR, sG, sB);
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, alpha);
}
dst += dstbpp;
src += srcbpp;
},
width);
/* *INDENT-ON* */
src += srcskip;
dst += dstskip;
}
}
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
RETRIEVE_RGB_PIXEL
#define RETRIEVE_RGB_PIXEL(buf, bpp, Pixel)
Definition: SDL_blit.h:146
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
SDL_BlitInfo::src_fmt
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
ASSEMBLE_RGBA
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:402
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
blit_table::dstbpp
int dstbpp
Definition: SDL_blit_N.c:2472
alpha
GLfloat GLfloat GLfloat alpha
Definition: SDL_opengl_glext.h:412
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_BlitInfo::colorkey
Uint32 colorkey
Definition: SDL_blit.h:69
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
RGB_FROM_PIXEL
#define RGB_FROM_PIXEL(Pixel, fmt, r, g, b)
Definition: SDL_blit.h:122
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
SDL_BlitInfo::dst_fmt
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_PixelFormat
Definition: SDL_pixels.h:315
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:325
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
SDL_BlitInfo::a
Uint8 a
Definition: SDL_blit.h:70

## BlitNtoNKeyCopyAlpha()

static void BlitNtoNKeyCopyAlpha | ( | SDL_BlitInfo * | info | ) |

static

Definition at line 2360 of file SDL_blit_N.c.

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

Referenced by SDL_CalculateBlitN().

{
int width = info->dst_w;
int height = info->dst_h;
Uint8 *src = info->src;
int srcskip = info->src_skip;
Uint8 *dst = info->dst;
int dstskip = info->dst_skip;
Uint32 ckey = info->colorkey;
SDL_PixelFormat *srcfmt = info->src_fmt;
SDL_PixelFormat *dstfmt = info->dst_fmt;
Uint32 rgbmask = ~srcfmt->Amask;
Uint8 srcbpp;
Uint8 dstbpp;
Uint32 Pixel;
unsigned sR, sG, sB, sA;
/* Set up some basic variables */
srcbpp = srcfmt->BytesPerPixel;
dstbpp = dstfmt->BytesPerPixel;
ckey &= rgbmask;
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP(
{
DISEMBLE_RGBA(src, srcbpp, srcfmt, Pixel, sR, sG, sB, sA);
if ( (Pixel & rgbmask) != ckey ) {
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, sR, sG, sB, sA);
}
dst += dstbpp;
src += srcbpp;
},
width);
/* *INDENT-ON* */
src += srcskip;
dst += dstskip;
}
}
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
SDL_BlitInfo::src_fmt
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
ASSEMBLE_RGBA
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:402
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:181
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
blit_table::dstbpp
int dstbpp
Definition: SDL_blit_N.c:2472
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1572
SDL_BlitInfo::colorkey
Uint32 colorkey
Definition: SDL_blit.h:69
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
DISEMBLE_RGBA
#define DISEMBLE_RGBA(buf, bpp, fmt, Pixel, r, g, b, a)
Definition: SDL_blit.h:353
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:157
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:500
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
SDL_BlitInfo::dst_fmt
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1572
SDL_PixelFormat
Definition: SDL_pixels.h:315
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:325
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62

## SDL_CalculateBlitN()

SDL_BlitFunc SDL_CalculateBlitN | ( | SDL_Surface * | surface | ) |

Definition at line 2537 of file SDL_blit_N.c.

References blit_table::alpha, SDL_PixelFormat::Amask, SDL_PixelFormat::BitsPerPixel, Blit2101010toN(), Blit2to2Key(), Blit4to4CopyAlpha(), Blit4to4MaskAlpha(), blit_table::blit_features, Blit_RGB101010_index8(), Blit_RGB888_index8(), blit_table::blitfunc, BlitNto1(), BlitNto1Key(), BlitNto2101010(), BlitNtoN(), BlitNtoNCopyAlpha(), BlitNtoNKey(), BlitNtoNKeyCopyAlpha(), SDL_PixelFormat::Bmask, SDL_PixelFormat::BytesPerPixel, COPY_ALPHA, SDL_BlitMap::dst, blit_table::dstB, blit_table::dstbpp, blit_table::dstG, blit_table::dstR, SDL_BlitInfo::flags, SDL_Surface::format, SDL_PixelFormat::format, GetBlitFeatures, SDL_PixelFormat::Gmask, SDL_BlitMap::identity, SDL_BlitMap::info, SDL_Surface::map, MASKOK, NO_ALPHA, NULL, SDL_PixelFormat::Rmask, SDL_COPY_COLORKEY, SDL_COPY_RLE_MASK, SDL_HasAltiVec, SDL_PIXELFORMAT_ARGB2101010, SET_ALPHA, blit_table::srcB, blit_table::srcG, and blit_table::srcR.

Referenced by SDL_CalculateBlit().

{
SDL_PixelFormat *srcfmt;
SDL_PixelFormat *dstfmt;
const struct blit_table *table;
int which;
SDL_BlitFunc blitfun;
/* Set up data for choosing the blit */
srcfmt = surface->format;
dstfmt = surface->map->dst->format;
/* We don't support destinations less than 8-bits */
if (dstfmt->BitsPerPixel < 8) {
return (NULL);
}
switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
case 0:
blitfun = NULL;
if (dstfmt->BitsPerPixel == 8) {
if ((srcfmt->BytesPerPixel == 4) &&
(srcfmt->Rmask == 0x00FF0000) &&
(srcfmt->Gmask == 0x0000FF00) &&
(srcfmt->Bmask == 0x000000FF)) {
blitfun = Blit_RGB888_index8;
} else if ((srcfmt->BytesPerPixel == 4) &&
(srcfmt->Rmask == 0x3FF00000) &&
(srcfmt->Gmask == 0x000FFC00) &&
(srcfmt->Bmask == 0x000003FF)) {
blitfun = Blit_RGB101010_index8;
} else {
blitfun = BlitNto1;
}
} else {
/* Now the meat, choose the blitter we want */
int a_need = NO_ALPHA;
if (dstfmt->Amask)
a_need = srcfmt->Amask ? COPY_ALPHA : SET_ALPHA;
table = normal_blit[srcfmt->BytesPerPixel - 1];
for (which = 0; table[which].dstbpp; ++which) {
if (MASKOK(srcfmt->Rmask, table[which].srcR) &&
MASKOK(srcfmt->Gmask, table[which].srcG) &&
MASKOK(srcfmt->Bmask, table[which].srcB) &&
MASKOK(dstfmt->Rmask, table[which].dstR) &&
MASKOK(dstfmt->Gmask, table[which].dstG) &&
MASKOK(dstfmt->Bmask, table[which].dstB) &&
dstfmt->BytesPerPixel == table[which].dstbpp &&
(a_need & table[which].alpha) == a_need &&
((table[which].blit_features & GetBlitFeatures()) ==
table[which].blit_features))
break;
}
blitfun = table[which].blitfunc;
if (blitfun == BlitNtoN) { /* default C fallback catch-all. Slow! */
if (srcfmt->format == SDL_PIXELFORMAT_ARGB2101010) {
blitfun = Blit2101010toN;
} else if (dstfmt->format == SDL_PIXELFORMAT_ARGB2101010) {
blitfun = BlitNto2101010;
} else if (srcfmt->BytesPerPixel == 4 &&
dstfmt->BytesPerPixel == 4 &&
srcfmt->Rmask == dstfmt->Rmask &&
srcfmt->Gmask == dstfmt->Gmask &&
srcfmt->Bmask == dstfmt->Bmask) {
if (a_need == COPY_ALPHA) {
if (srcfmt->Amask == dstfmt->Amask) {
/* Fastpath C fallback: 32bit RGBA<->RGBA blit with matching RGBA */
blitfun = Blit4to4CopyAlpha;
} else {
blitfun = BlitNtoNCopyAlpha;
}
} else {
/* Fastpath C fallback: 32bit RGB<->RGBA blit with matching RGB */
blitfun = Blit4to4MaskAlpha;
}
} else if (a_need == COPY_ALPHA) {
blitfun = BlitNtoNCopyAlpha;
}
}
}
return (blitfun);
case SDL_COPY_COLORKEY:
/* colorkey blit: Here we don't have too many options, mostly
because RLE is the preferred fast way to deal with this.
If a particular case turns out to be useful we'll add it. */
if (srcfmt->BytesPerPixel == 2 && surface->map->identity)
return Blit2to2Key;
else if (dstfmt->BytesPerPixel == 1)
return BlitNto1Key;
else {
#if SDL_ALTIVEC_BLITTERS
if ((srcfmt->BytesPerPixel == 4) && (dstfmt->BytesPerPixel == 4)
&& SDL_HasAltiVec()) {
return Blit32to32KeyAltivec;
} else
#endif
if (srcfmt->Amask && dstfmt->Amask) {
return BlitNtoNKeyCopyAlpha;
} else {
return BlitNtoNKey;
}
}
}
return NULL;
}
blit_table::blitfunc
SDL_BlitFunc blitfunc
Definition: SDL_blit_N.c:2475
SDL_HasAltiVec
#define SDL_HasAltiVec
Definition: SDL_dynapi_overrides.h:104
blit_table::srcG
Uint32 srcG
Definition: SDL_blit_N.c:2471
blit_table::srcB
Uint32 srcB
Definition: SDL_blit_N.c:2471
MASKOK
#define MASKOK(x, y)
Definition: SDL_blit_N.c:2534
SDL_PIXELFORMAT_ARGB2101010
Definition: SDL_pixels.h:260
table
GLenum GLsizei GLenum GLenum const void * table
Definition: SDL_opengl_glext.h:3118
SDL_COPY_COLORKEY
#define SDL_COPY_COLORKEY
Definition: SDL_blit.h:39
blit_table::blit_features
Uint32 blit_features
Definition: SDL_blit_N.c:2474
SDL_PixelFormat::Gmask
Uint32 Gmask
Definition: SDL_pixels.h:323
blit_table::dstB
Uint32 dstB
Definition: SDL_blit_N.c:2473
blit_table::dstR
Uint32 dstR
Definition: SDL_blit_N.c:2473
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:320
SDL_BlitInfo::flags
int flags
Definition: SDL_blit.h:68
NO_ALPHA
#define NO_ALPHA
Definition: SDL_blit_N.c:2466
BlitNto2101010
static void BlitNto2101010(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2435
SDL_PixelFormat::Bmask
Uint32 Bmask
Definition: SDL_pixels.h:324
SDL_COPY_RLE_MASK
#define SDL_COPY_RLE_MASK
Definition: SDL_blit.h:44
blit_table::dstbpp
int dstbpp
Definition: SDL_blit_N.c:2472
blit_table::srcR
Uint32 srcR
Definition: SDL_blit_N.c:2471
BlitNtoNCopyAlpha
static void BlitNtoNCopyAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2188
SDL_Surface::map
struct SDL_BlitMap * map
Definition: SDL_surface.h:88
SET_ALPHA
#define SET_ALPHA
Definition: SDL_blit_N.c:2467
blit_table::dstG
Uint32 dstG
Definition: SDL_blit_N.c:2473
Blit2to2Key
static void Blit2to2Key(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2283
SDL_PixelFormat::BitsPerPixel
Uint8 BitsPerPixel
Definition: SDL_pixels.h:319
Blit4to4MaskAlpha
static void Blit4to4MaskAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2077
BlitNto1Key
static void BlitNto1Key(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2217
Blit_RGB888_index8
static void Blit_RGB888_index8(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:897
blit_table
Definition: SDL_blit_N.c:2469
SDL_BlitMap::dst
SDL_Surface * dst
Definition: SDL_blit.h:88
NULL
#define NULL
Definition: begin_code.h:164
SDL_Surface::format
SDL_PixelFormat * format
Definition: SDL_surface.h:72
normal_blit
static const struct blit_table *const normal_blit[]
Definition: SDL_blit_N.c:2529
BlitNtoNKey
static void BlitNtoNKey(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2317
COPY_ALPHA
#define COPY_ALPHA
Definition: SDL_blit_N.c:2468
Blit2101010toN
static void Blit2101010toN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2403
SDL_PixelFormat::Rmask
Uint32 Rmask
Definition: SDL_pixels.h:322
BlitNtoNKeyCopyAlpha
static void BlitNtoNKeyCopyAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2360
GetBlitFeatures
#define GetBlitFeatures()
Definition: SDL_blit_N.c:878
SDL_PixelFormat
Definition: SDL_pixels.h:315
SDL_BlitFunc
void(* SDL_BlitFunc)(SDL_BlitInfo *info)
Definition: SDL_blit.h:73
blit_table::alpha
Uint32 alpha
Definition: SDL_blit_N.c:2476
Blit_RGB101010_index8
static void Blit_RGB101010_index8(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1007
Blit4to4CopyAlpha
static void Blit4to4CopyAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2127
BlitNtoN
static void BlitNtoN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2153
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:325
SDL_PixelFormat::format
Uint32 format
Definition: SDL_pixels.h:317
SDL_BlitMap::identity
int identity
Definition: SDL_blit.h:89
SDL_BlitMap::info
SDL_BlitInfo info
Definition: SDL_blit.h:92
BlitNto1
static void BlitNto1(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1982

## Variable Documentation

## normal_blit

const struct blit_table* const normal_blit[]

static

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

Definition at line 2529 of file SDL_blit_N.c.

## normal_blit_1

const struct blit_table normal_blit_1[]

static

Initial value:
= {
{0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
}
BlitNtoN
static void BlitNtoN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2153

Definition at line 2478 of file SDL_blit_N.c.

## normal_blit_2

const struct blit_table normal_blit_2[]

static

Initial value:
= {
{0x0000F800, 0x000007E0, 0x0000001F, 4, 0x00FF0000, 0x0000FF00, 0x000000FF,
0, Blit_RGB565_ARGB8888, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
{0x0000F800, 0x000007E0, 0x0000001F, 4, 0x000000FF, 0x0000FF00, 0x00FF0000,
0, Blit_RGB565_ABGR8888, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
{0x0000F800, 0x000007E0, 0x0000001F, 4, 0xFF000000, 0x00FF0000, 0x0000FF00,
0, Blit_RGB565_RGBA8888, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
{0x0000F800, 0x000007E0, 0x0000001F, 4, 0x0000FF00, 0x00FF0000, 0xFF000000,
0, Blit_RGB565_BGRA8888, NO_ALPHA | COPY_ALPHA | SET_ALPHA},
{0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
}
NO_ALPHA
#define NO_ALPHA
Definition: SDL_blit_N.c:2466
Blit_RGB565_ARGB8888
static void Blit_RGB565_ARGB8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1562
SET_ALPHA
#define SET_ALPHA
Definition: SDL_blit_N.c:2467
Blit_RGB565_RGBA8888
static void Blit_RGB565_RGBA8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1838
Blit_RGB565_BGRA8888
static void Blit_RGB565_BGRA8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1976
COPY_ALPHA
#define COPY_ALPHA
Definition: SDL_blit_N.c:2468
BlitNtoN
static void BlitNtoN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2153
Blit_RGB565_ABGR8888
static void Blit_RGB565_ABGR8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1700

Definition at line 2483 of file SDL_blit_N.c.

## normal_blit_3

const struct blit_table normal_blit_3[]

static

Initial value:
= {
{0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0}
}
BlitNtoN
static void BlitNtoN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2153

Definition at line 2504 of file SDL_blit_N.c.

## normal_blit_4

const struct blit_table normal_blit_4[]

static

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

Definition at line 2509 of file SDL_blit_N.c.

## RGB565_ABGR8888_LUT

const Uint32 RGB565_ABGR8888_LUT[512]

static

Definition at line 1568 of file SDL_blit_N.c.

## RGB565_ARGB8888_LUT

const Uint32 RGB565_ARGB8888_LUT[512]

static

Definition at line 1430 of file SDL_blit_N.c.

## RGB565_BGRA8888_LUT

const Uint32 RGB565_BGRA8888_LUT[512]

static

Definition at line 1844 of file SDL_blit_N.c.

## RGB565_RGBA8888_LUT

const Uint32 RGB565_RGBA8888_LUT[512]

static

Definition at line 1706 of file SDL_blit_N.c.