SDL  2.0
SDL_RLEaccel.c File Reference
#include "../SDL_internal.h"
#include "SDL_video.h"
#include "SDL_sysvideo.h"
#include "SDL_blit.h"
#include "SDL_RLEaccel_c.h"
+ Include dependency graph for SDL_RLEaccel.c:

Go to the source code of this file.

Data Structures

struct  RLEDestFormat
 

Macros

#define MAX(a, b)   ((a) > (b) ? (a) : (b))
 
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
 
#define PIXEL_COPY(to, from, len, bpp)   SDL_memcpy(to, from, (size_t)(len) * (bpp))
 
#define OPAQUE_BLIT(to, from, length, bpp, alpha)   PIXEL_COPY(to, from, length, bpp)
 
#define ALPHA_BLIT32_888(to, from, length, bpp, alpha)
 
#define ALPHA_BLIT16_565(to, from, length, bpp, alpha)
 
#define ALPHA_BLIT16_555(to, from, length, bpp, alpha)
 
#define ALPHA_BLIT_ANY(to, from, length, bpp, alpha)
 
#define ALPHA_BLIT32_888_50(to, from, length, bpp, alpha)
 
#define BLEND16_50(dst, src, mask)
 
#define ALPHA_BLIT16_50(to, from, length, bpp, alpha, mask)
 
#define ALPHA_BLIT16_565_50(to, from, length, bpp, alpha)   ALPHA_BLIT16_50(to, from, length, bpp, alpha, 0xf7de)
 
#define ALPHA_BLIT16_555_50(to, from, length, bpp, alpha)   ALPHA_BLIT16_50(to, from, length, bpp, alpha, 0xfbde)
 
#define CHOOSE_BLIT(blitter, alpha, fmt)
 
#define RLEPIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a)
 
#define RLECLIPBLIT(bpp, Type, do_blit)
 
#define RLESKIP(bpp, Type)
 
#define RLEBLIT(bpp, Type, do_blit)
 
#define BLIT_TRANSL_888(src, dst)
 
#define BLIT_TRANSL_565(src, dst)
 
#define BLIT_TRANSL_555(src, dst)
 
#define RLEALPHACLIPBLIT(Ptype, Ctype, do_blend)
 
#define RLEALPHABLIT(Ptype, Ctype, do_blend)
 
#define ISOPAQUE(pixel, fmt)   ((((pixel) & fmt->Amask) >> fmt->Ashift) == 255)
 
#define ISTRANSL(pixel, fmt)   ((unsigned)((((pixel) & fmt->Amask) >> fmt->Ashift) - 1U) < 254U)
 
#define ADD_OPAQUE_COUNTS(n, m)
 
#define ADD_TRANSL_COUNTS(n, m)   (((Uint16 *)dst)[0] = n, ((Uint16 *)dst)[1] = m, dst += 4)
 
#define ADD_COUNTS(n, m)
 

Typedefs

typedef Uint32(* getpix_func) (Uint8 *)
 

Functions

static void RLEClipBlit (int w, Uint8 *srcbuf, SDL_Surface *surf_dst, Uint8 *dstbuf, SDL_Rect *srcrect, unsigned alpha)
 
int SDL_RLEBlit (SDL_Surface *surf_src, SDL_Rect *srcrect, SDL_Surface *surf_dst, SDL_Rect *dstrect)
 
static void RLEAlphaClipBlit (int w, Uint8 *srcbuf, SDL_Surface *surf_dst, Uint8 *dstbuf, SDL_Rect *srcrect)
 
int SDL_RLEAlphaBlit (SDL_Surface *surf_src, SDL_Rect *srcrect, SDL_Surface *surf_dst, SDL_Rect *dstrect)
 
static int copy_opaque_16 (void *dst, Uint32 *src, int n, SDL_PixelFormat *sfmt, SDL_PixelFormat *dfmt)
 
static int uncopy_opaque_16 (Uint32 *dst, void *src, int n, RLEDestFormat *sfmt, SDL_PixelFormat *dfmt)
 
static int copy_transl_565 (void *dst, Uint32 *src, int n, SDL_PixelFormat *sfmt, SDL_PixelFormat *dfmt)
 
static int copy_transl_555 (void *dst, Uint32 *src, int n, SDL_PixelFormat *sfmt, SDL_PixelFormat *dfmt)
 
static int uncopy_transl_16 (Uint32 *dst, void *src, int n, RLEDestFormat *sfmt, SDL_PixelFormat *dfmt)
 
static int copy_32 (void *dst, Uint32 *src, int n, SDL_PixelFormat *sfmt, SDL_PixelFormat *dfmt)
 
static int uncopy_32 (Uint32 *dst, void *src, int n, RLEDestFormat *sfmt, SDL_PixelFormat *dfmt)
 
static int RLEAlphaSurface (SDL_Surface *surface)
 
static Uint32 getpix_8 (Uint8 *srcbuf)
 
static Uint32 getpix_16 (Uint8 *srcbuf)
 
static Uint32 getpix_24 (Uint8 *srcbuf)
 
static Uint32 getpix_32 (Uint8 *srcbuf)
 
static int RLEColorkeySurface (SDL_Surface *surface)
 
int SDL_RLESurface (SDL_Surface *surface)
 
static SDL_bool UnRLEAlpha (SDL_Surface *surface)
 
void SDL_UnRLESurface (SDL_Surface *surface, int recode)
 

Variables

static const getpix_func getpixes [4]
 

Macro Definition Documentation

◆ ADD_COUNTS

#define ADD_COUNTS (   n,
  m 
)
Value:
if(bpp == 4) { \
((Uint16 *)dst)[0] = n; \
((Uint16 *)dst)[1] = m; \
dst += 4; \
} else { \
dst[0] = n; \
dst[1] = m; \
dst += 2; \
}
GLenum GLenum dst
GLdouble n
const GLfloat * m
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151

Referenced by RLEColorkeySurface().

◆ ADD_OPAQUE_COUNTS

#define ADD_OPAQUE_COUNTS (   n,
  m 
)
Value:
if(df->BytesPerPixel == 4) { \
((Uint16 *)dst)[0] = n; \
((Uint16 *)dst)[1] = m; \
dst += 4; \
} else { \
dst[0] = n; \
dst[1] = m; \
dst += 2; \
}
GLenum GLenum dst
GLdouble n
const GLfloat * m
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151

Referenced by RLEAlphaSurface().

◆ ADD_TRANSL_COUNTS

#define ADD_TRANSL_COUNTS (   n,
  m 
)    (((Uint16 *)dst)[0] = n, ((Uint16 *)dst)[1] = m, dst += 4)

Referenced by RLEAlphaSurface().

◆ ALPHA_BLIT16_50

#define ALPHA_BLIT16_50 (   to,
  from,
  length,
  bpp,
  alpha,
  mask 
)
Value:
do { \
unsigned n = (length); \
Uint16 *src = (Uint16 *)(from); \
Uint16 *dst = (Uint16 *)(to); \
if (((uintptr_t)src ^ (uintptr_t)dst) & 3) { \
/* source and destination not in phase, blit one by one */ \
while (n--) \
BLEND16_50(dst, src, mask); \
} else { \
if ((uintptr_t)src & 3) { \
/* first odd pixel */ \
BLEND16_50(dst, src, mask); \
n--; \
} \
for (; n > 1; n -= 2) { \
Uint32 s = *(Uint32 *)src; \
Uint32 d = *(Uint32 *)dst; \
*(Uint32 *)dst = ((s & (mask | mask << 16)) >> 1) \
+ ((d & (mask | mask << 16)) >> 1) \
+ (s & d & (~(mask | mask << 16))); \
src += 2; \
dst += 2; \
} \
if (n) \
BLEND16_50(dst, src, mask); /* last odd pixel */ \
} \
} while(0)
GLenum GLenum dst
GLdouble s
Definition: SDL_opengl.h:2056
GLdouble n
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
unsigned int uintptr_t
GLenum GLint GLuint mask
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
GLuint GLsizei GLsizei * length
GLenum src

Definition at line 271 of file SDL_RLEaccel.c.

◆ ALPHA_BLIT16_555

#define ALPHA_BLIT16_555 (   to,
  from,
  length,
  bpp,
  alpha 
)
Value:
do { \
int i; \
Uint16 *src = (Uint16 *)(from); \
Uint16 *dst = (Uint16 *)(to); \
Uint32 ALPHA = alpha >> 3; \
for(i = 0; i < (int)(length); i++) { \
Uint32 s = *src++; \
Uint32 d = *dst; \
s = (s | s << 16) & 0x03e07c1f; \
d = (d | d << 16) & 0x03e07c1f; \
d += (s - d) * ALPHA >> 5; \
d &= 0x03e07c1f; \
*dst++ = (Uint16)(d | d >> 16); \
} \
} while(0)
GLenum GLenum dst
GLdouble s
Definition: SDL_opengl.h:2056
GLfloat GLfloat GLfloat alpha
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
GLuint GLsizei GLsizei * length
GLenum src

Definition at line 158 of file SDL_RLEaccel.c.

◆ ALPHA_BLIT16_555_50

#define ALPHA_BLIT16_555_50 (   to,
  from,
  length,
  bpp,
  alpha 
)    ALPHA_BLIT16_50(to, from, length, bpp, alpha, 0xfbde)

Definition at line 303 of file SDL_RLEaccel.c.

◆ ALPHA_BLIT16_565

#define ALPHA_BLIT16_565 (   to,
  from,
  length,
  bpp,
  alpha 
)
Value:
do { \
int i; \
Uint16 *src = (Uint16 *)(from); \
Uint16 *dst = (Uint16 *)(to); \
Uint32 ALPHA = alpha >> 3; \
for(i = 0; i < (int)(length); i++) { \
Uint32 s = *src++; \
Uint32 d = *dst; \
s = (s | s << 16) & 0x07e0f81f; \
d = (d | d << 16) & 0x07e0f81f; \
d += (s - d) * ALPHA >> 5; \
d &= 0x07e0f81f; \
*dst++ = (Uint16)(d | d >> 16); \
} \
} while(0)
GLenum GLenum dst
GLdouble s
Definition: SDL_opengl.h:2056
GLfloat GLfloat GLfloat alpha
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
GLuint GLsizei GLsizei * length
GLenum src

