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

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

Definition at line 874 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

#define HI 1

Definition at line 879 of file SDL_blit_N.c.

#define LO 0

Definition at line 880 of file SDL_blit_N.c.

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

Definition at line 2524 of file SDL_blit_N.c.

Referenced by SDL_CalculateBlitN().

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

Value:
{ \
dst = (Uint8)((((src)&0x38000000)>>22)| \
(((src)&0x000E0000)>>15)| \
(((src)&0x00000300)>>8)); \
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
src
GLenum src
Definition: SDL_opengl_glext.h:1737

Definition at line 997 of file SDL_blit_N.c.

Referenced by Blit_RGB101010_index8().

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

Definition at line 1356 of file SDL_blit_N.c.

Referenced by Blit_RGB565_32().

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

Value:
{ \
dst = (Uint8)((((src)&0x00E00000)>>16)| \
(((src)&0x0000E000)>>11)| \
(((src)&0x000000C0)>>6)); \
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
src
GLenum src
Definition: SDL_opengl_glext.h:1737

Definition at line 887 of file SDL_blit_N.c.

Referenced by Blit_RGB888_index8().

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

Value:
{ \
*(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>9)| \
(((*src)&0x0000F800)>>6)| \
(((*src)&0x000000F8)>>3)); \
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
Uint16
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:147
src
GLenum src
Definition: SDL_opengl_glext.h:1737

Definition at line 1107 of file SDL_blit_N.c.

Referenced by Blit_RGB888_RGB555().

#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); \
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
HI
#define HI
Definition: SDL_blit_N.c:879
LO
#define LO
Definition: SDL_blit_N.c:880
src
GLenum src
Definition: SDL_opengl_glext.h:1737

Definition at line 1112 of file SDL_blit_N.c.

Referenced by Blit_RGB888_RGB555().

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

Value:
{ \
*(Uint16 *)(dst) = (Uint16)((((*src)&0x00F80000)>>8)| \
(((*src)&0x0000FC00)>>5)| \
(((*src)&0x000000F8)>>3)); \
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
Uint16
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:147
src
GLenum src
Definition: SDL_opengl_glext.h:1737

Definition at line 1231 of file SDL_blit_N.c.

Referenced by Blit_RGB888_RGB565().

#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); \
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
HI
#define HI
Definition: SDL_blit_N.c:879
LO
#define LO
Definition: SDL_blit_N.c:880
src
GLenum src
Definition: SDL_opengl_glext.h:1737

Definition at line 1236 of file SDL_blit_N.c.

Referenced by Blit_RGB888_RGB565().

## Function Documentation

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

{
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;
}
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:304
ASSEMBLE_RGBA
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
Definition: SDL_blit.h:401
RGBA_FROM_ARGB2101010
#define RGBA_FROM_ARGB2101010(Pixel, r, g, b, a)
Definition: SDL_blit.h:345
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
blit_table::dstbpp
int dstbpp
Definition: SDL_blit_N.c:2461
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
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
Definition: SDL_pixels.h:299
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
src
GLenum src
Definition: SDL_opengl_glext.h:1737

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

{
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;
}
}
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
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
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
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:499
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
Uint16
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:147
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:309
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62

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

{
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);
}
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
src
GLenum src
Definition: SDL_opengl_glext.h:1737

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

{
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:313
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
SDL_PixelFormat::Gmask
Uint32 Gmask
Definition: SDL_pixels.h:307
SDL_BlitInfo::src_fmt
SDL_PixelFormat * src_fmt
Definition: SDL_blit.h:65
SDL_PixelFormat::Bmask
Uint32 Bmask
Definition: SDL_pixels.h:308
SDL_PixelFormat::Ashift
Uint8 Ashift
Definition: SDL_pixels.h:317
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
mask
GLenum GLint GLuint mask
Definition: SDL_opengl_glext.h:657
SDL_BlitInfo::dst_fmt
SDL_PixelFormat * dst_fmt
Definition: SDL_blit.h:66
SDL_PixelFormat::Rmask
Uint32 Rmask
Definition: SDL_pixels.h:306
SDL_PixelFormat
Definition: SDL_pixels.h:299
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:309
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::a
Uint8 a
Definition: SDL_blit.h:70

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

{
#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
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
RGB101010_RGB332
#define RGB101010_RGB332(dst, src)
Definition: SDL_blit_N.c:997
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
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:143
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:289
src
GLenum src
Definition: SDL_opengl_glext.h:1737

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

{
#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 */
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
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:1356
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:289
src
GLenum src
Definition: SDL_opengl_glext.h:1737

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

static

Definition at line 1692 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:1358
RGB565_ABGR8888_LUT
static const Uint32 RGB565_ABGR8888_LUT[512]
Definition: SDL_blit_N.c:1560

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

static

Definition at line 1554 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:1358
RGB565_ARGB8888_LUT
static const Uint32 RGB565_ARGB8888_LUT[512]
Definition: SDL_blit_N.c:1422

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

static

Definition at line 1968 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:1358
RGB565_BGRA8888_LUT
static const Uint32 RGB565_BGRA8888_LUT[512]
Definition: SDL_blit_N.c:1836

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

static

Definition at line 1830 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:1358
RGB565_RGBA8888_LUT
static const Uint32 RGB565_RGBA8888_LUT[512]
Definition: SDL_blit_N.c:1698

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

{
#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
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
RGB888_RGB332
#define RGB888_RGB332(dst, src)
Definition: SDL_blit_N.c:887
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
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:143
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:289
src
GLenum src
Definition: SDL_opengl_glext.h:1737

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.

{
#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 */
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
RGB888_RGB555_TWO
#define RGB888_RGB555_TWO(dst, src)
Definition: SDL_blit_N.c:1112
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
Uint16
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:147
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
src
GLenum src
Definition: SDL_opengl_glext.h:1737
RGB888_RGB555
#define RGB888_RGB555(dst, src)
Definition: SDL_blit_N.c:1107

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.

{
#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 */
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
RGB888_RGB565
#define RGB888_RGB565(dst, src)
Definition: SDL_blit_N.c:1231
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
RGB888_RGB565_TWO
#define RGB888_RGB565_TWO(dst, src)
Definition: SDL_blit_N.c:1236
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11093
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
Uint16
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:147
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
src
GLenum src
Definition: SDL_opengl_glext.h:1737

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

{
#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
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:304
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
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
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:143
SDL_PixelFormat
Definition: SDL_pixels.h:299
DISEMBLE_RGB
#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b)
Definition: SDL_blit.h:176
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:289
src
GLenum src
Definition: SDL_opengl_glext.h:1737

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

{
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
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:304
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
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
SDL_BlitInfo::colorkey
Uint32 colorkey
Definition: SDL_blit.h:69
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
NULL
#define NULL
Definition: begin_code.h:143
SDL_PixelFormat
Definition: SDL_pixels.h:299
DISEMBLE_RGB
#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b)
Definition: SDL_blit.h:176
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:309
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
src
GLenum src
Definition: SDL_opengl_glext.h:1737

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

{
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;
}
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:304
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
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
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:352
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
SDL_BlitInfo::src
Uint8 * src
Definition: SDL_blit.h:57
SDL_PixelFormat
Definition: SDL_pixels.h:299
ARGB2101010_FROM_RGBA
#define ARGB2101010_FROM_RGBA(Pixel, r, g, b, a)
Definition: SDL_blit.h:252
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
src
GLenum src
Definition: SDL_opengl_glext.h:1737

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

{
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;
}
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:304
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:401
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
blit_table::dstbpp
int dstbpp
Definition: SDL_blit_N.c:2461
alpha
GLfloat GLfloat GLfloat alpha
Definition: SDL_opengl_glext.h:412
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
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
Definition: SDL_pixels.h:299
DISEMBLE_RGB
#define DISEMBLE_RGB(buf, bpp, fmt, Pixel, r, g, b)
Definition: SDL_blit.h:176
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:309
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::a
Uint8 a
Definition: SDL_blit.h:70

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

{
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;
}
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:304
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:401
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
blit_table::dstbpp
int dstbpp
Definition: SDL_blit_N.c:2461
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:352
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
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
SDL_PixelFormat
Definition: SDL_pixels.h:299
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
src
GLenum src
Definition: SDL_opengl_glext.h:1737

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

{
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;
}
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
RETRIEVE_RGB_PIXEL
#define RETRIEVE_RGB_PIXEL(buf, bpp, Pixel)
Definition: SDL_blit.h:145
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:304
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:401
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
blit_table::dstbpp
int dstbpp
Definition: SDL_blit_N.c:2461
alpha
GLfloat GLfloat GLfloat alpha
Definition: SDL_opengl_glext.h:412
SDL_BlitInfo::colorkey
Uint32 colorkey
Definition: SDL_blit.h:69
SDL_BlitInfo::dst
Uint8 * dst
Definition: SDL_blit.h:61
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
RGB_FROM_PIXEL
#define RGB_FROM_PIXEL(Pixel, fmt, r, g, b)
Definition: SDL_blit.h:121
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
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
Definition: SDL_pixels.h:299
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:309
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
src
GLenum src
Definition: SDL_opengl_glext.h:1737
SDL_BlitInfo::a
Uint8 a
Definition: SDL_blit.h:70

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

{
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;
}
}
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1737
width
GLint GLint GLsizei width
Definition: SDL_opengl.h:1565
SDL_BlitInfo::src_skip
int src_skip
Definition: SDL_blit.h:60
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:155
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:304
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:401
SDL_BlitInfo::dst_skip
int dst_skip
Definition: SDL_blit.h:64
height
GLint GLint GLsizei GLsizei height
Definition: SDL_opengl.h:1565
SDL_BlitInfo::dst_h
int dst_h
Definition: SDL_blit.h:62
blit_table::dstbpp
int dstbpp
Definition: SDL_blit_N.c:2461
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:352
Uint8
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:139
DUFFS_LOOP
#define DUFFS_LOOP(pixel_copy_increment, width)
Definition: SDL_blit.h:499
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
Definition: SDL_pixels.h:299
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:309
SDL_BlitInfo::dst_w
int dst_w
Definition: SDL_blit.h:62
src
GLenum src
Definition: SDL_opengl_glext.h:1737

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

{
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:2464
blit_table::alpha
enum blit_table::@28 alpha
SDL_HasAltiVec
#define SDL_HasAltiVec
Definition: SDL_dynapi_overrides.h:110
blit_table::srcG
Uint32 srcG
Definition: SDL_blit_N.c:2460
blit_table::srcB
Uint32 srcB
Definition: SDL_blit_N.c:2460
MASKOK
#define MASKOK(x, y)
Definition: SDL_blit_N.c:2524
SDL_PIXELFORMAT_ARGB2101010
Definition: SDL_pixels.h:259
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:2463
SDL_PixelFormat::Gmask
Uint32 Gmask
Definition: SDL_pixels.h:307
blit_table::SET_ALPHA
Definition: SDL_blit_N.c:2466
blit_table::dstB
Uint32 dstB
Definition: SDL_blit_N.c:2462
blit_table::dstR
Uint32 dstR
Definition: SDL_blit_N.c:2462
SDL_PixelFormat::BytesPerPixel
Uint8 BytesPerPixel
Definition: SDL_pixels.h:304
SDL_BlitInfo::flags
int flags
Definition: SDL_blit.h:68
BlitNto2101010
static void BlitNto2101010(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2427
SDL_PixelFormat::Bmask
Uint32 Bmask
Definition: SDL_pixels.h:308
SDL_COPY_RLE_MASK
#define SDL_COPY_RLE_MASK
Definition: SDL_blit.h:44
blit_table::dstbpp
int dstbpp
Definition: SDL_blit_N.c:2461
blit_table::srcR
Uint32 srcR
Definition: SDL_blit_N.c:2460
BlitNtoNCopyAlpha
static void BlitNtoNCopyAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2180
SDL_Surface::map
struct SDL_BlitMap * map
Definition: SDL_surface.h:88
blit_table::dstG
Uint32 dstG
Definition: SDL_blit_N.c:2462
Blit2to2Key
static void Blit2to2Key(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2275
SDL_PixelFormat::BitsPerPixel
Uint8 BitsPerPixel
Definition: SDL_pixels.h:303
Blit4to4MaskAlpha
static void Blit4to4MaskAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2069
BlitNto1Key
static void BlitNto1Key(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2209
Blit_RGB888_index8
static void Blit_RGB888_index8(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:893
blit_table::NO_ALPHA
Definition: SDL_blit_N.c:2466
blit_table
Definition: SDL_blit_N.c:2458
blit_table::COPY_ALPHA
Definition: SDL_blit_N.c:2466
SDL_BlitMap::dst
SDL_Surface * dst
Definition: SDL_blit.h:87
NULL
#define NULL
Definition: begin_code.h:143
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:2519
BlitNtoNKey
static void BlitNtoNKey(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2309
Blit2101010toN
static void Blit2101010toN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2395
SDL_PixelFormat::Rmask
Uint32 Rmask
Definition: SDL_pixels.h:306
BlitNtoNKeyCopyAlpha
static void BlitNtoNKeyCopyAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2352
GetBlitFeatures
#define GetBlitFeatures()
Definition: SDL_blit_N.c:874
SDL_PixelFormat
Definition: SDL_pixels.h:299
SDL_BlitFunc
void(* SDL_BlitFunc)(SDL_BlitInfo *info)
Definition: SDL_blit.h:73
Blit_RGB101010_index8
static void Blit_RGB101010_index8(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1003
Blit4to4CopyAlpha
static void Blit4to4CopyAlpha(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2119
BlitNtoN
static void BlitNtoN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2145
SDL_PixelFormat::Amask
Uint32 Amask
Definition: SDL_pixels.h:309
SDL_PixelFormat::format
Uint32 format
Definition: SDL_pixels.h:301
SDL_BlitMap::identity
int identity
Definition: SDL_blit.h:88
SDL_BlitMap::info
SDL_BlitInfo info
Definition: SDL_blit.h:91
BlitNto1
static void BlitNto1(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1974

## Variable Documentation

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

Definition at line 2519 of file SDL_blit_N.c.

const struct blit_table normal_blit_1[]

static

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

Definition at line 2468 of file SDL_blit_N.c.

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}
}
blit_table::SET_ALPHA
Definition: SDL_blit_N.c:2466
Blit_RGB565_ARGB8888
static void Blit_RGB565_ARGB8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1554
blit_table::NO_ALPHA
Definition: SDL_blit_N.c:2466
Blit_RGB565_RGBA8888
static void Blit_RGB565_RGBA8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1830
Blit_RGB565_BGRA8888
static void Blit_RGB565_BGRA8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1968
blit_table::COPY_ALPHA
Definition: SDL_blit_N.c:2466
BlitNtoN
static void BlitNtoN(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:2145
Blit_RGB565_ABGR8888
static void Blit_RGB565_ABGR8888(SDL_BlitInfo *info)
Definition: SDL_blit_N.c:1692

Definition at line 2473 of file SDL_blit_N.c.

const struct blit_table normal_blit_3[]

static

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

Definition at line 2494 of file SDL_blit_N.c.

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

Definition at line 2499 of file SDL_blit_N.c.

const Uint32 RGB565_ABGR8888_LUT[512]

static

Definition at line 1560 of file SDL_blit_N.c.

const Uint32 RGB565_ARGB8888_LUT[512]

static

Definition at line 1422 of file SDL_blit_N.c.

const Uint32 RGB565_BGRA8888_LUT[512]

static

Definition at line 1836 of file SDL_blit_N.c.

const Uint32 RGB565_RGBA8888_LUT[512]

static

Definition at line 1698 of file SDL_blit_N.c.