Definition at line 141 of file SDL_RLEaccel.c.

◆ ALPHA_BLIT16_565_50

#define ALPHA_BLIT16_565_50 (   to,
  from,
  length,
  bpp,
  alpha 
)    ALPHA_BLIT16_50(to, from, length, bpp, alpha, 0xf7de)

Definition at line 300 of file SDL_RLEaccel.c.

◆ ALPHA_BLIT32_888

#define ALPHA_BLIT32_888 (   to,
  from,
  length,
  bpp,
  alpha 
)
Value:
do { \
int i; \
Uint32 *src = (Uint32 *)(from); \
Uint32 *dst = (Uint32 *)(to); \
for (i = 0; i < (int)(length); i++) { \
Uint32 s = *src++; \
Uint32 d = *dst; \
Uint32 s1 = s & 0xff00ff; \
Uint32 d1 = d & 0xff00ff; \
d1 = (d1 + ((s1 - d1) * alpha >> 8)) & 0xff00ff; \
s &= 0xff00; \
d &= 0xff00; \
d = (d + ((s - d) * alpha >> 8)) & 0xff00; \
*dst++ = d1 | d; \
} \
} while (0)
GLenum GLenum dst
GLdouble s
Definition: SDL_opengl.h:2056
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLfloat GLfloat GLfloat alpha
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
GLuint GLsizei GLsizei * length
GLenum src

Definition at line 117 of file SDL_RLEaccel.c.

◆ ALPHA_BLIT32_888_50

#define ALPHA_BLIT32_888_50 (   to,
  from,
  length,
  bpp,
  alpha 
)
Value:
do { \
int i; \
Uint32 *src = (Uint32 *)(from); \
Uint32 *dst = (Uint32 *)(to); \
for(i = 0; i < (int)(length); i++) { \
Uint32 s = *src++; \
Uint32 d = *dst; \
*dst++ = (((s & 0x00fefefe) + (d & 0x00fefefe)) >> 1) \
+ (s & d & 0x00010101); \
} \
} while(0)
GLenum GLenum dst
GLdouble s
Definition: SDL_opengl.h:2056
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
GLuint GLsizei GLsizei * length
GLenum src

Definition at line 243 of file SDL_RLEaccel.c.

◆ ALPHA_BLIT_ANY

#define ALPHA_BLIT_ANY (   to,
  from,
  length,
  bpp,
  alpha 
)

Definition at line 178 of file SDL_RLEaccel.c.

◆ BLEND16_50

#define BLEND16_50 (   dst,
  src,
  mask 
)
Value:
do { \
Uint32 s = *src++; \
Uint32 d = *dst; \
*dst++ = (Uint16)((((s & mask) + (d & mask)) >> 1) + \
(s & d & (~mask & 0xffff))); \
} while(0)
GLenum GLenum dst
GLdouble s
Definition: SDL_opengl.h:2056
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
GLenum GLint GLuint mask
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
GLenum src

Definition at line 262 of file SDL_RLEaccel.c.

◆ BLIT_TRANSL_555

#define BLIT_TRANSL_555 (   src,
  dst 
)
Value:
do { \
Uint32 s = src; \
Uint32 d = dst; \
unsigned alpha = (s & 0x3e0) >> 5; \
s &= 0x03e07c1f; \
d = (d | d << 16) & 0x03e07c1f; \
d += (s - d) * alpha >> 5; \
d &= 0x03e07c1f; \
dst = (Uint16)(d | d >> 16); \
} while(0)
GLenum GLenum dst
GLdouble s
Definition: SDL_opengl.h:2056
GLfloat GLfloat GLfloat alpha
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
GLenum src

Definition at line 604 of file SDL_RLEaccel.c.

Referenced by RLEAlphaClipBlit(), and SDL_RLEAlphaBlit().

◆ BLIT_TRANSL_565

#define BLIT_TRANSL_565 (   src,
  dst 
)
Value:
do { \
Uint32 s = src; \
Uint32 d = dst; \
unsigned alpha = (s & 0x3e0) >> 5; \
s &= 0x07e0f81f; \
d = (d | d << 16) & 0x07e0f81f; \
d += (s - d) * alpha >> 5; \
d &= 0x07e0f81f; \
dst = (Uint16)(d | d >> 16); \
} while(0)
GLenum GLenum dst
GLdouble s
Definition: SDL_opengl.h:2056
GLfloat GLfloat GLfloat alpha
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
GLenum src

Definition at line 592 of file SDL_RLEaccel.c.

Referenced by RLEAlphaClipBlit(), and SDL_RLEAlphaBlit().

◆ BLIT_TRANSL_888

#define BLIT_TRANSL_888 (   src,
  dst 
)
Value:
do { \
Uint32 s = src; \
Uint32 d = dst; \
unsigned alpha = s >> 24; \
Uint32 s1 = s & 0xff00ff; \
Uint32 d1 = d & 0xff00ff; \
d1 = (d1 + ((s1 - d1) * alpha >> 8)) & 0xff00ff; \
s &= 0xff00; \
d &= 0xff00; \
d = (d + ((s - d) * alpha >> 8)) & 0xff00; \
dst = d1 | d | 0xff000000; \
} while(0)
GLenum GLenum dst
GLdouble s
Definition: SDL_opengl.h:2056
GLfloat GLfloat GLfloat alpha
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
GLenum src

Definition at line 574 of file SDL_RLEaccel.c.

Referenced by RLEAlphaClipBlit(), and SDL_RLEAlphaBlit().

◆ CHOOSE_BLIT

#define CHOOSE_BLIT (   blitter,
  alpha,
  fmt 
)

Definition at line 306 of file SDL_RLEaccel.c.

Referenced by RLEClipBlit(), and SDL_RLEBlit().

◆ ISOPAQUE

#define ISOPAQUE (   pixel,
  fmt 
)    ((((pixel) & fmt->Amask) >> fmt->Ashift) == 255)

Definition at line 1022 of file SDL_RLEaccel.c.

Referenced by RLEAlphaSurface().

◆ ISTRANSL

#define ISTRANSL (   pixel,
  fmt 
)    ((unsigned)((((pixel) & fmt->Amask) >> fmt->Ashift) - 1U) < 254U)

Definition at line 1024 of file SDL_RLEaccel.c.

Referenced by RLEAlphaSurface().

◆ MAX

#define MAX (   a,
  b 
)    ((a) > (b) ? (a) : (b))

Definition at line 94 of file SDL_RLEaccel.c.

◆ MIN

#define MIN (   a,
  b 
)    ((a) < (b) ? (a) : (b))

Definition at line 97 of file SDL_RLEaccel.c.

Referenced by RLEAlphaSurface(), and RLEColorkeySurface().

◆ OPAQUE_BLIT

#define OPAQUE_BLIT (   to,
  from,
  length,
  bpp,
  alpha 
)    PIXEL_COPY(to, from, length, bpp)

Definition at line 107 of file SDL_RLEaccel.c.

◆ PIXEL_COPY

#define PIXEL_COPY (   to,
  from,
  len,
  bpp 
)    SDL_memcpy(to, from, (size_t)(len) * (bpp))

Definition at line 100 of file SDL_RLEaccel.c.

◆ RLEALPHABLIT

#define RLEALPHABLIT (   Ptype,
  Ctype,
  do_blend 
)

Referenced by SDL_RLEAlphaBlit().

◆ RLEALPHACLIPBLIT

#define RLEALPHACLIPBLIT (   Ptype,
  Ctype,
  do_blend 
)

Referenced by RLEAlphaClipBlit().

◆ RLEBLIT

#define RLEBLIT (   bpp,
  Type,
  do_blit 
)
Value:
do { \
int linecount = srcrect->h; \
int ofs = 0; \
for(;;) { \
unsigned run; \
ofs += *(Type *)srcbuf; \
run = ((Type *)srcbuf)[1]; \
srcbuf += 2 * sizeof(Type); \
if(run) { \
do_blit(dstbuf + ofs * bpp, srcbuf, run, bpp, alpha); \
srcbuf += run * bpp; \
ofs += run; \
} else if(!ofs) \
break; \
if(ofs == w) { \
ofs = 0; \
dstbuf += surf_dst->pitch; \
if(!--linecount) \
break; \
} \
} \
} while(0)
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp
GLfloat GLfloat GLfloat alpha
GLubyte GLubyte GLubyte GLubyte w

Referenced by SDL_RLEBlit().

◆ RLECLIPBLIT

#define RLECLIPBLIT (   bpp,
  Type,
  do_blit 
)

Referenced by RLEClipBlit().

◆ RLEPIXEL_FROM_RGBA

#define RLEPIXEL_FROM_RGBA (   Pixel,
  fmt,
  r,
  g,
  b,
  a 
)
Value:
{ \
Pixel = ((r>>fmt->Rloss)<<fmt->Rshift)| \
((g>>fmt->Gloss)<<fmt->Gshift)| \
((b>>fmt->Bloss)<<fmt->Bshift)| \
(a<<24); \
}
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2072
GLboolean GLboolean g
GLboolean GLboolean GLboolean GLboolean a
GLboolean GLboolean GLboolean b

Definition at line 380 of file SDL_RLEaccel.c.

Referenced by copy_32().

◆ RLESKIP

#define RLESKIP (   bpp,
  Type 
)
Value:
for(;;) { \
int run; \
ofs += *(Type *)srcbuf; \
run = ((Type *)srcbuf)[1]; \
srcbuf += sizeof(Type) * 2; \
if(run) { \
srcbuf += run * bpp; \
ofs += run; \
} else if(!ofs) \
goto done; \
if(ofs == w) { \
ofs = 0; \
if(!--vskip) \
break; \
} \
}
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp
int done
Definition: checkkeys.c:28
GLubyte GLubyte GLubyte GLubyte w

Referenced by SDL_RLEBlit().

Typedef Documentation

◆ getpix_func

typedef Uint32(* getpix_func) (Uint8 *)

Definition at line 1269 of file SDL_RLEaccel.c.

Function Documentation

◆ copy_32()

static int copy_32 ( void dst,
Uint32 src,
int  n,
SDL_PixelFormat sfmt,
SDL_PixelFormat dfmt 
)
static

Definition at line 989 of file SDL_RLEaccel.c.

References d, i, RGBA_FROM_8888, and RLEPIXEL_FROM_RGBA.

Referenced by RLEAlphaSurface().

991 {
992  int i;
993  Uint32 *d = dst;
994  for (i = 0; i < n; i++) {
995  unsigned r, g, b, a;
996  RGBA_FROM_8888(*src, sfmt, r, g, b, a);
997  RLEPIXEL_FROM_RGBA(*d, dfmt, r, g, b, a);
998  d++;
999  src++;
1000  }
1001  return n * 4;
1002 }
GLenum GLenum dst
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2072
GLdouble n
#define RLEPIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a)
Definition: SDL_RLEaccel.c:380
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLboolean GLboolean g
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
#define RGBA_FROM_8888(Pixel, fmt, r, g, b, a)
Definition: SDL_blit.h:310
GLboolean GLboolean GLboolean GLboolean a
GLenum src
GLboolean GLboolean GLboolean b

◆ copy_opaque_16()

static int copy_opaque_16 ( void dst,
Uint32 src,
int  n,
SDL_PixelFormat sfmt,
SDL_PixelFormat dfmt 
)
static

Definition at line 895 of file SDL_RLEaccel.c.

References d, i, PIXEL_FROM_RGB, and RGB_FROM_PIXEL.

Referenced by RLEAlphaSurface().

897 {
898  int i;
899  Uint16 *d = dst;
900  for (i = 0; i < n; i++) {
901  unsigned r, g, b;
902  RGB_FROM_PIXEL(*src, sfmt, r, g, b);
903  PIXEL_FROM_RGB(*d, dfmt, r, g, b);
904  src++;
905  d++;
906  }
907  return n * 2;
908 }
GLenum GLenum dst
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2072
GLdouble n
GLboolean GLboolean g
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
#define RGB_FROM_PIXEL(Pixel, fmt, r, g, b)
Definition: SDL_blit.h:121
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
#define PIXEL_FROM_RGB(Pixel, fmt, r, g, b)
Definition: SDL_blit.h:217
GLenum src
GLboolean GLboolean GLboolean b

◆ copy_transl_555()

static int copy_transl_555 ( void dst,
Uint32 src,
int  n,
SDL_PixelFormat sfmt,
SDL_PixelFormat dfmt 
)
static

Definition at line 951 of file SDL_RLEaccel.c.

References d, i, PIXEL_FROM_RGB, and RGBA_FROM_8888.

Referenced by RLEAlphaSurface().

953 {
954  int i;
955  Uint32 *d = dst;
956  for (i = 0; i < n; i++) {
957  unsigned r, g, b, a;
958  Uint16 pix;
959  RGBA_FROM_8888(*src, sfmt, r, g, b, a);
960  PIXEL_FROM_RGB(pix, dfmt, r, g, b);
961  *d = ((pix & 0x3e0) << 16) | (pix & 0xfc1f) | ((a << 2) & 0x3e0);
962  src++;
963  d++;
964  }
965  return n * 4;
966 }
GLenum GLenum dst
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2072
GLdouble n
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLboolean GLboolean g
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
#define RGBA_FROM_8888(Pixel, fmt, r, g, b, a)
Definition: SDL_blit.h:310
#define PIXEL_FROM_RGB(Pixel, fmt, r, g, b)
Definition: SDL_blit.h:217
GLboolean GLboolean GLboolean GLboolean a
GLenum src
GLboolean GLboolean GLboolean b

◆ copy_transl_565()

static int copy_transl_565 ( void dst,
Uint32 src,
int  n,
SDL_PixelFormat sfmt,
SDL_PixelFormat dfmt 
)
static

Definition at line 932 of file SDL_RLEaccel.c.

References d, i, PIXEL_FROM_RGB, and RGBA_FROM_8888.

Referenced by RLEAlphaSurface().

934 {
935  int i;
936  Uint32 *d = dst;
937  for (i = 0; i < n; i++) {
938  unsigned r, g, b, a;
939  Uint16 pix;
940  RGBA_FROM_8888(*src, sfmt, r, g, b, a);
941  PIXEL_FROM_RGB(pix, dfmt, r, g, b);
942  *d = ((pix & 0x7e0) << 16) | (pix & 0xf81f) | ((a << 2) & 0x7e0);
943  src++;
944  d++;
945  }
946  return n * 4;
947 }
GLenum GLenum dst
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2072
GLdouble n
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLboolean GLboolean g
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
#define RGBA_FROM_8888(Pixel, fmt, r, g, b, a)
Definition: SDL_blit.h:310
#define PIXEL_FROM_RGB(Pixel, fmt, r, g, b)
Definition: SDL_blit.h:217
GLboolean GLboolean GLboolean GLboolean a
GLenum src
GLboolean GLboolean GLboolean b

◆ getpix_16()

static Uint32 getpix_16 ( Uint8 srcbuf)
static

Definition at line 1248 of file SDL_RLEaccel.c.

1249 {
1250  return *(Uint16 *) srcbuf;
1251 }
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151

◆ getpix_24()

static Uint32 getpix_24 ( Uint8 srcbuf)
static

Definition at line 1254 of file SDL_RLEaccel.c.

1255 {
1256 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
1257  return srcbuf[0] + (srcbuf[1] << 8) + (srcbuf[2] << 16);
1258 #else
1259  return (srcbuf[0] << 16) + (srcbuf[1] << 8) + srcbuf[2];
1260 #endif
1261 }

◆ getpix_32()

static Uint32 getpix_32 ( Uint8 srcbuf)
static

Definition at line 1264 of file SDL_RLEaccel.c.

1265 {
1266  return *(Uint32 *) srcbuf;
1267 }
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159

◆ getpix_8()

static Uint32 getpix_8 ( Uint8 srcbuf)
static

Definition at line 1242 of file SDL_RLEaccel.c.

1243 {
1244  return *srcbuf;
1245 }

◆ RLEAlphaClipBlit()

static void RLEAlphaClipBlit ( int  w,
Uint8 srcbuf,
SDL_Surface surf_dst,
Uint8 dstbuf,
SDL_Rect srcrect 
)
static

Definition at line 638 of file SDL_RLEaccel.c.

References BLIT_TRANSL_555, BLIT_TRANSL_565, BLIT_TRANSL_888, SDL_PixelFormat::Bmask, SDL_PixelFormat::BytesPerPixel, SDL_Surface::format, SDL_PixelFormat::Gmask, RLEALPHACLIPBLIT, and SDL_PixelFormat::Rmask.

Referenced by SDL_RLEAlphaBlit().

640 {
641  SDL_PixelFormat *df = surf_dst->format;
642  /*
643  * clipped blitter: Ptype is the destination pixel type,
644  * Ctype the translucent count type, and do_blend the macro
645  * to blend one pixel.
646  */
647 #define RLEALPHACLIPBLIT(Ptype, Ctype, do_blend) \
648  do { \
649  int linecount = srcrect->h; \
650  int left = srcrect->x; \
651  int right = left + srcrect->w; \
652  dstbuf -= left * sizeof(Ptype); \
653  do { \
654  int ofs = 0; \
655  /* blit opaque pixels on one line */ \
656  do { \
657  unsigned run; \
658  ofs += ((Ctype *)srcbuf)[0]; \
659  run = ((Ctype *)srcbuf)[1]; \
660  srcbuf += 2 * sizeof(Ctype); \
661  if(run) { \
662  /* clip to left and right borders */ \
663  int cofs = ofs; \
664  int crun = run; \
665  if(left - cofs > 0) { \
666  crun -= left - cofs; \
667  cofs = left; \
668  } \
669  if(crun > right - cofs) \
670  crun = right - cofs; \
671  if(crun > 0) \
672  PIXEL_COPY(dstbuf + cofs * sizeof(Ptype), \
673  srcbuf + (cofs - ofs) * sizeof(Ptype), \
674  (unsigned)crun, sizeof(Ptype)); \
675  srcbuf += run * sizeof(Ptype); \
676  ofs += run; \
677  } else if(!ofs) \
678  return; \
679  } while(ofs < w); \
680  /* skip padding if necessary */ \
681  if(sizeof(Ptype) == 2) \
682  srcbuf += (uintptr_t)srcbuf & 2; \
683  /* blit translucent pixels on the same line */ \
684  ofs = 0; \
685  do { \
686  unsigned run; \
687  ofs += ((Uint16 *)srcbuf)[0]; \
688  run = ((Uint16 *)srcbuf)[1]; \
689  srcbuf += 4; \
690  if(run) { \
691  /* clip to left and right borders */ \
692  int cofs = ofs; \
693  int crun = run; \
694  if(left - cofs > 0) { \
695  crun -= left - cofs; \
696  cofs = left; \
697  } \
698  if(crun > right - cofs) \
699  crun = right - cofs; \
700  if(crun > 0) { \
701  Ptype *dst = (Ptype *)dstbuf + cofs; \
702  Uint32 *src = (Uint32 *)srcbuf + (cofs - ofs); \
703  int i; \
704  for(i = 0; i < crun; i++) \
705  do_blend(src[i], dst[i]); \
706  } \
707  srcbuf += run * 4; \
708  ofs += run; \
709  } \
710  } while(ofs < w); \
711  dstbuf += surf_dst->pitch; \
712  } while(--linecount); \
713  } while(0)
714 
715  switch (df->BytesPerPixel) {
716  case 2:
717  if (df->Gmask == 0x07e0 || df->Rmask == 0x07e0 || df->Bmask == 0x07e0)
719  else
721  break;
722  case 4:
724  break;
725  }
726 }
#define BLIT_TRANSL_555(src, dst)
Definition: SDL_RLEaccel.c:604
Uint8 BytesPerPixel
Definition: SDL_pixels.h:318
#define RLEALPHACLIPBLIT(Ptype, Ctype, do_blend)
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
SDL_PixelFormat * format
Definition: SDL_surface.h:72
#define BLIT_TRANSL_565(src, dst)
Definition: SDL_RLEaccel.c:592
#define BLIT_TRANSL_888(src, dst)
Definition: SDL_RLEaccel.c:574
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151

◆ RLEAlphaSurface()

static int RLEAlphaSurface ( SDL_Surface surface)
static

Definition at line 1029 of file SDL_RLEaccel.c.

References ADD_OPAQUE_COUNTS, ADD_TRANSL_COUNTS, SDL_PixelFormat::Aloss, RLEDestFormat::Aloss, SDL_PixelFormat::Amask, RLEDestFormat::Amask, SDL_PixelFormat::Ashift, RLEDestFormat::Ashift, SDL_PixelFormat::BitsPerPixel, SDL_PixelFormat::Bloss, RLEDestFormat::Bloss, SDL_PixelFormat::Bmask, RLEDestFormat::Bmask, SDL_PixelFormat::Bshift, RLEDestFormat::Bshift, SDL_PixelFormat::BytesPerPixel, RLEDestFormat::BytesPerPixel, copy_32(), copy_opaque_16(), copy_transl_555(), copy_transl_565(), SDL_BlitMap::data, SDL_BlitMap::dst, SDL_Surface::flags, SDL_Surface::format, SDL_PixelFormat::Gloss, RLEDestFormat::Gloss, SDL_PixelFormat::Gmask, RLEDestFormat::Gmask, SDL_PixelFormat::Gshift, RLEDestFormat::Gshift, SDL_Surface::h, ISOPAQUE, ISTRANSL, SDL_Surface::map, MIN, NULL, SDL_Surface::pitch, SDL_Surface::pixels, SDL_PixelFormat::Rloss, RLEDestFormat::Rloss, SDL_PixelFormat::Rmask, RLEDestFormat::Rmask, SDL_PixelFormat::Rshift, RLEDestFormat::Rshift, SDL_free(), SDL_malloc, SDL_OutOfMemory, SDL_PREALLOC, SDL_realloc, and SDL_Surface::w.

Referenced by SDL_RLESurface().

1030 {
1031  SDL_Surface *dest;
1032  SDL_PixelFormat *df;
1033  int maxsize = 0;
1034  int max_opaque_run;
1035  int max_transl_run = 65535;
1036  unsigned masksum;
1037  Uint8 *rlebuf, *dst;
1038  int (*copy_opaque) (void *, Uint32 *, int,
1039  SDL_PixelFormat *, SDL_PixelFormat *);
1040  int (*copy_transl) (void *, Uint32 *, int,
1041  SDL_PixelFormat *, SDL_PixelFormat *);
1042 
1043  dest = surface->map->dst;
1044  if (!dest)
1045  return -1;
1046  df = dest->format;
1047  if (surface->format->BitsPerPixel != 32)
1048  return -1; /* only 32bpp source supported */
1049 
1050  /* find out whether the destination is one we support,
1051  and determine the max size of the encoded result */
1052  masksum = df->Rmask | df->Gmask | df->Bmask;
1053  switch (df->BytesPerPixel) {
1054  case 2:
1055  /* 16bpp: only support 565 and 555 formats */
1056  switch (masksum) {
1057  case 0xffff:
1058  if (df->Gmask == 0x07e0
1059  || df->Rmask == 0x07e0 || df->Bmask == 0x07e0) {
1060  copy_opaque = copy_opaque_16;
1061  copy_transl = copy_transl_565;
1062  } else
1063  return -1;
1064  break;
1065  case 0x7fff:
1066  if (df->Gmask == 0x03e0
1067  || df->Rmask == 0x03e0 || df->Bmask == 0x03e0) {
1068  copy_opaque = copy_opaque_16;
1069  copy_transl = copy_transl_555;
1070  } else
1071  return -1;
1072  break;
1073  default:
1074  return -1;
1075  }
1076  max_opaque_run = 255; /* runs stored as bytes */
1077 
1078  /* worst case is alternating opaque and translucent pixels,
1079  with room for alignment padding between lines */
1080  maxsize = surface->h * (2 + (4 + 2) * (surface->w + 1)) + 2;
1081  break;
1082  case 4:
1083  if (masksum != 0x00ffffff)
1084  return -1; /* requires unused high byte */
1085  copy_opaque = copy_32;
1086  copy_transl = copy_32;
1087  max_opaque_run = 255; /* runs stored as short ints */
1088 
1089  /* worst case is alternating opaque and translucent pixels */
1090  maxsize = surface->h * 2 * 4 * (surface->w + 1) + 4;
1091  break;
1092  default:
1093  return -1; /* anything else unsupported right now */
1094  }
1095 
1096  maxsize += sizeof(RLEDestFormat);
1097  rlebuf = (Uint8 *) SDL_malloc(maxsize);
1098  if (!rlebuf) {
1099  return SDL_OutOfMemory();
1100  }
1101  {
1102  /* save the destination format so we can undo the encoding later */
1103  RLEDestFormat *r = (RLEDestFormat *) rlebuf;
1104  r->BytesPerPixel = df->BytesPerPixel;
1105  r->Rmask = df->Rmask;
1106  r->Gmask = df->Gmask;
1107  r->Bmask = df->Bmask;
1108  r->Amask = df->Amask;
1109  r->Rloss = df->Rloss;
1110  r->Gloss = df->Gloss;
1111  r->Bloss = df->Bloss;
1112  r->Aloss = df->Aloss;
1113  r->Rshift = df->Rshift;
1114  r->Gshift = df->Gshift;
1115  r->Bshift = df->Bshift;
1116  r->Ashift = df->Ashift;
1117  }
1118  dst = rlebuf + sizeof(RLEDestFormat);
1119 
1120  /* Do the actual encoding */
1121  {
1122  int x, y;
1123  int h = surface->h, w = surface->w;
1124  SDL_PixelFormat *sf = surface->format;
1125  Uint32 *src = (Uint32 *) surface->pixels;
1126  Uint8 *lastline = dst; /* end of last non-blank line */
1127 
1128  /* opaque counts are 8 or 16 bits, depending on target depth */
1129 #define ADD_OPAQUE_COUNTS(n, m) \
1130  if(df->BytesPerPixel == 4) { \
1131  ((Uint16 *)dst)[0] = n; \
1132  ((Uint16 *)dst)[1] = m; \
1133  dst += 4; \
1134  } else { \
1135  dst[0] = n; \
1136  dst[1] = m; \
1137  dst += 2; \
1138  }
1139 
1140  /* translucent counts are always 16 bit */
1141 #define ADD_TRANSL_COUNTS(n, m) \
1142  (((Uint16 *)dst)[0] = n, ((Uint16 *)dst)[1] = m, dst += 4)
1143 
1144  for (y = 0; y < h; y++) {
1145  int runstart, skipstart;
1146  int blankline = 0;
1147  /* First encode all opaque pixels of a scan line */
1148  x = 0;
1149  do {
1150  int run, skip, len;
1151  skipstart = x;
1152  while (x < w && !ISOPAQUE(src[x], sf))
1153  x++;
1154  runstart = x;
1155  while (x < w && ISOPAQUE(src[x], sf))
1156  x++;
1157  skip = runstart - skipstart;
1158  if (skip == w)
1159  blankline = 1;
1160  run = x - runstart;
1161  while (skip > max_opaque_run) {
1162  ADD_OPAQUE_COUNTS(max_opaque_run, 0);
1163  skip -= max_opaque_run;
1164  }
1165  len = MIN(run, max_opaque_run);
1166  ADD_OPAQUE_COUNTS(skip, len);
1167  dst += copy_opaque(dst, src + runstart, len, sf, df);
1168  runstart += len;
1169  run -= len;
1170  while (run) {
1171  len = MIN(run, max_opaque_run);
1172  ADD_OPAQUE_COUNTS(0, len);
1173  dst += copy_opaque(dst, src + runstart, len, sf, df);
1174  runstart += len;
1175  run -= len;
1176  }
1177  } while (x < w);
1178 
1179  /* Make sure the next output address is 32-bit aligned */
1180  dst += (uintptr_t) dst & 2;
1181 
1182  /* Next, encode all translucent pixels of the same scan line */
1183  x = 0;
1184  do {
1185  int run, skip, len;
1186  skipstart = x;
1187  while (x < w && !ISTRANSL(src[x], sf))
1188  x++;
1189  runstart = x;
1190  while (x < w && ISTRANSL(src[x], sf))
1191  x++;
1192  skip = runstart - skipstart;
1193  blankline &= (skip == w);
1194  run = x - runstart;
1195  while (skip > max_transl_run) {
1196  ADD_TRANSL_COUNTS(max_transl_run, 0);
1197  skip -= max_transl_run;
1198  }
1199  len = MIN(run, max_transl_run);
1200  ADD_TRANSL_COUNTS(skip, len);
1201  dst += copy_transl(dst, src + runstart, len, sf, df);
1202  runstart += len;
1203  run -= len;
1204  while (run) {
1205  len = MIN(run, max_transl_run);
1206  ADD_TRANSL_COUNTS(0, len);
1207  dst += copy_transl(dst, src + runstart, len, sf, df);
1208  runstart += len;
1209  run -= len;
1210  }
1211  if (!blankline)
1212  lastline = dst;
1213  } while (x < w);
1214 
1215  src += surface->pitch >> 2;
1216  }
1217  dst = lastline; /* back up past trailing blank lines */
1218  ADD_OPAQUE_COUNTS(0, 0);
1219  }
1220 
1221 #undef ADD_OPAQUE_COUNTS
1222 #undef ADD_TRANSL_COUNTS
1223 
1224  /* Now that we have it encoded, release the original pixels */
1225  if (!(surface->flags & SDL_PREALLOC)) {
1226  SDL_free(surface->pixels);
1227  surface->pixels = NULL;
1228  }
1229 
1230  /* realloc the buffer to release unused memory */
1231  {
1232  Uint8 *p = SDL_realloc(rlebuf, dst - rlebuf);
1233  if (!p)
1234  p = rlebuf;
1235  surface->map->data = p;
1236  }
1237 
1238  return 0;
1239 }
static int copy_transl_555(void *dst, Uint32 *src, int n, SDL_PixelFormat *sfmt, SDL_PixelFormat *dfmt)
Definition: SDL_RLEaccel.c:951
GLenum GLenum dst
static int copy_transl_565(void *dst, Uint32 *src, int n, SDL_PixelFormat *sfmt, SDL_PixelFormat *dfmt)
Definition: SDL_RLEaccel.c:932
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2072
GLdouble n
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
Uint8 BytesPerPixel
Definition: SDL_pixels.h:318
const GLfloat * m
GLfloat GLfloat p
A collection of pixels used in software blitting.
Definition: SDL_surface.h:69
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
#define SDL_realloc
GLenum GLsizei len
#define ADD_OPAQUE_COUNTS(n, m)
Uint32 flags
Definition: SDL_surface.h:71
struct SDL_BlitMap * map
Definition: SDL_surface.h:88
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
void * pixels
Definition: SDL_surface.h:75
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
Uint8 BitsPerPixel
Definition: SDL_pixels.h:317
void SDL_free(void *mem)
static int copy_32(void *dst, Uint32 *src, int n, SDL_PixelFormat *sfmt, SDL_PixelFormat *dfmt)
Definition: SDL_RLEaccel.c:989
Uint8 BytesPerPixel
Definition: SDL_RLEaccel.c:620
unsigned int uintptr_t
SDL_Surface * dst
Definition: SDL_blit.h:87
#define NULL
Definition: begin_code.h:143
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_PixelFormat * format
Definition: SDL_surface.h:72
#define ADD_TRANSL_COUNTS(n, m)
static int copy_opaque_16(void *dst, Uint32 *src, int n, SDL_PixelFormat *sfmt, SDL_PixelFormat *dfmt)
Definition: SDL_RLEaccel.c:895
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
void * data
Definition: SDL_blit.h:90
#define SDL_malloc
#define ISTRANSL(pixel, fmt)
GLubyte GLubyte GLubyte GLubyte w
#define MIN(a, b)
Definition: SDL_RLEaccel.c:97
GLenum src
GLfloat GLfloat GLfloat GLfloat h
#define ISOPAQUE(pixel, fmt)
#define SDL_PREALLOC
Definition: SDL_surface.h:53

◆ RLEClipBlit()

static void RLEClipBlit ( int  w,
Uint8 srcbuf,
SDL_Surface surf_dst,
Uint8 dstbuf,
SDL_Rect srcrect,
unsigned  alpha 
)
static

Definition at line 393 of file SDL_RLEaccel.c.

References CHOOSE_BLIT, SDL_Surface::format, and RLECLIPBLIT.

Referenced by SDL_RLEBlit().

395 {
396  SDL_PixelFormat *fmt = surf_dst->format;
397 
398 #define RLECLIPBLIT(bpp, Type, do_blit) \
399  do { \
400  int linecount = srcrect->h; \
401  int ofs = 0; \
402  int left = srcrect->x; \
403  int right = left + srcrect->w; \
404  dstbuf -= left * bpp; \
405  for (;;) { \
406  int run; \
407  ofs += *(Type *)srcbuf; \
408  run = ((Type *)srcbuf)[1]; \
409  srcbuf += 2 * sizeof(Type); \
410  if (run) { \
411  /* clip to left and right borders */ \
412  if (ofs < right) { \
413  int start = 0; \
414  int len = run; \
415  int startcol; \
416  if (left - ofs > 0) { \
417  start = left - ofs; \
418  len -= start; \
419  if (len <= 0) \
420  goto nocopy ## bpp ## do_blit; \
421  } \
422  startcol = ofs + start; \
423  if (len > right - startcol) \
424  len = right - startcol; \
425  do_blit(dstbuf + startcol * bpp, srcbuf + start * bpp, \
426  len, bpp, alpha); \
427  } \
428  nocopy ## bpp ## do_blit: \
429  srcbuf += run * bpp; \
430  ofs += run; \
431  } else if (!ofs) \
432  break; \
433  \
434  if (ofs == w) { \
435  ofs = 0; \
436  dstbuf += surf_dst->pitch; \
437  if (!--linecount) \
438  break; \
439  } \
440  } \
441  } while(0)
442 
444 
445 #undef RLECLIPBLIT
446 
447 }
#define CHOOSE_BLIT(blitter, alpha, fmt)
Definition: SDL_RLEaccel.c:306
GLfloat GLfloat GLfloat alpha
#define RLECLIPBLIT(bpp, Type, do_blit)
SDL_PixelFormat * format
Definition: SDL_surface.h:72

◆ RLEColorkeySurface()

static int RLEColorkeySurface ( SDL_Surface surface)
static

Definition at line 1276 of file SDL_RLEaccel.c.

References ADD_COUNTS, SDL_PixelFormat::Amask, bpp, SDL_PixelFormat::BytesPerPixel, SDL_BlitInfo::colorkey, SDL_BlitMap::data, SDL_Surface::flags, SDL_Surface::format, getpixes, SDL_Surface::h, SDL_BlitMap::info, SDL_Surface::map, MIN, NULL, SDL_Surface::pitch, SDL_Surface::pixels, SDL_free(), SDL_malloc, SDL_memcpy, SDL_OutOfMemory, SDL_PREALLOC, SDL_realloc, and SDL_Surface::w.

Referenced by SDL_RLESurface().

1277 {
1278  Uint8 *rlebuf, *dst;
1279  int maxn;
1280  int y;
1281  Uint8 *srcbuf, *lastline;
1282  int maxsize = 0;
1283  int bpp = surface->format->BytesPerPixel;
1284  getpix_func getpix;
1285  Uint32 ckey, rgbmask;
1286  int w, h;
1287 
1288  /* calculate the worst case size for the compressed surface */
1289  switch (bpp) {
1290  case 1:
1291  /* worst case is alternating opaque and transparent pixels,
1292  starting with an opaque pixel */
1293  maxsize = surface->h * 3 * (surface->w / 2 + 1) + 2;
1294  break;
1295  case 2:
1296  case 3:
1297  /* worst case is solid runs, at most 255 pixels wide */
1298  maxsize = surface->h * (2 * (surface->w / 255 + 1)
1299  + surface->w * bpp) + 2;
1300  break;
1301  case 4:
1302  /* worst case is solid runs, at most 65535 pixels wide */
1303  maxsize = surface->h * (4 * (surface->w / 65535 + 1)
1304  + surface->w * 4) + 4;
1305  break;
1306  }
1307 
1308  rlebuf = (Uint8 *) SDL_malloc(maxsize);
1309  if (rlebuf == NULL) {
1310  return SDL_OutOfMemory();
1311  }
1312 
1313  /* Set up the conversion */
1314  srcbuf = (Uint8 *) surface->pixels;
1315  maxn = bpp == 4 ? 65535 : 255;
1316  dst = rlebuf;
1317  rgbmask = ~surface->format->Amask;
1318  ckey = surface->map->info.colorkey & rgbmask;
1319  lastline = dst;
1320  getpix = getpixes[bpp - 1];
1321  w = surface->w;
1322  h = surface->h;
1323 
1324 #define ADD_COUNTS(n, m) \
1325  if(bpp == 4) { \
1326  ((Uint16 *)dst)[0] = n; \
1327  ((Uint16 *)dst)[1] = m; \
1328  dst += 4; \
1329  } else { \
1330  dst[0] = n; \
1331  dst[1] = m; \
1332  dst += 2; \
1333  }
1334 
1335  for (y = 0; y < h; y++) {
1336  int x = 0;
1337  int blankline = 0;
1338  do {
1339  int run, skip, len;
1340  int runstart;
1341  int skipstart = x;
1342 
1343  /* find run of transparent, then opaque pixels */
1344  while (x < w && (getpix(srcbuf + x * bpp) & rgbmask) == ckey)
1345  x++;
1346  runstart = x;
1347  while (x < w && (getpix(srcbuf + x * bpp) & rgbmask) != ckey)
1348  x++;
1349  skip = runstart - skipstart;
1350  if (skip == w)
1351  blankline = 1;
1352  run = x - runstart;
1353 
1354  /* encode segment */
1355  while (skip > maxn) {
1356  ADD_COUNTS(maxn, 0);
1357  skip -= maxn;
1358  }
1359  len = MIN(run, maxn);
1360  ADD_COUNTS(skip, len);
1361  SDL_memcpy(dst, srcbuf + runstart * bpp, len * bpp);
1362  dst += len * bpp;
1363  run -= len;
1364  runstart += len;
1365  while (run) {
1366  len = MIN(run, maxn);
1367  ADD_COUNTS(0, len);
1368  SDL_memcpy(dst, srcbuf + runstart * bpp, len * bpp);
1369  dst += len * bpp;
1370  runstart += len;
1371  run -= len;
1372  }
1373  if (!blankline)
1374  lastline = dst;
1375  } while (x < w);
1376 
1377  srcbuf += surface->pitch;
1378  }
1379  dst = lastline; /* back up bast trailing blank lines */
1380  ADD_COUNTS(0, 0);
1381 
1382 #undef ADD_COUNTS
1383 
1384  /* Now that we have it encoded, release the original pixels */
1385  if (!(surface->flags & SDL_PREALLOC)) {
1386  SDL_free(surface->pixels);
1387  surface->pixels = NULL;
1388  }
1389 
1390  /* realloc the buffer to release unused memory */
1391  {
1392  /* If realloc returns NULL, the original block is left intact */
1393  Uint8 *p = SDL_realloc(rlebuf, dst - rlebuf);
1394  if (!p)
1395  p = rlebuf;
1396  surface->map->data = p;
1397  }
1398 
1399  return (0);
1400 }
GLenum GLenum dst
GLdouble n
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
Uint8 BytesPerPixel
Definition: SDL_pixels.h:318
const GLfloat * m
Uint32(* getpix_func)(Uint8 *)
GLfloat GLfloat p
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
#define SDL_realloc
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp
GLenum GLsizei len
Uint32 colorkey
Definition: SDL_blit.h:69
Uint32 flags
Definition: SDL_surface.h:71
struct SDL_BlitMap * map
Definition: SDL_surface.h:88
#define SDL_memcpy
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
void * pixels
Definition: SDL_surface.h:75
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
void SDL_free(void *mem)
#define ADD_COUNTS(n, m)
static const getpix_func getpixes[4]
#define NULL
Definition: begin_code.h:143
#define SDL_OutOfMemory()
Definition: SDL_error.h:52
SDL_PixelFormat * format
Definition: SDL_surface.h:72
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
void * data
Definition: SDL_blit.h:90
#define SDL_malloc
GLubyte GLubyte GLubyte GLubyte w
#define MIN(a, b)
Definition: SDL_RLEaccel.c:97
GLfloat GLfloat GLfloat GLfloat h
SDL_BlitInfo info
Definition: SDL_blit.h:91
#define SDL_PREALLOC
Definition: SDL_surface.h:53

◆ SDL_RLEAlphaBlit()

int SDL_RLEAlphaBlit ( SDL_Surface surf_src,
SDL_Rect srcrect,
SDL_Surface surf_dst,
SDL_Rect dstrect 
)

Definition at line 730 of file SDL_RLEaccel.c.

References BLIT_TRANSL_555, BLIT_TRANSL_565, BLIT_TRANSL_888, SDL_PixelFormat::Bmask, SDL_PixelFormat::BytesPerPixel, SDL_BlitMap::data, done, SDL_Surface::format, SDL_PixelFormat::Gmask, SDL_Surface::map, SDL_Surface::pitch, SDL_Surface::pixels, RLEALPHABLIT, RLEAlphaClipBlit(), SDL_PixelFormat::Rmask, SDL_LockSurface, SDL_MUSTLOCK, SDL_UnlockSurface, SDL_Rect::w, SDL_Surface::w, SDL_Rect::x, and SDL_Rect::y.

Referenced by SDL_RLESurface().

732 {
733  int x, y;
734  int w = surf_src->w;
735  Uint8 *srcbuf, *dstbuf;
736  SDL_PixelFormat *df = surf_dst->format;
737 
738  /* Lock the destination if necessary */
739  if (SDL_MUSTLOCK(surf_dst)) {
740  if (SDL_LockSurface(surf_dst) < 0) {
741  return -1;
742  }
743  }
744 
745  x = dstrect->x;
746  y = dstrect->y;
747  dstbuf = (Uint8 *) surf_dst->pixels + y * surf_dst->pitch + x * df->BytesPerPixel;
748  srcbuf = (Uint8 *) surf_src->map->data + sizeof(RLEDestFormat);
749 
750  {
751  /* skip lines at the top if necessary */
752  int vskip = srcrect->y;
753  if (vskip) {
754  int ofs;
755  if (df->BytesPerPixel == 2) {
756  /* the 16/32 interleaved format */
757  do {
758  /* skip opaque line */
759  ofs = 0;
760  do {
761  int run;
762  ofs += srcbuf[0];
763  run = srcbuf[1];
764  srcbuf += 2;
765  if (run) {
766  srcbuf += 2 * run;
767  ofs += run;
768  } else if (!ofs)
769  goto done;
770  } while (ofs < w);
771 
772  /* skip padding */
773  srcbuf += (uintptr_t) srcbuf & 2;
774 
775  /* skip translucent line */
776  ofs = 0;
777  do {
778  int run;
779  ofs += ((Uint16 *) srcbuf)[0];
780  run = ((Uint16 *) srcbuf)[1];
781  srcbuf += 4 * (run + 1);
782  ofs += run;
783  } while (ofs < w);
784  } while (--vskip);
785  } else {
786  /* the 32/32 interleaved format */
787  vskip <<= 1; /* opaque and translucent have same format */
788  do {
789  ofs = 0;
790  do {
791  int run;
792  ofs += ((Uint16 *) srcbuf)[0];
793  run = ((Uint16 *) srcbuf)[1];
794  srcbuf += 4;
795  if (run) {
796  srcbuf += 4 * run;
797  ofs += run;
798  } else if (!ofs)
799  goto done;
800  } while (ofs < w);
801  } while (--vskip);
802  }
803  }
804  }
805 
806  /* if left or right edge clipping needed, call clip blit */
807  if (srcrect->x || srcrect->w != surf_src->w) {
808  RLEAlphaClipBlit(w, srcbuf, surf_dst, dstbuf, srcrect);
809  } else {
810 
811  /*
812  * non-clipped blitter. Ptype is the destination pixel type,
813  * Ctype the translucent count type, and do_blend the
814  * macro to blend one pixel.
815  */
816 #define RLEALPHABLIT(Ptype, Ctype, do_blend) \
817  do { \
818  int linecount = srcrect->h; \
819  do { \
820  int ofs = 0; \
821  /* blit opaque pixels on one line */ \
822  do { \
823  unsigned run; \
824  ofs += ((Ctype *)srcbuf)[0]; \
825  run = ((Ctype *)srcbuf)[1]; \
826  srcbuf += 2 * sizeof(Ctype); \
827  if(run) { \
828  PIXEL_COPY(dstbuf + ofs * sizeof(Ptype), srcbuf, \
829  run, sizeof(Ptype)); \
830  srcbuf += run * sizeof(Ptype); \
831  ofs += run; \
832  } else if(!ofs) \
833  goto done; \
834  } while(ofs < w); \
835  /* skip padding if necessary */ \
836  if(sizeof(Ptype) == 2) \
837  srcbuf += (uintptr_t)srcbuf & 2; \
838  /* blit translucent pixels on the same line */ \
839  ofs = 0; \
840  do { \
841  unsigned run; \
842  ofs += ((Uint16 *)srcbuf)[0]; \
843  run = ((Uint16 *)srcbuf)[1]; \
844  srcbuf += 4; \
845  if(run) { \
846  Ptype *dst = (Ptype *)dstbuf + ofs; \
847  unsigned i; \
848  for(i = 0; i < run; i++) { \
849  Uint32 src = *(Uint32 *)srcbuf; \
850  do_blend(src, *dst); \
851  srcbuf += 4; \
852  dst++; \
853  } \
854  ofs += run; \
855  } \
856  } while(ofs < w); \
857  dstbuf += surf_dst->pitch; \
858  } while(--linecount); \
859  } while(0)
860 
861  switch (df->BytesPerPixel) {
862  case 2:
863  if (df->Gmask == 0x07e0 || df->Rmask == 0x07e0
864  || df->Bmask == 0x07e0)
866  else
868  break;
869  case 4:
871  break;
872  }
873  }
874 
875  done:
876  /* Unlock the destination if necessary */
877  if (SDL_MUSTLOCK(surf_dst)) {
878  SDL_UnlockSurface(surf_dst);
879  }
880  return 0;
881 }
#define SDL_UnlockSurface
#define BLIT_TRANSL_555(src, dst)
Definition: SDL_RLEaccel.c:604
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
Uint8 BytesPerPixel
Definition: SDL_pixels.h:318
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
static void RLEAlphaClipBlit(int w, Uint8 *srcbuf, SDL_Surface *surf_dst, Uint8 *dstbuf, SDL_Rect *srcrect)
Definition: SDL_RLEaccel.c:638
struct SDL_BlitMap * map
Definition: SDL_surface.h:88
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
void * pixels
Definition: SDL_surface.h:75
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
int done
Definition: checkkeys.c:28
unsigned int uintptr_t
int x
Definition: SDL_rect.h:66
int w
Definition: SDL_rect.h:67
SDL_PixelFormat * format
Definition: SDL_surface.h:72
#define SDL_LockSurface
#define RLEALPHABLIT(Ptype, Ctype, do_blend)
#define SDL_MUSTLOCK(S)
Definition: SDL_surface.h:61
#define BLIT_TRANSL_565(src, dst)
Definition: SDL_RLEaccel.c:592
#define BLIT_TRANSL_888(src, dst)
Definition: SDL_RLEaccel.c:574
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
void * data
Definition: SDL_blit.h:90
GLubyte GLubyte GLubyte GLubyte w
int y
Definition: SDL_rect.h:66

◆ SDL_RLEBlit()

int SDL_RLEBlit ( SDL_Surface surf_src,
SDL_Rect srcrect,
SDL_Surface surf_dst,
SDL_Rect dstrect 
)

Definition at line 452 of file SDL_RLEaccel.c.

References SDL_BlitInfo::a, SDL_PixelFormat::BytesPerPixel, CHOOSE_BLIT, SDL_BlitMap::data, done, SDL_Surface::format, SDL_BlitMap::info, SDL_Surface::map, SDL_Surface::pitch, SDL_Surface::pixels, RLEBLIT, RLEClipBlit(), RLESKIP, SDL_LockSurface, SDL_MUSTLOCK, SDL_UnlockSurface, SDL_Rect::w, SDL_Surface::w, SDL_Rect::x, and SDL_Rect::y.

Referenced by SDL_RLESurface(), and SDL_UnRLESurface().

454 {
455  Uint8 *dstbuf;
456  Uint8 *srcbuf;
457  int x, y;
458  int w = surf_src->w;
459  unsigned alpha;
460 
461  /* Lock the destination if necessary */
462  if (SDL_MUSTLOCK(surf_dst)) {
463  if (SDL_LockSurface(surf_dst) < 0) {
464  return (-1);
465  }
466  }
467 
468  /* Set up the source and destination pointers */
469  x = dstrect->x;
470  y = dstrect->y;
471  dstbuf = (Uint8 *) surf_dst->pixels
472  + y * surf_dst->pitch + x * surf_src->format->BytesPerPixel;
473  srcbuf = (Uint8 *) surf_src->map->data;
474 
475  {
476  /* skip lines at the top if necessary */
477  int vskip = srcrect->y;
478  int ofs = 0;
479  if (vskip) {
480 
481 #define RLESKIP(bpp, Type) \
482  for(;;) { \
483  int run; \
484  ofs += *(Type *)srcbuf; \
485  run = ((Type *)srcbuf)[1]; \
486  srcbuf += sizeof(Type) * 2; \
487  if(run) { \
488  srcbuf += run * bpp; \
489  ofs += run; \
490  } else if(!ofs) \
491  goto done; \
492  if(ofs == w) { \
493  ofs = 0; \
494  if(!--vskip) \
495  break; \
496  } \
497  }
498 
499  switch (surf_src->format->BytesPerPixel) {
500  case 1:
501  RLESKIP(1, Uint8);
502  break;
503  case 2:
504  RLESKIP(2, Uint8);
505  break;
506  case 3:
507  RLESKIP(3, Uint8);
508  break;
509  case 4:
510  RLESKIP(4, Uint16);
511  break;
512  }
513 
514 #undef RLESKIP
515 
516  }
517  }
518 
519  alpha = surf_src->map->info.a;
520  /* if left or right edge clipping needed, call clip blit */
521  if (srcrect->x || srcrect->w != surf_src->w) {
522  RLEClipBlit(w, srcbuf, surf_dst, dstbuf, srcrect, alpha);
523  } else {
524  SDL_PixelFormat *fmt = surf_src->format;
525 
526 #define RLEBLIT(bpp, Type, do_blit) \
527  do { \
528  int linecount = srcrect->h; \
529  int ofs = 0; \
530  for(;;) { \
531  unsigned run; \
532  ofs += *(Type *)srcbuf; \
533  run = ((Type *)srcbuf)[1]; \
534  srcbuf += 2 * sizeof(Type); \
535  if(run) { \
536  do_blit(dstbuf + ofs * bpp, srcbuf, run, bpp, alpha); \
537  srcbuf += run * bpp; \
538  ofs += run; \
539  } else if(!ofs) \
540  break; \
541  if(ofs == w) { \
542  ofs = 0; \
543  dstbuf += surf_dst->pitch; \
544  if(!--linecount) \
545  break; \
546  } \
547  } \
548  } while(0)
549 
550  CHOOSE_BLIT(RLEBLIT, alpha, fmt);
551 
552 #undef RLEBLIT
553  }
554 
555  done:
556  /* Unlock the destination if necessary */
557  if (SDL_MUSTLOCK(surf_dst)) {
558  SDL_UnlockSurface(surf_dst);
559  }
560  return (0);
561 }
#define CHOOSE_BLIT(blitter, alpha, fmt)
Definition: SDL_RLEaccel.c:306
#define SDL_UnlockSurface
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
Uint8 BytesPerPixel
Definition: SDL_pixels.h:318
GLfloat GLfloat GLfloat alpha
struct SDL_BlitMap * map
Definition: SDL_surface.h:88
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
void * pixels
Definition: SDL_surface.h:75
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
int done
Definition: checkkeys.c:28
#define RLESKIP(bpp, Type)
int x
Definition: SDL_rect.h:66
static void RLEClipBlit(int w, Uint8 *srcbuf, SDL_Surface *surf_dst, Uint8 *dstbuf, SDL_Rect *srcrect, unsigned alpha)
Definition: SDL_RLEaccel.c:393
int w
Definition: SDL_rect.h:67
SDL_PixelFormat * format
Definition: SDL_surface.h:72
#define SDL_LockSurface
#define SDL_MUSTLOCK(S)
Definition: SDL_surface.h:61
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
void * data
Definition: SDL_blit.h:90
GLubyte GLubyte GLubyte GLubyte w
int y
Definition: SDL_rect.h:66
SDL_BlitInfo info
Definition: SDL_blit.h:91
#define RLEBLIT(bpp, Type, do_blit)
Uint8 a
Definition: SDL_blit.h:70

◆ SDL_RLESurface()

int SDL_RLESurface ( SDL_Surface surface)

Definition at line 1403 of file SDL_RLEaccel.c.

References SDL_PixelFormat::Amask, SDL_PixelFormat::BitsPerPixel, SDL_BlitMap::blit, SDL_BlitInfo::flags, SDL_Surface::flags, SDL_Surface::format, SDL_BlitMap::identity, SDL_BlitMap::info, SDL_Surface::map, SDL_Surface::pixels, RLEAlphaSurface(), RLEColorkeySurface(), SDL_COPY_ADD, SDL_COPY_BLEND, SDL_COPY_COLORKEY, SDL_COPY_MOD, SDL_COPY_MODULATE_ALPHA, SDL_COPY_MODULATE_COLOR, SDL_COPY_NEAREST, SDL_COPY_RLE_ALPHAKEY, SDL_COPY_RLE_COLORKEY, SDL_RLEACCEL, SDL_RLEAlphaBlit(), SDL_RLEBlit(), and SDL_UnRLESurface().

Referenced by SDL_CalculateBlit(), and SDL_UnlockSurface().

1404 {
1405  int flags;
1406 
1407  /* Clear any previous RLE conversion */
1408  if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) {
1409  SDL_UnRLESurface(surface, 1);
1410  }
1411 
1412  /* We don't support RLE encoding of bitmaps */
1413  if (surface->format->BitsPerPixel < 8) {
1414  return -1;
1415  }
1416 
1417  /* Make sure the pixels are available */
1418  if (!surface->pixels) {
1419  return -1;
1420  }
1421 
1422  /* If we don't have colorkey or blending, nothing to do... */
1423  flags = surface->map->info.flags;
1424  if (!(flags & (SDL_COPY_COLORKEY | SDL_COPY_BLEND))) {
1425  return -1;
1426  }
1427 
1428  /* Pass on combinations not supported */
1429  if ((flags & SDL_COPY_MODULATE_COLOR) ||
1430  ((flags & SDL_COPY_MODULATE_ALPHA) && surface->format->Amask) ||
1431  (flags & (SDL_COPY_ADD | SDL_COPY_MOD)) ||
1432  (flags & SDL_COPY_NEAREST)) {
1433  return -1;
1434  }
1435 
1436  /* Encode and set up the blit */
1437  if (!surface->format->Amask || !(flags & SDL_COPY_BLEND)) {
1438  if (!surface->map->identity) {
1439  return -1;
1440  }
1441  if (RLEColorkeySurface(surface) < 0) {
1442  return -1;
1443  }
1444  surface->map->blit = SDL_RLEBlit;
1445  surface->map->info.flags |= SDL_COPY_RLE_COLORKEY;
1446  } else {
1447  if (RLEAlphaSurface(surface) < 0) {
1448  return -1;
1449  }
1450  surface->map->blit = SDL_RLEAlphaBlit;
1451  surface->map->info.flags |= SDL_COPY_RLE_ALPHAKEY;
1452  }
1453 
1454  /* The surface is now accelerated */
1455  surface->flags |= SDL_RLEACCEL;
1456 
1457  return (0);
1458 }
#define SDL_COPY_MODULATE_COLOR
Definition: SDL_blit.h:34
#define SDL_COPY_COLORKEY
Definition: SDL_blit.h:39
SDL_blit blit
Definition: SDL_blit.h:89
#define SDL_COPY_MOD
Definition: SDL_blit.h:38
void SDL_UnRLESurface(SDL_Surface *surface, int recode)
#define SDL_COPY_RLE_COLORKEY
Definition: SDL_blit.h:42
int SDL_RLEBlit(SDL_Surface *surf_src, SDL_Rect *srcrect, SDL_Surface *surf_dst, SDL_Rect *dstrect)
Definition: SDL_RLEaccel.c:452
#define SDL_COPY_ADD
Definition: SDL_blit.h:37
Uint32 flags
Definition: SDL_surface.h:71
#define SDL_COPY_NEAREST
Definition: SDL_blit.h:40
struct SDL_BlitMap * map
Definition: SDL_surface.h:88
void * pixels
Definition: SDL_surface.h:75
Uint8 BitsPerPixel
Definition: SDL_pixels.h:317
int SDL_RLEAlphaBlit(SDL_Surface *surf_src, SDL_Rect *srcrect, SDL_Surface *surf_dst, SDL_Rect *dstrect)
Definition: SDL_RLEaccel.c:730
static int RLEColorkeySurface(SDL_Surface *surface)
SDL_PixelFormat * format
Definition: SDL_surface.h:72
#define SDL_COPY_MODULATE_ALPHA
Definition: SDL_blit.h:35
#define SDL_COPY_RLE_ALPHAKEY
Definition: SDL_blit.h:43
static int RLEAlphaSurface(SDL_Surface *surface)
GLbitfield flags
int identity
Definition: SDL_blit.h:88
#define SDL_COPY_BLEND
Definition: SDL_blit.h:36
SDL_BlitInfo info
Definition: SDL_blit.h:91
#define SDL_RLEACCEL
Definition: SDL_surface.h:54

◆ SDL_UnRLESurface()

void SDL_UnRLESurface ( SDL_Surface surface,
int  recode 
)

Definition at line 1540 of file SDL_RLEaccel.c.

References SDL_BlitInfo::colorkey, SDL_BlitMap::data, SDL_BlitInfo::flags, SDL_Surface::flags, SDL_Rect::h, SDL_Surface::h, SDL_BlitMap::info, SDL_Surface::map, NULL, SDL_Surface::pitch, SDL_Surface::pixels, SDL_COPY_RLE_ALPHAKEY, SDL_COPY_RLE_COLORKEY, SDL_FillRect, SDL_free(), SDL_malloc, SDL_PREALLOC, SDL_RLEACCEL, SDL_RLEBlit(), UnRLEAlpha(), SDL_Rect::w, SDL_Surface::w, SDL_Rect::x, and SDL_Rect::y.

Referenced by SDL_CalculateBlit(), SDL_FreeSurface(), SDL_LockSurface(), SDL_MapSurface(), and SDL_RLESurface().

1541 {
1542  if (surface->flags & SDL_RLEACCEL) {
1543  surface->flags &= ~SDL_RLEACCEL;
1544 
1545  if (recode && !(surface->flags & SDL_PREALLOC)) {
1546  if (surface->map->info.flags & SDL_COPY_RLE_COLORKEY) {
1547  SDL_Rect full;
1548 
1549  /* re-create the original surface */
1550  surface->pixels = SDL_malloc(surface->h * surface->pitch);
1551  if (!surface->pixels) {
1552  /* Oh crap... */
1553  surface->flags |= SDL_RLEACCEL;
1554  return;
1555  }
1556 
1557  /* fill it with the background color */
1558  SDL_FillRect(surface, NULL, surface->map->info.colorkey);
1559 
1560  /* now render the encoded surface */
1561  full.x = full.y = 0;
1562  full.w = surface->w;
1563  full.h = surface->h;
1564  SDL_RLEBlit(surface, &full, surface, &full);
1565  } else {
1566  if (!UnRLEAlpha(surface)) {
1567  /* Oh crap... */
1568  surface->flags |= SDL_RLEACCEL;
1569  return;
1570  }
1571  }
1572  }
1573  surface->map->info.flags &=
1575 
1576  SDL_free(surface->map->data);
1577  surface->map->data = NULL;
1578  }
1579 }
#define SDL_COPY_RLE_COLORKEY
Definition: SDL_blit.h:42
int SDL_RLEBlit(SDL_Surface *surf_src, SDL_Rect *srcrect, SDL_Surface *surf_dst, SDL_Rect *dstrect)
Definition: SDL_RLEaccel.c:452
Uint32 colorkey
Definition: SDL_blit.h:69
Uint32 flags
Definition: SDL_surface.h:71
struct SDL_BlitMap * map
Definition: SDL_surface.h:88
void * pixels
Definition: SDL_surface.h:75
void SDL_free(void *mem)
int x
Definition: SDL_rect.h:66
int w
Definition: SDL_rect.h:67
#define NULL
Definition: begin_code.h:143
static SDL_bool UnRLEAlpha(SDL_Surface *surface)
int h
Definition: SDL_rect.h:67
#define SDL_COPY_RLE_ALPHAKEY
Definition: SDL_blit.h:43
#define SDL_FillRect
void * data
Definition: SDL_blit.h:90
#define SDL_malloc
int y
Definition: SDL_rect.h:66
SDL_BlitInfo info
Definition: SDL_blit.h:91
#define SDL_PREALLOC
Definition: SDL_surface.h:53
A rectangle, with the origin at the upper left.
Definition: SDL_rect.h:64
#define SDL_RLEACCEL
Definition: SDL_surface.h:54

◆ uncopy_32()

static int uncopy_32 ( Uint32 dst,
void src,
int  n,
RLEDestFormat sfmt,
SDL_PixelFormat dfmt 
)
static

Definition at line 1006 of file SDL_RLEaccel.c.

References i, PIXEL_FROM_RGBA, and RGB_FROM_PIXEL.

Referenced by UnRLEAlpha().

1008 {
1009  int i;
1010  Uint32 *s = src;
1011  for (i = 0; i < n; i++) {
1012  unsigned r, g, b, a;
1013  Uint32 pixel = *s++;
1014  RGB_FROM_PIXEL(pixel, sfmt, r, g, b);
1015  a = pixel >> 24;
1016  PIXEL_FROM_RGBA(*dst, dfmt, r, g, b, a);
1017  dst++;
1018  }
1019  return n * 4;
1020 }
GLenum GLenum dst
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2072
GLdouble s
Definition: SDL_opengl.h:2056
GLdouble n
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLboolean GLboolean g
#define PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a)
Definition: SDL_blit.h:394
#define RGB_FROM_PIXEL(Pixel, fmt, r, g, b)
Definition: SDL_blit.h:121
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
GLboolean GLboolean GLboolean GLboolean a
GLenum src
GLboolean GLboolean GLboolean b

◆ uncopy_opaque_16()

static int uncopy_opaque_16 ( Uint32 dst,
void src,
int  n,
RLEDestFormat sfmt,
SDL_PixelFormat dfmt 
)
static

Definition at line 912 of file SDL_RLEaccel.c.

References SDL_PixelFormat::Amask, i, PIXEL_FROM_RGBA, and RGB_FROM_PIXEL.

Referenced by UnRLEAlpha().

914 {
915  int i;
916  Uint16 *s = src;
917  unsigned alpha = dfmt->Amask ? 255 : 0;
918  for (i = 0; i < n; i++) {
919  unsigned r, g, b;
920  RGB_FROM_PIXEL(*s, sfmt, r, g, b);
921  PIXEL_FROM_RGBA(*dst, dfmt, r, g, b, alpha);
922  s++;
923  dst++;
924  }
925  return n * 2;
926 }
GLenum GLenum dst
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2072
GLdouble s
Definition: SDL_opengl.h:2056
GLdouble n
GLfloat GLfloat GLfloat alpha
GLboolean GLboolean g
#define PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a)
Definition: SDL_blit.h:394
#define RGB_FROM_PIXEL(Pixel, fmt, r, g, b)
Definition: SDL_blit.h:121
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
GLenum src
GLboolean GLboolean GLboolean b

◆ uncopy_transl_16()

static int uncopy_transl_16 ( Uint32 dst,
void src,
int  n,
RLEDestFormat sfmt,
SDL_PixelFormat dfmt 
)
static

Definition at line 970 of file SDL_RLEaccel.c.

References i, PIXEL_FROM_RGBA, and RGB_FROM_PIXEL.

Referenced by UnRLEAlpha().

972 {
973  int i;
974  Uint32 *s = src;
975  for (i = 0; i < n; i++) {
976  unsigned r, g, b, a;
977  Uint32 pix = *s++;
978  a = (pix & 0x3e0) >> 2;
979  pix = (pix & ~0x3e0) | pix >> 16;
980  RGB_FROM_PIXEL(pix, sfmt, r, g, b);
981  PIXEL_FROM_RGBA(*dst, dfmt, r, g, b, a);
982  dst++;
983  }
984  return n * 4;
985 }
GLenum GLenum dst
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2072
GLdouble s
Definition: SDL_opengl.h:2056
GLdouble n
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
GLboolean GLboolean g
#define PIXEL_FROM_RGBA(Pixel, fmt, r, g, b, a)
Definition: SDL_blit.h:394
#define RGB_FROM_PIXEL(Pixel, fmt, r, g, b)
Definition: SDL_blit.h:121
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
GLboolean GLboolean GLboolean GLboolean a
GLenum src
GLboolean GLboolean GLboolean b

◆ UnRLEAlpha()

static SDL_bool UnRLEAlpha ( SDL_Surface surface)
static

Definition at line 1467 of file SDL_RLEaccel.c.

References bpp, RLEDestFormat::BytesPerPixel, SDL_BlitMap::data, SDL_Surface::format, SDL_Surface::h, SDL_Surface::map, SDL_Surface::pitch, SDL_Surface::pixels, SDL_FALSE, SDL_malloc, SDL_memset, SDL_TRUE, uncopy_32(), uncopy_opaque_16(), uncopy_transl_16(), and SDL_Surface::w.

Referenced by SDL_UnRLESurface().

1468 {
1469  Uint8 *srcbuf;
1470  Uint32 *dst;
1471  SDL_PixelFormat *sf = surface->format;
1472  RLEDestFormat *df = surface->map->data;
1473  int (*uncopy_opaque) (Uint32 *, void *, int,
1475  int (*uncopy_transl) (Uint32 *, void *, int,
1476  RLEDestFormat *, SDL_PixelFormat *);
1477  int w = surface->w;
1478  int bpp = df->BytesPerPixel;
1479 
1480  if (bpp == 2) {
1481  uncopy_opaque = uncopy_opaque_16;
1482  uncopy_transl = uncopy_transl_16;
1483  } else {
1484  uncopy_opaque = uncopy_transl = uncopy_32;
1485  }
1486 
1487  surface->pixels = SDL_malloc(surface->h * surface->pitch);
1488  if (!surface->pixels) {
1489  return (SDL_FALSE);
1490  }
1491  /* fill background with transparent pixels */
1492  SDL_memset(surface->pixels, 0, surface->h * surface->pitch);
1493 
1494  dst = surface->pixels;
1495  srcbuf = (Uint8 *) (df + 1);
1496  for (;;) {
1497  /* copy opaque pixels */
1498  int ofs = 0;
1499  do {
1500  unsigned run;
1501  if (bpp == 2) {
1502  ofs += srcbuf[0];
1503  run = srcbuf[1];
1504  srcbuf += 2;
1505  } else {
1506  ofs += ((Uint16 *) srcbuf)[0];
1507  run = ((Uint16 *) srcbuf)[1];
1508  srcbuf += 4;
1509  }
1510  if (run) {
1511  srcbuf += uncopy_opaque(dst + ofs, srcbuf, run, df, sf);
1512  ofs += run;
1513  } else if (!ofs)
1514  return (SDL_TRUE);
1515  } while (ofs < w);
1516 
1517  /* skip padding if needed */
1518  if (bpp == 2)
1519  srcbuf += (uintptr_t) srcbuf & 2;
1520 
1521  /* copy translucent pixels */
1522  ofs = 0;
1523  do {
1524  unsigned run;
1525  ofs += ((Uint16 *) srcbuf)[0];
1526  run = ((Uint16 *) srcbuf)[1];
1527  srcbuf += 4;
1528  if (run) {
1529  srcbuf += uncopy_transl(dst + ofs, srcbuf, run, df, sf);
1530  ofs += run;
1531  }
1532  } while (ofs < w);
1533  dst += surface->pitch >> 2;
1534  }
1535  /* Make the compiler happy */
1536  return (SDL_TRUE);
1537 }
GLenum GLenum dst
static int uncopy_transl_16(Uint32 *dst, void *src, int n, RLEDestFormat *sfmt, SDL_PixelFormat *dfmt)
Definition: SDL_RLEaccel.c:970
static int uncopy_32(Uint32 *dst, void *src, int n, RLEDestFormat *sfmt, SDL_PixelFormat *dfmt)
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:159
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp
struct SDL_BlitMap * map
Definition: SDL_surface.h:88
void * pixels
Definition: SDL_surface.h:75
uint8_t Uint8
An unsigned 8-bit integer type.
Definition: SDL_stdinc.h:143
Uint8 BytesPerPixel
Definition: SDL_RLEaccel.c:620
unsigned int uintptr_t
SDL_PixelFormat * format
Definition: SDL_surface.h:72
uint16_t Uint16
An unsigned 16-bit integer type.
Definition: SDL_stdinc.h:151
static int uncopy_opaque_16(Uint32 *dst, void *src, int n, RLEDestFormat *sfmt, SDL_PixelFormat *dfmt)
Definition: SDL_RLEaccel.c:912
void * data
Definition: SDL_blit.h:90
#define SDL_malloc
GLubyte GLubyte GLubyte GLubyte w
#define SDL_memset

Variable Documentation

◆ getpixes

const getpix_func getpixes[4]
static
Initial value:
= {
}
static Uint32 getpix_16(Uint8 *srcbuf)
static Uint32 getpix_32(Uint8 *srcbuf)
static Uint32 getpix_8(Uint8 *srcbuf)
static Uint32 getpix_24(Uint8 *srcbuf)

Definition at line 1271 of file SDL_RLEaccel.c.

Referenced by RLEColorkeySurface().