Okay, still some bugs, but everything builds again...
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402629
This commit is contained in:
parent
2e91636dda
commit
cf548d0a6b
23 changed files with 604 additions and 676 deletions
|
@ -37,8 +37,8 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SDL_SWSURFACE 0x00000000 /* Not used */
|
#define SDL_SWSURFACE 0x00000000 /* Not used */
|
||||||
//#define SDL_SRCALPHA 0x00010000
|
#define SDL_SRCALPHA 0x00010000
|
||||||
//#define SDL_SRCCOLORKEY 0x00020000
|
#define SDL_SRCCOLORKEY 0x00020000
|
||||||
#define SDL_ANYFORMAT 0x00100000
|
#define SDL_ANYFORMAT 0x00100000
|
||||||
#define SDL_HWPALETTE 0x00200000
|
#define SDL_HWPALETTE 0x00200000
|
||||||
#define SDL_DOUBLEBUF 0x00400000
|
#define SDL_DOUBLEBUF 0x00400000
|
||||||
|
@ -48,6 +48,7 @@ extern "C" {
|
||||||
#define SDL_OPENGL 0x04000000
|
#define SDL_OPENGL 0x04000000
|
||||||
#define SDL_HWSURFACE 0x08000001 /* Not used */
|
#define SDL_HWSURFACE 0x08000001 /* Not used */
|
||||||
#define SDL_ASYNCBLIT 0x08000000 /* Not used */
|
#define SDL_ASYNCBLIT 0x08000000 /* Not used */
|
||||||
|
#define SDL_RLEACCELOK 0x08000000 /* Not used */
|
||||||
#define SDL_HWACCEL 0x08000000 /* Not used */
|
#define SDL_HWACCEL 0x08000000 /* Not used */
|
||||||
|
|
||||||
#define SDL_APPMOUSEFOCUS 0x01
|
#define SDL_APPMOUSEFOCUS 0x01
|
||||||
|
|
|
@ -265,7 +265,7 @@ typedef void *SDL_GLContext;
|
||||||
/* These are the currently supported flags for the SDL_surface */
|
/* These are the currently supported flags for the SDL_surface */
|
||||||
/* Used internally (read-only) */
|
/* Used internally (read-only) */
|
||||||
#define SDL_PREALLOC 0x00000001 /* Surface uses preallocated memory */
|
#define SDL_PREALLOC 0x00000001 /* Surface uses preallocated memory */
|
||||||
#define SDL_RLEACCEL 0x00000001 /* Surface is RLE encoded */
|
#define SDL_RLEACCEL 0x00000002 /* Surface is RLE encoded */
|
||||||
|
|
||||||
/* Evaluates to true if the surface needs to be locked before access */
|
/* Evaluates to true if the surface needs to be locked before access */
|
||||||
#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
|
#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
|
||||||
|
@ -1407,7 +1407,8 @@ extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
|
||||||
* \note If RLE is enabled, colorkey and alpha blending blits are much faster,
|
* \note If RLE is enabled, colorkey and alpha blending blits are much faster,
|
||||||
* but the surface must be locked before directly accessing the pixels.
|
* but the surface must be locked before directly accessing the pixels.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface *surface, int flag);
|
extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
|
||||||
|
int flag);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* \fn int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key)
|
* \fn int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key)
|
||||||
|
@ -1420,7 +1421,8 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface *surface, int flag);
|
||||||
*
|
*
|
||||||
* \return 0 on success, or -1 if the surface is not valid
|
* \return 0 on success, or -1 if the surface is not valid
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key);
|
extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
|
||||||
|
Uint32 flag, Uint32 key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn int SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)
|
* \fn int SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)
|
||||||
|
|
|
@ -608,7 +608,7 @@ SDL_SetAlpha(SDL_Surface * surface, Uint32 flag, Uint8 value)
|
||||||
SDL_Surface *
|
SDL_Surface *
|
||||||
SDL_DisplayFormat(SDL_Surface * surface)
|
SDL_DisplayFormat(SDL_Surface * surface)
|
||||||
{
|
{
|
||||||
Uint32 flags;
|
SDL_Surface *converted;
|
||||||
|
|
||||||
if (!SDL_PublicSurface) {
|
if (!SDL_PublicSurface) {
|
||||||
SDL_SetError("No video mode has been set");
|
SDL_SetError("No video mode has been set");
|
||||||
|
@ -616,7 +616,9 @@ SDL_DisplayFormat(SDL_Surface * surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the flags appropriate for copying to display surface */
|
/* Set the flags appropriate for copying to display surface */
|
||||||
return SDL_ConvertSurface(surface, SDL_PublicSurface->format, SDL_RLEACCELOK);
|
converted = SDL_ConvertSurface(surface, SDL_PublicSurface->format, 0);
|
||||||
|
SDL_SetSurfaceRLE(converted, 1);
|
||||||
|
return converted;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Surface *
|
SDL_Surface *
|
||||||
|
@ -625,7 +627,6 @@ SDL_DisplayFormatAlpha(SDL_Surface * surface)
|
||||||
SDL_PixelFormat *vf;
|
SDL_PixelFormat *vf;
|
||||||
SDL_PixelFormat *format;
|
SDL_PixelFormat *format;
|
||||||
SDL_Surface *converted;
|
SDL_Surface *converted;
|
||||||
Uint32 flags;
|
|
||||||
/* default to ARGB8888 */
|
/* default to ARGB8888 */
|
||||||
Uint32 amask = 0xff000000;
|
Uint32 amask = 0xff000000;
|
||||||
Uint32 rmask = 0x00ff0000;
|
Uint32 rmask = 0x00ff0000;
|
||||||
|
@ -666,7 +667,8 @@ SDL_DisplayFormatAlpha(SDL_Surface * surface)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
format = SDL_AllocFormat(32, rmask, gmask, bmask, amask);
|
format = SDL_AllocFormat(32, rmask, gmask, bmask, amask);
|
||||||
converted = SDL_ConvertSurface(surface, format, SDL_RLEACCELOK);
|
converted = SDL_ConvertSurface(surface, format, 0);
|
||||||
|
SDL_SetSurfaceRLE(converted, 1);
|
||||||
SDL_FreeFormat(format);
|
SDL_FreeFormat(format);
|
||||||
return converted;
|
return converted;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1971,7 +1971,8 @@ SDL_UnRLESurface(SDL_Surface * surface, int recode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
surface->map->info.flags &= (SDL_COPY_RLE_COLORKEY|SDL_COPY_RLE_ALPHAKEY);
|
surface->map->info.flags &=
|
||||||
|
(SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY);
|
||||||
|
|
||||||
if (surface->map->data) {
|
if (surface->map->data) {
|
||||||
SDL_free(surface->map->data);
|
SDL_free(surface->map->data);
|
||||||
|
|
|
@ -71,11 +71,15 @@ SDL_SoftBlit(SDL_Surface * src, SDL_Rect * srcrect,
|
||||||
(Uint16) srcrect->x * info->src_fmt->BytesPerPixel;
|
(Uint16) srcrect->x * info->src_fmt->BytesPerPixel;
|
||||||
info->src_w = srcrect->w;
|
info->src_w = srcrect->w;
|
||||||
info->src_h = srcrect->h;
|
info->src_h = srcrect->h;
|
||||||
info->dst = (Uint8 *) dst->pixels +
|
info->src_skip =
|
||||||
(Uint16) dstrect->y * dst->pitch +
|
info->src_pitch - info->src_w * info->src_fmt->BytesPerPixel;
|
||||||
|
info->dst =
|
||||||
|
(Uint8 *) dst->pixels + (Uint16) dstrect->y * dst->pitch +
|
||||||
(Uint16) dstrect->x * info->dst_fmt->BytesPerPixel;
|
(Uint16) dstrect->x * info->dst_fmt->BytesPerPixel;
|
||||||
info->dst_w = dstrect->w;
|
info->dst_w = dstrect->w;
|
||||||
info->dst_h = dstrect->h;
|
info->dst_h = dstrect->h;
|
||||||
|
info->dst_skip =
|
||||||
|
info->dst_pitch - info->dst_w * info->dst_fmt->BytesPerPixel;
|
||||||
RunBlit = (SDL_BlitFunc) src->map->data;
|
RunBlit = (SDL_BlitFunc) src->map->data;
|
||||||
|
|
||||||
/* Run the actual software blit */
|
/* Run the actual software blit */
|
||||||
|
@ -119,7 +123,8 @@ SDL_UseAltivecPrefetch()
|
||||||
#endif /* __MACOSX__ */
|
#endif /* __MACOSX__ */
|
||||||
|
|
||||||
static SDL_BlitFunc
|
static SDL_BlitFunc
|
||||||
SDL_ChooseBlitFunc(Uint32 src_format, Uint32 dst_format, int flags, SDL_BlitFuncEntry * entries)
|
SDL_ChooseBlitFunc(Uint32 src_format, Uint32 dst_format, int flags,
|
||||||
|
SDL_BlitFuncEntry * entries)
|
||||||
{
|
{
|
||||||
int i, flagcheck;
|
int i, flagcheck;
|
||||||
static Uint32 features = 0xffffffff;
|
static Uint32 features = 0xffffffff;
|
||||||
|
@ -166,13 +171,16 @@ SDL_ChooseBlitFunc(Uint32 src_format, Uint32 dst_format, int flags, SDL_BlitFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check modulation flags */
|
/* Check modulation flags */
|
||||||
flagcheck = (flags & (SDL_COPY_MODULATE_COLOR|SDL_COPY_MODULATE_COLOR));
|
flagcheck =
|
||||||
|
(flags & (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_COLOR));
|
||||||
if ((flagcheck & entries[i].flags) != flagcheck) {
|
if ((flagcheck & entries[i].flags) != flagcheck) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check blend flags */
|
/* Check blend flags */
|
||||||
flagcheck = (flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD));
|
flagcheck =
|
||||||
|
(flags &
|
||||||
|
(SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD));
|
||||||
if ((flagcheck & entries[i].flags) != flagcheck) {
|
if ((flagcheck & entries[i].flags) != flagcheck) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -208,8 +216,6 @@ SDL_CalculateBlit(SDL_Surface * surface)
|
||||||
SDL_BlitFunc blit = NULL;
|
SDL_BlitFunc blit = NULL;
|
||||||
SDL_BlitMap *map = surface->map;
|
SDL_BlitMap *map = surface->map;
|
||||||
SDL_Surface *dst = map->dst;
|
SDL_Surface *dst = map->dst;
|
||||||
Uint32 src_format;
|
|
||||||
Uint32 dst_format;
|
|
||||||
|
|
||||||
/* Clean everything out to start */
|
/* Clean everything out to start */
|
||||||
if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) {
|
if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) {
|
||||||
|
@ -222,16 +228,13 @@ SDL_CalculateBlit(SDL_Surface * surface)
|
||||||
map->info.dst_pitch = dst->pitch;
|
map->info.dst_pitch = dst->pitch;
|
||||||
|
|
||||||
/* See if we can do RLE acceleration */
|
/* See if we can do RLE acceleration */
|
||||||
if (surface->flags & SDL_RLEACCELOK) {
|
if (surface->map->info.flags & SDL_COPY_RLE_DESIRED) {
|
||||||
if (SDL_RLESurface(surface) == 0) {
|
if (SDL_RLESurface(surface) == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Choose a standard blit function */
|
/* Choose a standard blit function */
|
||||||
src_format = SDL_MasksToPixelFormatEnum(surface->format->BitsPerPixel, surface->format->Rmask, surface->format->Gmask, surface->format->Bmask, surface->format->Amask);
|
|
||||||
dst_format = SDL_MasksToPixelFormatEnum(dst->format->BitsPerPixel, dst->format->Rmask, dst->format->Gmask, dst->format->Bmask, dst->format->Amask);
|
|
||||||
|
|
||||||
if (map->identity && !map->info.flags) {
|
if (map->identity && !map->info.flags) {
|
||||||
/* Handle overlapping blits on the same surface */
|
/* Handle overlapping blits on the same surface */
|
||||||
if (surface == dst) {
|
if (surface == dst) {
|
||||||
|
@ -240,15 +243,32 @@ SDL_CalculateBlit(SDL_Surface * surface)
|
||||||
blit = SDL_BlitCopy;
|
blit = SDL_BlitCopy;
|
||||||
}
|
}
|
||||||
} else if (surface->format->BitsPerPixel < 8) {
|
} else if (surface->format->BitsPerPixel < 8) {
|
||||||
blit = SDL_ChooseBlitFunc(src_format, dst_format, map->info.flags, SDL_BlitFuncTable0);
|
blit = SDL_CalculateBlit0(surface);
|
||||||
} else if (surface->format->BytesPerPixel == 1) {
|
} else if (surface->format->BytesPerPixel == 1) {
|
||||||
blit = SDL_ChooseBlitFunc(src_format, dst_format, map->info.flags, SDL_BlitFuncTable1);
|
blit = SDL_CalculateBlit1(surface);
|
||||||
|
} else if (map->info.flags & SDL_COPY_BLEND) {
|
||||||
|
blit = SDL_CalculateBlitA(surface);
|
||||||
} else {
|
} else {
|
||||||
blit = SDL_ChooseBlitFunc(src_format, dst_format, map->info.flags, SDL_BlitFuncTableN);
|
blit = SDL_CalculateBlitN(surface);
|
||||||
}
|
}
|
||||||
if (blit == NULL) {
|
if (blit == NULL) {
|
||||||
blit = SDL_ChooseBlitFunc(src_format, dst_format, map->info.flags, SDL_GeneratedBlitFuncTable);
|
Uint32 src_format =
|
||||||
|
SDL_MasksToPixelFormatEnum(surface->format->BitsPerPixel,
|
||||||
|
surface->format->Rmask,
|
||||||
|
surface->format->Gmask,
|
||||||
|
surface->format->Bmask,
|
||||||
|
surface->format->Amask);
|
||||||
|
Uint32 dst_format =
|
||||||
|
SDL_MasksToPixelFormatEnum(dst->format->BitsPerPixel,
|
||||||
|
dst->format->Rmask, dst->format->Gmask,
|
||||||
|
dst->format->Bmask,
|
||||||
|
dst->format->Amask);
|
||||||
|
|
||||||
|
blit =
|
||||||
|
SDL_ChooseBlitFunc(src_format, dst_format, map->info.flags,
|
||||||
|
SDL_GeneratedBlitFuncTable);
|
||||||
}
|
}
|
||||||
|
map->data = blit;
|
||||||
|
|
||||||
/* Make sure we have a blit function */
|
/* Make sure we have a blit function */
|
||||||
if (blit == NULL) {
|
if (blit == NULL) {
|
||||||
|
|
|
@ -62,13 +62,16 @@
|
||||||
#define SDL_CPU_ALTIVEC_PREFETCH 0x00000010
|
#define SDL_CPU_ALTIVEC_PREFETCH 0x00000010
|
||||||
#define SDL_CPU_ALTIVEC_NOPREFETCH 0x00000020
|
#define SDL_CPU_ALTIVEC_NOPREFETCH 0x00000020
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
Uint8 *src;
|
Uint8 *src;
|
||||||
int src_w, src_h;
|
int src_w, src_h;
|
||||||
int src_pitch;
|
int src_pitch;
|
||||||
|
int src_skip;
|
||||||
Uint8 *dst;
|
Uint8 *dst;
|
||||||
int dst_w, dst_h;
|
int dst_w, dst_h;
|
||||||
int dst_pitch;
|
int dst_pitch;
|
||||||
|
int dst_skip;
|
||||||
SDL_PixelFormat *src_fmt;
|
SDL_PixelFormat *src_fmt;
|
||||||
SDL_PixelFormat *dst_fmt;
|
SDL_PixelFormat *dst_fmt;
|
||||||
Uint8 *table;
|
Uint8 *table;
|
||||||
|
@ -79,7 +82,8 @@ typedef struct {
|
||||||
|
|
||||||
typedef void (SDLCALL * SDL_BlitFunc) (SDL_BlitInfo * info);
|
typedef void (SDLCALL * SDL_BlitFunc) (SDL_BlitInfo * info);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
Uint32 src_format;
|
Uint32 src_format;
|
||||||
Uint32 dst_format;
|
Uint32 dst_format;
|
||||||
int flags;
|
int flags;
|
||||||
|
@ -104,10 +108,11 @@ typedef struct SDL_BlitMap
|
||||||
/* Functions found in SDL_blit.c */
|
/* Functions found in SDL_blit.c */
|
||||||
extern int SDL_CalculateBlit(SDL_Surface * surface);
|
extern int SDL_CalculateBlit(SDL_Surface * surface);
|
||||||
|
|
||||||
/* Blit function tables in SDL_blit_*.c */
|
/* Functions found in SDL_blit_*.c */
|
||||||
extern SDL_BlitFuncEntry SDL_BlitFuncTable0[];
|
extern SDL_BlitFunc SDL_CalculateBlit0(SDL_Surface * surface);
|
||||||
extern SDL_BlitFuncEntry SDL_BlitFuncTable1[];
|
extern SDL_BlitFunc SDL_CalculateBlit1(SDL_Surface * surface);
|
||||||
extern SDL_BlitFuncEntry SDL_BlitFuncTableN[];
|
extern SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface * surface);
|
||||||
|
extern SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface * surface);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Useful macros for blitting routines
|
* Useful macros for blitting routines
|
||||||
|
|
|
@ -38,9 +38,9 @@ BlitBto1(SDL_BlitInfo * info)
|
||||||
width = info->dst_w;
|
width = info->dst_w;
|
||||||
height = info->dst_h;
|
height = info->dst_h;
|
||||||
src = info->src;
|
src = info->src;
|
||||||
srcskip = info->s_skip;
|
srcskip = info->src_skip;
|
||||||
dst = info->dst;
|
dst = info->dst;
|
||||||
dstskip = info->dst_pitch;
|
dstskip = info->dst_skip;
|
||||||
map = info->table;
|
map = info->table;
|
||||||
srcskip += width - (width + 7) / 8;
|
srcskip += width - (width + 7) / 8;
|
||||||
|
|
||||||
|
@ -93,9 +93,9 @@ BlitBto2(SDL_BlitInfo * info)
|
||||||
width = info->dst_w;
|
width = info->dst_w;
|
||||||
height = info->dst_h;
|
height = info->dst_h;
|
||||||
src = info->src;
|
src = info->src;
|
||||||
srcskip = info->s_skip;
|
srcskip = info->src_skip;
|
||||||
dst = (Uint16 *) info->dst;
|
dst = (Uint16 *) info->dst;
|
||||||
dstskip = info->dst_pitch / 2;
|
dstskip = info->dst_skip / 2;
|
||||||
map = (Uint16 *) info->table;
|
map = (Uint16 *) info->table;
|
||||||
srcskip += width - (width + 7) / 8;
|
srcskip += width - (width + 7) / 8;
|
||||||
|
|
||||||
|
@ -128,9 +128,9 @@ BlitBto3(SDL_BlitInfo * info)
|
||||||
width = info->dst_w;
|
width = info->dst_w;
|
||||||
height = info->dst_h;
|
height = info->dst_h;
|
||||||
src = info->src;
|
src = info->src;
|
||||||
srcskip = info->s_skip;
|
srcskip = info->src_skip;
|
||||||
dst = info->dst;
|
dst = info->dst;
|
||||||
dstskip = info->dst_pitch;
|
dstskip = info->dst_skip;
|
||||||
map = info->table;
|
map = info->table;
|
||||||
srcskip += width - (width + 7) / 8;
|
srcskip += width - (width + 7) / 8;
|
||||||
|
|
||||||
|
@ -167,9 +167,9 @@ BlitBto4(SDL_BlitInfo * info)
|
||||||
width = info->dst_w;
|
width = info->dst_w;
|
||||||
height = info->dst_h;
|
height = info->dst_h;
|
||||||
src = info->src;
|
src = info->src;
|
||||||
srcskip = info->s_skip;
|
srcskip = info->src_skip;
|
||||||
dst = (Uint32 *) info->dst;
|
dst = (Uint32 *) info->dst;
|
||||||
dstskip = info->dst_pitch / 4;
|
dstskip = info->dst_skip / 4;
|
||||||
map = (Uint32 *) info->table;
|
map = (Uint32 *) info->table;
|
||||||
srcskip += width - (width + 7) / 8;
|
srcskip += width - (width + 7) / 8;
|
||||||
|
|
||||||
|
@ -198,9 +198,9 @@ BlitBto1Key(SDL_BlitInfo * info)
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
Uint8 *palmap = info->table;
|
Uint8 *palmap = info->table;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
@ -251,9 +251,9 @@ BlitBto2Key(SDL_BlitInfo * info)
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
Uint16 *dstp = (Uint16 *) info->dst;
|
Uint16 *dstp = (Uint16 *) info->dst;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
Uint8 *palmap = info->table;
|
Uint8 *palmap = info->table;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
@ -286,9 +286,9 @@ BlitBto3Key(SDL_BlitInfo * info)
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
Uint8 *palmap = info->table;
|
Uint8 *palmap = info->table;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
@ -320,9 +320,9 @@ BlitBto4Key(SDL_BlitInfo * info)
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
Uint32 *dstp = (Uint32 *) info->dst;
|
Uint32 *dstp = (Uint32 *) info->dst;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
Uint8 *palmap = info->table;
|
Uint8 *palmap = info->table;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
@ -355,13 +355,13 @@ BlitBtoNAlpha(SDL_BlitInfo * info)
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
const SDL_Color *srcpal = info->src->palette->colors;
|
const SDL_Color *srcpal = info->src_fmt->palette->colors;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int dstbpp;
|
int dstbpp;
|
||||||
int c;
|
int c;
|
||||||
const int A = (info->cmod >> 24);
|
const int A = info->a;
|
||||||
|
|
||||||
/* Set up some basic variables */
|
/* Set up some basic variables */
|
||||||
dstbpp = dstfmt->BytesPerPixel;
|
dstbpp = dstfmt->BytesPerPixel;
|
||||||
|
@ -400,15 +400,15 @@ BlitBtoNAlphaKey(SDL_BlitInfo * info)
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
const SDL_Color *srcpal = srcfmt->palette->colors;
|
const SDL_Color *srcpal = srcfmt->palette->colors;
|
||||||
int dstbpp;
|
int dstbpp;
|
||||||
int c;
|
int c;
|
||||||
const int A = (info->cmod >> 24);
|
const int A = info->a;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
|
|
||||||
/* Set up some basic variables */
|
/* Set up some basic variables */
|
||||||
dstbpp = dstfmt->BytesPerPixel;
|
dstbpp = dstfmt->BytesPerPixel;
|
||||||
|
@ -440,16 +440,16 @@ BlitBtoNAlphaKey(SDL_BlitInfo * info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_loblit bitmap_blit[] = {
|
static SDL_BlitFunc bitmap_blit[] = {
|
||||||
NULL, BlitBto1, BlitBto2, BlitBto3, BlitBto4
|
NULL, BlitBto1, BlitBto2, BlitBto3, BlitBto4
|
||||||
};
|
};
|
||||||
|
|
||||||
static SDL_loblit colorkey_blit[] = {
|
static SDL_BlitFunc colorkey_blit[] = {
|
||||||
NULL, BlitBto1Key, BlitBto2Key, BlitBto3Key, BlitBto4Key
|
NULL, BlitBto1Key, BlitBto2Key, BlitBto3Key, BlitBto4Key
|
||||||
};
|
};
|
||||||
|
|
||||||
SDL_loblit
|
SDL_BlitFunc
|
||||||
SDL_CalculateBlit0(SDL_Surface * surface, int blit_index)
|
SDL_CalculateBlit0(SDL_Surface * surface)
|
||||||
{
|
{
|
||||||
int which;
|
int which;
|
||||||
|
|
||||||
|
@ -462,17 +462,17 @@ SDL_CalculateBlit0(SDL_Surface * surface, int blit_index)
|
||||||
} else {
|
} else {
|
||||||
which = surface->map->dst->format->BytesPerPixel;
|
which = surface->map->dst->format->BytesPerPixel;
|
||||||
}
|
}
|
||||||
switch (blit_index) {
|
switch (surface->map->info.flags) {
|
||||||
case 0: /* copy */
|
case 0:
|
||||||
return bitmap_blit[which];
|
return bitmap_blit[which];
|
||||||
|
|
||||||
case 1: /* colorkey */
|
case SDL_COPY_COLORKEY:
|
||||||
return colorkey_blit[which];
|
return colorkey_blit[which];
|
||||||
|
|
||||||
case 2: /* alpha */
|
case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
|
||||||
return which >= 2 ? BlitBtoNAlpha : NULL;
|
return which >= 2 ? BlitBtoNAlpha : NULL;
|
||||||
|
|
||||||
case 4: /* alpha + colorkey */
|
case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
|
||||||
return which >= 2 ? BlitBtoNAlphaKey : NULL;
|
return which >= 2 ? BlitBtoNAlphaKey : NULL;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -42,9 +42,9 @@ Blit1to1(SDL_BlitInfo * info)
|
||||||
width = info->dst_w;
|
width = info->dst_w;
|
||||||
height = info->dst_h;
|
height = info->dst_h;
|
||||||
src = info->src;
|
src = info->src;
|
||||||
srcskip = info->s_skip;
|
srcskip = info->src_skip;
|
||||||
dst = info->dst;
|
dst = info->dst;
|
||||||
dstskip = info->dst_pitch;
|
dstskip = info->dst_skip;
|
||||||
map = info->table;
|
map = info->table;
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
|
@ -93,9 +93,9 @@ Blit1to2(SDL_BlitInfo * info)
|
||||||
width = info->dst_w;
|
width = info->dst_w;
|
||||||
height = info->dst_h;
|
height = info->dst_h;
|
||||||
src = info->src;
|
src = info->src;
|
||||||
srcskip = info->s_skip;
|
srcskip = info->src_skip;
|
||||||
dst = info->dst;
|
dst = info->dst;
|
||||||
dstskip = info->dst_pitch;
|
dstskip = info->dst_skip;
|
||||||
map = (Uint16 *) info->table;
|
map = (Uint16 *) info->table;
|
||||||
|
|
||||||
#ifdef USE_DUFFS_LOOP
|
#ifdef USE_DUFFS_LOOP
|
||||||
|
@ -199,9 +199,9 @@ Blit1to3(SDL_BlitInfo * info)
|
||||||
width = info->dst_w;
|
width = info->dst_w;
|
||||||
height = info->dst_h;
|
height = info->dst_h;
|
||||||
src = info->src;
|
src = info->src;
|
||||||
srcskip = info->s_skip;
|
srcskip = info->src_skip;
|
||||||
dst = info->dst;
|
dst = info->dst;
|
||||||
dstskip = info->dst_pitch;
|
dstskip = info->dst_skip;
|
||||||
map = info->table;
|
map = info->table;
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
|
@ -247,9 +247,9 @@ Blit1to4(SDL_BlitInfo * info)
|
||||||
width = info->dst_w;
|
width = info->dst_w;
|
||||||
height = info->dst_h;
|
height = info->dst_h;
|
||||||
src = info->src;
|
src = info->src;
|
||||||
srcskip = info->s_skip;
|
srcskip = info->src_skip;
|
||||||
dst = (Uint32 *) info->dst;
|
dst = (Uint32 *) info->dst;
|
||||||
dstskip = info->dst_pitch / 4;
|
dstskip = info->dst_skip / 4;
|
||||||
map = (Uint32 *) info->table;
|
map = (Uint32 *) info->table;
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
|
@ -286,11 +286,11 @@ Blit1to1Key(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
Uint8 *palmap = info->table;
|
Uint8 *palmap = info->table;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
|
|
||||||
if (palmap) {
|
if (palmap) {
|
||||||
while (height--) {
|
while (height--) {
|
||||||
|
@ -333,11 +333,11 @@ Blit1to2Key(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint16 *dstp = (Uint16 *) info->dst;
|
Uint16 *dstp = (Uint16 *) info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
Uint16 *palmap = (Uint16 *) info->table;
|
Uint16 *palmap = (Uint16 *) info->table;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
|
|
||||||
/* Set up some basic variables */
|
/* Set up some basic variables */
|
||||||
dstskip /= 2;
|
dstskip /= 2;
|
||||||
|
@ -365,11 +365,11 @@ Blit1to3Key(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
Uint8 *palmap = info->table;
|
Uint8 *palmap = info->table;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
int o;
|
int o;
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
|
@ -398,11 +398,11 @@ Blit1to4Key(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint32 *dstp = (Uint32 *) info->dst;
|
Uint32 *dstp = (Uint32 *) info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
Uint32 *palmap = (Uint32 *) info->table;
|
Uint32 *palmap = (Uint32 *) info->table;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
|
|
||||||
/* Set up some basic variables */
|
/* Set up some basic variables */
|
||||||
dstskip /= 4;
|
dstskip /= 4;
|
||||||
|
@ -430,13 +430,13 @@ Blit1toNAlpha(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
const SDL_Color *srcpal = info->src->palette->colors;
|
const SDL_Color *srcpal = info->src_fmt->palette->colors;
|
||||||
int dstbpp;
|
int dstbpp;
|
||||||
const int A = (info->cmod >> 24);
|
const int A = info->a;
|
||||||
|
|
||||||
/* Set up some basic variables */
|
/* Set up some basic variables */
|
||||||
dstbpp = dstfmt->BytesPerPixel;
|
dstbpp = dstfmt->BytesPerPixel;
|
||||||
|
@ -471,15 +471,15 @@ Blit1toNAlphaKey(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
const SDL_Color *srcpal = info->src->palette->colors;
|
const SDL_Color *srcpal = info->src_fmt->palette->colors;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
int dstbpp;
|
int dstbpp;
|
||||||
const int A = (info->cmod >> 24);
|
const int A = info->a;
|
||||||
|
|
||||||
/* Set up some basic variables */
|
/* Set up some basic variables */
|
||||||
dstbpp = dstfmt->BytesPerPixel;
|
dstbpp = dstfmt->BytesPerPixel;
|
||||||
|
@ -510,16 +510,16 @@ Blit1toNAlphaKey(SDL_BlitInfo * info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_loblit one_blit[] = {
|
static SDL_BlitFunc one_blit[] = {
|
||||||
NULL, Blit1to1, Blit1to2, Blit1to3, Blit1to4
|
NULL, Blit1to1, Blit1to2, Blit1to3, Blit1to4
|
||||||
};
|
};
|
||||||
|
|
||||||
static SDL_loblit one_blitkey[] = {
|
static SDL_BlitFunc one_blitkey[] = {
|
||||||
NULL, Blit1to1Key, Blit1to2Key, Blit1to3Key, Blit1to4Key
|
NULL, Blit1to1Key, Blit1to2Key, Blit1to3Key, Blit1to4Key
|
||||||
};
|
};
|
||||||
|
|
||||||
SDL_loblit
|
SDL_BlitFunc
|
||||||
SDL_CalculateBlit1(SDL_Surface * surface, int blit_index)
|
SDL_CalculateBlit1(SDL_Surface * surface)
|
||||||
{
|
{
|
||||||
int which;
|
int which;
|
||||||
SDL_PixelFormat *dstfmt;
|
SDL_PixelFormat *dstfmt;
|
||||||
|
@ -530,22 +530,21 @@ SDL_CalculateBlit1(SDL_Surface * surface, int blit_index)
|
||||||
} else {
|
} else {
|
||||||
which = dstfmt->BytesPerPixel;
|
which = dstfmt->BytesPerPixel;
|
||||||
}
|
}
|
||||||
switch (blit_index) {
|
switch (surface->map->info.flags) {
|
||||||
case 0: /* copy */
|
case 0:
|
||||||
return one_blit[which];
|
return one_blit[which];
|
||||||
|
|
||||||
case 1: /* colorkey */
|
case SDL_COPY_COLORKEY:
|
||||||
return one_blitkey[which];
|
return one_blitkey[which];
|
||||||
|
|
||||||
case 2: /* alpha */
|
case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
|
||||||
/* Supporting 8bpp->8bpp alpha is doable but requires lots of
|
/* Supporting 8bpp->8bpp alpha is doable but requires lots of
|
||||||
tables which consume space and takes time to precompute,
|
tables which consume space and takes time to precompute,
|
||||||
so is better left to the user */
|
so is better left to the user */
|
||||||
return which >= 2 ? Blit1toNAlpha : NULL;
|
return which >= 2 ? Blit1toNAlpha : NULL;
|
||||||
|
|
||||||
case 3: /* alpha + colorkey */
|
case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
|
||||||
return which >= 2 ? Blit1toNAlphaKey : NULL;
|
return which >= 2 ? Blit1toNAlphaKey : NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,15 +33,15 @@ BlitNto1SurfaceAlpha(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
Uint8 *palmap = info->table;
|
Uint8 *palmap = info->table;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->BytesPerPixel;
|
||||||
|
|
||||||
const unsigned A = (info->cmod >> 24);
|
const unsigned A = info->a;
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
|
@ -89,12 +89,12 @@ BlitNto1PixelAlpha(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
Uint8 *palmap = info->table;
|
Uint8 *palmap = info->table;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->BytesPerPixel;
|
||||||
|
|
||||||
/* FIXME: fix alpha bit field expansion here too? */
|
/* FIXME: fix alpha bit field expansion here too? */
|
||||||
|
@ -145,16 +145,16 @@ BlitNto1SurfaceAlphaKey(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
Uint8 *palmap = info->table;
|
Uint8 *palmap = info->table;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->BytesPerPixel;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
|
|
||||||
const int A = (info->cmod >> 24);
|
const int A = info->a;
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
|
@ -206,10 +206,10 @@ BlitRGBtoRGBSurfaceAlpha128MMX(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *srcp = (Uint32 *) info->src;
|
Uint32 *srcp = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip >> 2;
|
int srcskip = info->src_skip >> 2;
|
||||||
Uint32 *dstp = (Uint32 *) info->dst;
|
Uint32 *dstp = (Uint32 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 2;
|
int dstskip = info->dst_skip >> 2;
|
||||||
Uint32 dalpha = info->dst->Amask;
|
Uint32 dalpha = info->dst_fmt->Amask;
|
||||||
|
|
||||||
__m64 src1, src2, dst1, dst2, lmask, hmask, dsta;
|
__m64 src1, src2, dst1, dst2, lmask, hmask, dsta;
|
||||||
|
|
||||||
|
@ -259,9 +259,9 @@ BlitRGBtoRGBSurfaceAlpha128MMX(SDL_BlitInfo * info)
|
||||||
static void
|
static void
|
||||||
BlitRGBtoRGBSurfaceAlphaMMX(SDL_BlitInfo * info)
|
BlitRGBtoRGBSurfaceAlphaMMX(SDL_BlitInfo * info)
|
||||||
{
|
{
|
||||||
SDL_PixelFormat *df = info->dst;
|
SDL_PixelFormat *df = info->dst_fmt;
|
||||||
Uint32 chanmask = df->Rmask | df->Gmask | df->Bmask;
|
Uint32 chanmask = df->Rmask | df->Gmask | df->Bmask;
|
||||||
unsigned alpha = (info->cmod >> 24);
|
unsigned alpha = info->a;
|
||||||
|
|
||||||
if (alpha == 128 && (df->Rmask | df->Gmask | df->Bmask) == 0x00FFFFFF) {
|
if (alpha == 128 && (df->Rmask | df->Gmask | df->Bmask) == 0x00FFFFFF) {
|
||||||
/* only call a128 version when R,G,B occupy lower bits */
|
/* only call a128 version when R,G,B occupy lower bits */
|
||||||
|
@ -270,9 +270,9 @@ BlitRGBtoRGBSurfaceAlphaMMX(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *srcp = (Uint32 *) info->src;
|
Uint32 *srcp = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip >> 2;
|
int srcskip = info->src_skip >> 2;
|
||||||
Uint32 *dstp = (Uint32 *) info->dst;
|
Uint32 *dstp = (Uint32 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 2;
|
int dstskip = info->dst_skip >> 2;
|
||||||
Uint32 dalpha = df->Amask;
|
Uint32 dalpha = df->Amask;
|
||||||
Uint32 amult;
|
Uint32 amult;
|
||||||
|
|
||||||
|
@ -359,10 +359,10 @@ BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *srcp = (Uint32 *) info->src;
|
Uint32 *srcp = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip >> 2;
|
int srcskip = info->src_skip >> 2;
|
||||||
Uint32 *dstp = (Uint32 *) info->dst;
|
Uint32 *dstp = (Uint32 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 2;
|
int dstskip = info->dst_skip >> 2;
|
||||||
SDL_PixelFormat *sf = info->src;
|
SDL_PixelFormat *sf = info->src_fmt;
|
||||||
Uint32 chanmask = sf->Rmask | sf->Gmask | sf->Bmask;
|
Uint32 chanmask = sf->Rmask | sf->Gmask | sf->Bmask;
|
||||||
Uint32 amask = sf->Amask;
|
Uint32 amask = sf->Amask;
|
||||||
Uint32 ashift = sf->Ashift;
|
Uint32 ashift = sf->Ashift;
|
||||||
|
@ -544,10 +544,10 @@ Blit32to565PixelAlphaAltivec(SDL_BlitInfo * info)
|
||||||
{
|
{
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = (Uint8 *) info->src;
|
Uint8 *src = (Uint8 *) info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = (Uint8 *) info->dst;
|
Uint8 *dst = (Uint8 *) info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
|
|
||||||
vector unsigned char v0 = vec_splat_u8(0);
|
vector unsigned char v0 = vec_splat_u8(0);
|
||||||
vector unsigned short v8_16 = vec_splat_u16(8);
|
vector unsigned short v8_16 = vec_splat_u16(8);
|
||||||
|
@ -720,15 +720,15 @@ Blit32to32SurfaceAlphaKeyAltivec(SDL_BlitInfo * info)
|
||||||
{
|
{
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *srcp = (Uint32 *) info->src;
|
Uint32 *srcp = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip >> 2;
|
int srcskip = info->src_skip >> 2;
|
||||||
Uint32 *dstp = (Uint32 *) info->dst;
|
Uint32 *dstp = (Uint32 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 2;
|
int dstskip = info->dst_skip >> 2;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
unsigned sA = (info->cmod >> 24);
|
unsigned sA = info->a;
|
||||||
unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
|
unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
|
||||||
Uint32 rgbmask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
|
Uint32 rgbmask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
vector unsigned char mergePermute;
|
vector unsigned char mergePermute;
|
||||||
vector unsigned char vsrcPermute;
|
vector unsigned char vsrcPermute;
|
||||||
vector unsigned char vdstPermute;
|
vector unsigned char vdstPermute;
|
||||||
|
@ -847,11 +847,11 @@ Blit32to32PixelAlphaAltivec(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *srcp = (Uint32 *) info->src;
|
Uint32 *srcp = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip >> 2;
|
int srcskip = info->src_skip >> 2;
|
||||||
Uint32 *dstp = (Uint32 *) info->dst;
|
Uint32 *dstp = (Uint32 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 2;
|
int dstskip = info->dst_skip >> 2;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
vector unsigned char mergePermute;
|
vector unsigned char mergePermute;
|
||||||
vector unsigned char valphaPermute;
|
vector unsigned char valphaPermute;
|
||||||
vector unsigned char vsrcPermute;
|
vector unsigned char vsrcPermute;
|
||||||
|
@ -945,9 +945,9 @@ BlitRGBtoRGBPixelAlphaAltivec(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *srcp = (Uint32 *) info->src;
|
Uint32 *srcp = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip >> 2;
|
int srcskip = info->src_skip >> 2;
|
||||||
Uint32 *dstp = (Uint32 *) info->dst;
|
Uint32 *dstp = (Uint32 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 2;
|
int dstskip = info->dst_skip >> 2;
|
||||||
vector unsigned char mergePermute;
|
vector unsigned char mergePermute;
|
||||||
vector unsigned char valphaPermute;
|
vector unsigned char valphaPermute;
|
||||||
vector unsigned char valphamask;
|
vector unsigned char valphamask;
|
||||||
|
@ -1042,12 +1042,12 @@ Blit32to32SurfaceAlphaAltivec(SDL_BlitInfo * info)
|
||||||
/* XXX : 6 */
|
/* XXX : 6 */
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *srcp = (Uint32 *) info->src;
|
Uint32 *srcp = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip >> 2;
|
int srcskip = info->src_skip >> 2;
|
||||||
Uint32 *dstp = (Uint32 *) info->dst;
|
Uint32 *dstp = (Uint32 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 2;
|
int dstskip = info->dst_skip >> 2;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
unsigned sA = (info->cmod >> 24);
|
unsigned sA = info->a;
|
||||||
unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
|
unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
|
||||||
vector unsigned char mergePermute;
|
vector unsigned char mergePermute;
|
||||||
vector unsigned char vsrcPermute;
|
vector unsigned char vsrcPermute;
|
||||||
|
@ -1136,12 +1136,12 @@ Blit32to32SurfaceAlphaAltivec(SDL_BlitInfo * info)
|
||||||
static void
|
static void
|
||||||
BlitRGBtoRGBSurfaceAlphaAltivec(SDL_BlitInfo * info)
|
BlitRGBtoRGBSurfaceAlphaAltivec(SDL_BlitInfo * info)
|
||||||
{
|
{
|
||||||
unsigned alpha = (info->cmod >> 24);
|
unsigned alpha = info->a;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *srcp = (Uint32 *) info->src;
|
Uint32 *srcp = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip >> 2;
|
int srcskip = info->src_skip >> 2;
|
||||||
Uint32 *dstp = (Uint32 *) info->dst;
|
Uint32 *dstp = (Uint32 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 2;
|
int dstskip = info->dst_skip >> 2;
|
||||||
vector unsigned char mergePermute;
|
vector unsigned char mergePermute;
|
||||||
vector unsigned char valpha;
|
vector unsigned char valpha;
|
||||||
vector unsigned char valphamask;
|
vector unsigned char valphamask;
|
||||||
|
@ -1227,9 +1227,9 @@ BlitRGBtoRGBSurfaceAlpha128(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *srcp = (Uint32 *) info->src;
|
Uint32 *srcp = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip >> 2;
|
int srcskip = info->src_skip >> 2;
|
||||||
Uint32 *dstp = (Uint32 *) info->dst;
|
Uint32 *dstp = (Uint32 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 2;
|
int dstskip = info->dst_skip >> 2;
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
|
@ -1249,16 +1249,16 @@ BlitRGBtoRGBSurfaceAlpha128(SDL_BlitInfo * info)
|
||||||
static void
|
static void
|
||||||
BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo * info)
|
BlitRGBtoRGBSurfaceAlpha(SDL_BlitInfo * info)
|
||||||
{
|
{
|
||||||
unsigned alpha = (info->cmod >> 24);
|
unsigned alpha = info->a;
|
||||||
if (alpha == 128) {
|
if (alpha == 128) {
|
||||||
BlitRGBtoRGBSurfaceAlpha128(info);
|
BlitRGBtoRGBSurfaceAlpha128(info);
|
||||||
} else {
|
} else {
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *srcp = (Uint32 *) info->src;
|
Uint32 *srcp = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip >> 2;
|
int srcskip = info->src_skip >> 2;
|
||||||
Uint32 *dstp = (Uint32 *) info->dst;
|
Uint32 *dstp = (Uint32 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 2;
|
int dstskip = info->dst_skip >> 2;
|
||||||
Uint32 s;
|
Uint32 s;
|
||||||
Uint32 d;
|
Uint32 d;
|
||||||
Uint32 s1;
|
Uint32 s1;
|
||||||
|
@ -1324,9 +1324,9 @@ BlitRGBtoRGBPixelAlpha(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *srcp = (Uint32 *) info->src;
|
Uint32 *srcp = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip >> 2;
|
int srcskip = info->src_skip >> 2;
|
||||||
Uint32 *dstp = (Uint32 *) info->dst;
|
Uint32 *dstp = (Uint32 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 2;
|
int dstskip = info->dst_skip >> 2;
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
|
@ -1377,10 +1377,10 @@ BlitRGBtoRGBPixelAlphaMMX3DNOW(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *srcp = (Uint32 *) info->src;
|
Uint32 *srcp = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip >> 2;
|
int srcskip = info->src_skip >> 2;
|
||||||
Uint32 *dstp = (Uint32 *) info->dst;
|
Uint32 *dstp = (Uint32 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 2;
|
int dstskip = info->dst_skip >> 2;
|
||||||
SDL_PixelFormat *sf = info->src;
|
SDL_PixelFormat *sf = info->src_fmt;
|
||||||
Uint32 chanmask = sf->Rmask | sf->Gmask | sf->Bmask;
|
Uint32 chanmask = sf->Rmask | sf->Gmask | sf->Bmask;
|
||||||
Uint32 amask = sf->Amask;
|
Uint32 amask = sf->Amask;
|
||||||
Uint32 ashift = sf->Ashift;
|
Uint32 ashift = sf->Ashift;
|
||||||
|
@ -1459,9 +1459,9 @@ Blit16to16SurfaceAlpha128(SDL_BlitInfo * info, Uint16 mask)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint16 *srcp = (Uint16 *) info->src;
|
Uint16 *srcp = (Uint16 *) info->src;
|
||||||
int srcskip = info->s_skip >> 1;
|
int srcskip = info->src_skip >> 1;
|
||||||
Uint16 *dstp = (Uint16 *) info->dst;
|
Uint16 *dstp = (Uint16 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 1;
|
int dstskip = info->dst_skip >> 1;
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
if (((uintptr_t) srcp ^ (uintptr_t) dstp) & 2) {
|
if (((uintptr_t) srcp ^ (uintptr_t) dstp) & 2) {
|
||||||
|
@ -1558,16 +1558,16 @@ Blit16to16SurfaceAlpha128(SDL_BlitInfo * info, Uint16 mask)
|
||||||
static void
|
static void
|
||||||
Blit565to565SurfaceAlphaMMX(SDL_BlitInfo * info)
|
Blit565to565SurfaceAlphaMMX(SDL_BlitInfo * info)
|
||||||
{
|
{
|
||||||
unsigned alpha = (info->cmod >> 24);
|
unsigned alpha = info->a;
|
||||||
if (alpha == 128) {
|
if (alpha == 128) {
|
||||||
Blit16to16SurfaceAlpha128(info, 0xf7de);
|
Blit16to16SurfaceAlpha128(info, 0xf7de);
|
||||||
} else {
|
} else {
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint16 *srcp = (Uint16 *) info->src;
|
Uint16 *srcp = (Uint16 *) info->src;
|
||||||
int srcskip = info->s_skip >> 1;
|
int srcskip = info->src_skip >> 1;
|
||||||
Uint16 *dstp = (Uint16 *) info->dst;
|
Uint16 *dstp = (Uint16 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 1;
|
int dstskip = info->dst_skip >> 1;
|
||||||
Uint32 s, d;
|
Uint32 s, d;
|
||||||
|
|
||||||
__m64 src1, dst1, src2, dst2, gmask, bmask, mm_res, mm_alpha;
|
__m64 src1, dst1, src2, dst2, gmask, bmask, mm_res, mm_alpha;
|
||||||
|
@ -1695,16 +1695,16 @@ Blit565to565SurfaceAlphaMMX(SDL_BlitInfo * info)
|
||||||
static void
|
static void
|
||||||
Blit555to555SurfaceAlphaMMX(SDL_BlitInfo * info)
|
Blit555to555SurfaceAlphaMMX(SDL_BlitInfo * info)
|
||||||
{
|
{
|
||||||
unsigned alpha = (info->cmod >> 24);
|
unsigned alpha = info->a;
|
||||||
if (alpha == 128) {
|
if (alpha == 128) {
|
||||||
Blit16to16SurfaceAlpha128(info, 0xfbde);
|
Blit16to16SurfaceAlpha128(info, 0xfbde);
|
||||||
} else {
|
} else {
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint16 *srcp = (Uint16 *) info->src;
|
Uint16 *srcp = (Uint16 *) info->src;
|
||||||
int srcskip = info->s_skip >> 1;
|
int srcskip = info->src_skip >> 1;
|
||||||
Uint16 *dstp = (Uint16 *) info->dst;
|
Uint16 *dstp = (Uint16 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 1;
|
int dstskip = info->dst_skip >> 1;
|
||||||
Uint32 s, d;
|
Uint32 s, d;
|
||||||
|
|
||||||
__m64 src1, dst1, src2, dst2, rmask, gmask, bmask, mm_res, mm_alpha;
|
__m64 src1, dst1, src2, dst2, rmask, gmask, bmask, mm_res, mm_alpha;
|
||||||
|
@ -1835,16 +1835,16 @@ Blit555to555SurfaceAlphaMMX(SDL_BlitInfo * info)
|
||||||
static void
|
static void
|
||||||
Blit565to565SurfaceAlpha(SDL_BlitInfo * info)
|
Blit565to565SurfaceAlpha(SDL_BlitInfo * info)
|
||||||
{
|
{
|
||||||
unsigned alpha = (info->cmod >> 24);
|
unsigned alpha = info->a;
|
||||||
if (alpha == 128) {
|
if (alpha == 128) {
|
||||||
Blit16to16SurfaceAlpha128(info, 0xf7de);
|
Blit16to16SurfaceAlpha128(info, 0xf7de);
|
||||||
} else {
|
} else {
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint16 *srcp = (Uint16 *) info->src;
|
Uint16 *srcp = (Uint16 *) info->src;
|
||||||
int srcskip = info->s_skip >> 1;
|
int srcskip = info->src_skip >> 1;
|
||||||
Uint16 *dstp = (Uint16 *) info->dst;
|
Uint16 *dstp = (Uint16 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 1;
|
int dstskip = info->dst_skip >> 1;
|
||||||
alpha >>= 3; /* downscale alpha to 5 bits */
|
alpha >>= 3; /* downscale alpha to 5 bits */
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
|
@ -1874,16 +1874,16 @@ Blit565to565SurfaceAlpha(SDL_BlitInfo * info)
|
||||||
static void
|
static void
|
||||||
Blit555to555SurfaceAlpha(SDL_BlitInfo * info)
|
Blit555to555SurfaceAlpha(SDL_BlitInfo * info)
|
||||||
{
|
{
|
||||||
unsigned alpha = (info->cmod >> 24); /* downscale alpha to 5 bits */
|
unsigned alpha = info->a; /* downscale alpha to 5 bits */
|
||||||
if (alpha == 128) {
|
if (alpha == 128) {
|
||||||
Blit16to16SurfaceAlpha128(info, 0xfbde);
|
Blit16to16SurfaceAlpha128(info, 0xfbde);
|
||||||
} else {
|
} else {
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint16 *srcp = (Uint16 *) info->src;
|
Uint16 *srcp = (Uint16 *) info->src;
|
||||||
int srcskip = info->s_skip >> 1;
|
int srcskip = info->src_skip >> 1;
|
||||||
Uint16 *dstp = (Uint16 *) info->dst;
|
Uint16 *dstp = (Uint16 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 1;
|
int dstskip = info->dst_skip >> 1;
|
||||||
alpha >>= 3; /* downscale alpha to 5 bits */
|
alpha >>= 3; /* downscale alpha to 5 bits */
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
|
@ -1916,9 +1916,9 @@ BlitARGBto565PixelAlpha(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *srcp = (Uint32 *) info->src;
|
Uint32 *srcp = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip >> 2;
|
int srcskip = info->src_skip >> 2;
|
||||||
Uint16 *dstp = (Uint16 *) info->dst;
|
Uint16 *dstp = (Uint16 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 1;
|
int dstskip = info->dst_skip >> 1;
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
|
@ -1962,9 +1962,9 @@ BlitARGBto555PixelAlpha(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *srcp = (Uint32 *) info->src;
|
Uint32 *srcp = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip >> 2;
|
int srcskip = info->src_skip >> 2;
|
||||||
Uint16 *dstp = (Uint16 *) info->dst;
|
Uint16 *dstp = (Uint16 *) info->dst;
|
||||||
int dstskip = info->dst_pitch >> 1;
|
int dstskip = info->dst_skip >> 1;
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
|
@ -2009,14 +2009,14 @@ BlitNtoNSurfaceAlpha(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->BytesPerPixel;
|
||||||
int dstbpp = dstfmt->BytesPerPixel;
|
int dstbpp = dstfmt->BytesPerPixel;
|
||||||
unsigned sA = (info->cmod >> 24);
|
unsigned sA = info->a;
|
||||||
unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
|
unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
|
||||||
|
|
||||||
if (sA) {
|
if (sA) {
|
||||||
|
@ -2053,15 +2053,15 @@ BlitNtoNSurfaceAlphaKey(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->BytesPerPixel;
|
||||||
int dstbpp = dstfmt->BytesPerPixel;
|
int dstbpp = dstfmt->BytesPerPixel;
|
||||||
unsigned sA = (info->cmod >> 24);
|
unsigned sA = info->a;
|
||||||
unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
|
unsigned dA = dstfmt->Amask ? SDL_ALPHA_OPAQUE : 0;
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
|
@ -2099,11 +2099,11 @@ BlitNtoNPixelAlpha(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
|
|
||||||
int srcbpp;
|
int srcbpp;
|
||||||
int dstbpp;
|
int dstbpp;
|
||||||
|
@ -2147,81 +2147,14 @@ BlitNtoNPixelAlpha(SDL_BlitInfo * info)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SDL_loblit
|
SDL_BlitFunc
|
||||||
SDL_CalculateAlphaBlit(SDL_Surface * surface, int blit_index)
|
SDL_CalculateBlitA(SDL_Surface * surface)
|
||||||
{
|
{
|
||||||
SDL_PixelFormat *sf = surface->format;
|
SDL_PixelFormat *sf = surface->format;
|
||||||
SDL_PixelFormat *df = surface->map->dst->format;
|
SDL_PixelFormat *df = surface->map->dst->format;
|
||||||
|
|
||||||
if (sf->Amask == 0) {
|
switch (surface->map->info.flags) {
|
||||||
if ((surface->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) {
|
case SDL_COPY_BLEND:
|
||||||
if (df->BytesPerPixel == 1)
|
|
||||||
return BlitNto1SurfaceAlphaKey;
|
|
||||||
else
|
|
||||||
#if SDL_ALTIVEC_BLITTERS
|
|
||||||
if (sf->BytesPerPixel == 4 && df->BytesPerPixel == 4 &&
|
|
||||||
SDL_HasAltiVec())
|
|
||||||
return Blit32to32SurfaceAlphaKeyAltivec;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
return BlitNtoNSurfaceAlphaKey;
|
|
||||||
} else {
|
|
||||||
/* Per-surface alpha blits */
|
|
||||||
switch (df->BytesPerPixel) {
|
|
||||||
case 1:
|
|
||||||
return BlitNto1SurfaceAlpha;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
if (surface->map->identity) {
|
|
||||||
if (df->Gmask == 0x7e0) {
|
|
||||||
#ifdef __MMX__
|
|
||||||
if (SDL_HasMMX())
|
|
||||||
return Blit565to565SurfaceAlphaMMX;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
return Blit565to565SurfaceAlpha;
|
|
||||||
} else if (df->Gmask == 0x3e0) {
|
|
||||||
#ifdef __MMX__
|
|
||||||
if (SDL_HasMMX())
|
|
||||||
return Blit555to555SurfaceAlphaMMX;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
return Blit555to555SurfaceAlpha;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return BlitNtoNSurfaceAlpha;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
if (sf->Rmask == df->Rmask
|
|
||||||
&& sf->Gmask == df->Gmask
|
|
||||||
&& sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
|
|
||||||
#ifdef __MMX__
|
|
||||||
if (sf->Rshift % 8 == 0
|
|
||||||
&& sf->Gshift % 8 == 0
|
|
||||||
&& sf->Bshift % 8 == 0 && SDL_HasMMX())
|
|
||||||
return BlitRGBtoRGBSurfaceAlphaMMX;
|
|
||||||
#endif
|
|
||||||
if ((sf->Rmask | sf->Gmask | sf->Bmask) == 0xffffff) {
|
|
||||||
#if SDL_ALTIVEC_BLITTERS
|
|
||||||
if (SDL_HasAltiVec())
|
|
||||||
return BlitRGBtoRGBSurfaceAlphaAltivec;
|
|
||||||
#endif
|
|
||||||
return BlitRGBtoRGBSurfaceAlpha;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#if SDL_ALTIVEC_BLITTERS
|
|
||||||
if ((sf->BytesPerPixel == 4) && SDL_HasAltiVec())
|
|
||||||
return Blit32to32SurfaceAlphaAltivec;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
return BlitNtoNSurfaceAlpha;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
default:
|
|
||||||
return BlitNtoNSurfaceAlpha;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Per-pixel alpha blits */
|
/* Per-pixel alpha blits */
|
||||||
switch (df->BytesPerPixel) {
|
switch (df->BytesPerPixel) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -2284,7 +2217,84 @@ SDL_CalculateAlphaBlit(SDL_Surface * surface, int blit_index)
|
||||||
default:
|
default:
|
||||||
return BlitNtoNPixelAlpha;
|
return BlitNtoNPixelAlpha;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
|
||||||
|
if (sf->Amask == 0) {
|
||||||
|
/* Per-surface alpha blits */
|
||||||
|
switch (df->BytesPerPixel) {
|
||||||
|
case 1:
|
||||||
|
return BlitNto1SurfaceAlpha;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
if (surface->map->identity) {
|
||||||
|
if (df->Gmask == 0x7e0) {
|
||||||
|
#ifdef __MMX__
|
||||||
|
if (SDL_HasMMX())
|
||||||
|
return Blit565to565SurfaceAlphaMMX;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
return Blit565to565SurfaceAlpha;
|
||||||
|
} else if (df->Gmask == 0x3e0) {
|
||||||
|
#ifdef __MMX__
|
||||||
|
if (SDL_HasMMX())
|
||||||
|
return Blit555to555SurfaceAlphaMMX;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
return Blit555to555SurfaceAlpha;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return BlitNtoNSurfaceAlpha;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
if (sf->Rmask == df->Rmask
|
||||||
|
&& sf->Gmask == df->Gmask
|
||||||
|
&& sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
|
||||||
|
#ifdef __MMX__
|
||||||
|
if (sf->Rshift % 8 == 0
|
||||||
|
&& sf->Gshift % 8 == 0
|
||||||
|
&& sf->Bshift % 8 == 0 && SDL_HasMMX())
|
||||||
|
return BlitRGBtoRGBSurfaceAlphaMMX;
|
||||||
|
#endif
|
||||||
|
if ((sf->Rmask | sf->Gmask | sf->Bmask) == 0xffffff) {
|
||||||
|
#if SDL_ALTIVEC_BLITTERS
|
||||||
|
if (SDL_HasAltiVec())
|
||||||
|
return BlitRGBtoRGBSurfaceAlphaAltivec;
|
||||||
|
#endif
|
||||||
|
return BlitRGBtoRGBSurfaceAlpha;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#if SDL_ALTIVEC_BLITTERS
|
||||||
|
if ((sf->BytesPerPixel == 4) && SDL_HasAltiVec())
|
||||||
|
return Blit32to32SurfaceAlphaAltivec;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
return BlitNtoNSurfaceAlpha;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
default:
|
||||||
|
return BlitNtoNSurfaceAlpha;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
|
||||||
|
if (sf->Amask == 0) {
|
||||||
|
if (df->BytesPerPixel == 1)
|
||||||
|
return BlitNto1SurfaceAlphaKey;
|
||||||
|
else
|
||||||
|
#if SDL_ALTIVEC_BLITTERS
|
||||||
|
if (sf->BytesPerPixel == 4 && df->BytesPerPixel == 4 &&
|
||||||
|
SDL_HasAltiVec())
|
||||||
|
return Blit32to32SurfaceAlphaKeyAltivec;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
return BlitNtoNSurfaceAlphaKey;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -160,9 +160,9 @@ Blit_RGB888_RGB565Altivec(SDL_BlitInfo * info)
|
||||||
{
|
{
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = (Uint8 *) info->src;
|
Uint8 *src = (Uint8 *) info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = (Uint8 *) info->dst;
|
Uint8 *dst = (Uint8 *) info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src;
|
||||||
vector unsigned char valpha = vec_splat_u8(0);
|
vector unsigned char valpha = vec_splat_u8(0);
|
||||||
vector unsigned char vpermute = calc_swizzle32(srcfmt, NULL);
|
vector unsigned char vpermute = calc_swizzle32(srcfmt, NULL);
|
||||||
|
@ -264,9 +264,9 @@ Blit_RGB565_32Altivec(SDL_BlitInfo * info)
|
||||||
{
|
{
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = (Uint8 *) info->src;
|
Uint8 *src = (Uint8 *) info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = (Uint8 *) info->dst;
|
Uint8 *dst = (Uint8 *) info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst;
|
||||||
unsigned alpha;
|
unsigned alpha;
|
||||||
|
@ -322,8 +322,8 @@ Blit_RGB565_32Altivec(SDL_BlitInfo * info)
|
||||||
vf800 = (vector unsigned short) vec_splat_u8(-7);
|
vf800 = (vector unsigned short) vec_splat_u8(-7);
|
||||||
vf800 = vec_sl(vf800, vec_splat_u16(8));
|
vf800 = vec_sl(vf800, vec_splat_u16(8));
|
||||||
|
|
||||||
if (dstfmt->Amask && (info->cmod >> 24)) {
|
if (dstfmt->Amask && info->a) {
|
||||||
((unsigned char *) &valpha)[0] = alpha = (info->cmod >> 24);
|
((unsigned char *) &valpha)[0] = alpha = info->a;
|
||||||
valpha = vec_splat(valpha, 0);
|
valpha = vec_splat(valpha, 0);
|
||||||
} else {
|
} else {
|
||||||
alpha = 0;
|
alpha = 0;
|
||||||
|
@ -412,9 +412,9 @@ Blit_RGB555_32Altivec(SDL_BlitInfo * info)
|
||||||
{
|
{
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = (Uint8 *) info->src;
|
Uint8 *src = (Uint8 *) info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = (Uint8 *) info->dst;
|
Uint8 *dst = (Uint8 *) info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst;
|
||||||
unsigned alpha;
|
unsigned alpha;
|
||||||
|
@ -470,8 +470,8 @@ Blit_RGB555_32Altivec(SDL_BlitInfo * info)
|
||||||
vf800 = (vector unsigned short) vec_splat_u8(-7);
|
vf800 = (vector unsigned short) vec_splat_u8(-7);
|
||||||
vf800 = vec_sl(vf800, vec_splat_u16(8));
|
vf800 = vec_sl(vf800, vec_splat_u16(8));
|
||||||
|
|
||||||
if (dstfmt->Amask && (info->cmod >> 24)) {
|
if (dstfmt->Amask && info->a) {
|
||||||
((unsigned char *) &valpha)[0] = alpha = (info->cmod >> 24);
|
((unsigned char *) &valpha)[0] = alpha = info->a;
|
||||||
valpha = vec_splat(valpha, 0);
|
valpha = vec_splat(valpha, 0);
|
||||||
} else {
|
} else {
|
||||||
alpha = 0;
|
alpha = 0;
|
||||||
|
@ -561,17 +561,17 @@ Blit32to32KeyAltivec(SDL_BlitInfo * info)
|
||||||
{
|
{
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *srcp = (Uint32 *) info->src;
|
Uint32 *srcp = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint32 *dstp = (Uint32 *) info->dst;
|
Uint32 *dstp = (Uint32 *) info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->BytesPerPixel;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst;
|
||||||
int dstbpp = dstfmt->BytesPerPixel;
|
int dstbpp = dstfmt->BytesPerPixel;
|
||||||
int copy_alpha = (srcfmt->Amask && dstfmt->Amask);
|
int copy_alpha = (srcfmt->Amask && dstfmt->Amask);
|
||||||
unsigned alpha = dstfmt->Amask ? (info->cmod >> 24) : 0;
|
unsigned alpha = dstfmt->Amask ? info->a : 0;
|
||||||
Uint32 rgbmask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
|
Uint32 rgbmask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
vector unsigned int valpha;
|
vector unsigned int valpha;
|
||||||
vector unsigned char vpermute;
|
vector unsigned char vpermute;
|
||||||
vector unsigned char vzero;
|
vector unsigned char vzero;
|
||||||
|
@ -679,17 +679,17 @@ ConvertAltivec32to32_noprefetch(SDL_BlitInfo * info)
|
||||||
{
|
{
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *src = (Uint32 *) info->src;
|
Uint32 *src = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint32 *dst = (Uint32 *) info->dst;
|
Uint32 *dst = (Uint32 *) info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst;
|
||||||
vector unsigned int vzero = vec_splat_u32(0);
|
vector unsigned int vzero = vec_splat_u32(0);
|
||||||
vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
|
vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
|
||||||
if (dstfmt->Amask && !srcfmt->Amask) {
|
if (dstfmt->Amask && !srcfmt->Amask) {
|
||||||
if ((info->cmod >> 24)) {
|
if (info->a) {
|
||||||
vector unsigned char valpha;
|
vector unsigned char valpha;
|
||||||
((unsigned char *) &valpha)[0] = (info->cmod >> 24);
|
((unsigned char *) &valpha)[0] = info->a;
|
||||||
vzero = (vector unsigned int) vec_splat(valpha, 0);
|
vzero = (vector unsigned int) vec_splat(valpha, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -758,17 +758,17 @@ ConvertAltivec32to32_prefetch(SDL_BlitInfo * info)
|
||||||
|
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *src = (Uint32 *) info->src;
|
Uint32 *src = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint32 *dst = (Uint32 *) info->dst;
|
Uint32 *dst = (Uint32 *) info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst;
|
||||||
vector unsigned int vzero = vec_splat_u32(0);
|
vector unsigned int vzero = vec_splat_u32(0);
|
||||||
vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
|
vector unsigned char vpermute = calc_swizzle32(srcfmt, dstfmt);
|
||||||
if (dstfmt->Amask && !srcfmt->Amask) {
|
if (dstfmt->Amask && !srcfmt->Amask) {
|
||||||
if ((info->cmod >> 24)) {
|
if (info->a) {
|
||||||
vector unsigned char valpha;
|
vector unsigned char valpha;
|
||||||
((unsigned char *) &valpha)[0] = (info->cmod >> 24);
|
((unsigned char *) &valpha)[0] = info->a;
|
||||||
vzero = (vector unsigned int) vec_splat(valpha, 0);
|
vzero = (vector unsigned int) vec_splat(valpha, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -901,9 +901,9 @@ Blit_RGB888_index8(SDL_BlitInfo * info)
|
||||||
width = info->dst_w;
|
width = info->dst_w;
|
||||||
height = info->dst_h;
|
height = info->dst_h;
|
||||||
src = (Uint32 *) info->src;
|
src = (Uint32 *) info->src;
|
||||||
srcskip = info->s_skip / 4;
|
srcskip = info->src_skip / 4;
|
||||||
dst = info->dst;
|
dst = info->dst;
|
||||||
dstskip = info->dst_pitch;
|
dstskip = info->dst_skip;
|
||||||
map = info->table;
|
map = info->table;
|
||||||
|
|
||||||
if (map == NULL) {
|
if (map == NULL) {
|
||||||
|
@ -1018,9 +1018,9 @@ Blit_RGB888_RGB555(SDL_BlitInfo * info)
|
||||||
width = info->dst_w;
|
width = info->dst_w;
|
||||||
height = info->dst_h;
|
height = info->dst_h;
|
||||||
src = (Uint32 *) info->src;
|
src = (Uint32 *) info->src;
|
||||||
srcskip = info->s_skip / 4;
|
srcskip = info->src_skip / 4;
|
||||||
dst = (Uint16 *) info->dst;
|
dst = (Uint16 *) info->dst;
|
||||||
dstskip = info->dst_pitch / 2;
|
dstskip = info->dst_skip / 2;
|
||||||
|
|
||||||
#ifdef USE_DUFFS_LOOP
|
#ifdef USE_DUFFS_LOOP
|
||||||
while (height--) {
|
while (height--) {
|
||||||
|
@ -1142,9 +1142,9 @@ Blit_RGB888_RGB565(SDL_BlitInfo * info)
|
||||||
width = info->dst_w;
|
width = info->dst_w;
|
||||||
height = info->dst_h;
|
height = info->dst_h;
|
||||||
src = (Uint32 *) info->src;
|
src = (Uint32 *) info->src;
|
||||||
srcskip = info->s_skip / 4;
|
srcskip = info->src_skip / 4;
|
||||||
dst = (Uint16 *) info->dst;
|
dst = (Uint16 *) info->dst;
|
||||||
dstskip = info->dst_pitch / 2;
|
dstskip = info->dst_skip / 2;
|
||||||
|
|
||||||
#ifdef USE_DUFFS_LOOP
|
#ifdef USE_DUFFS_LOOP
|
||||||
while (height--) {
|
while (height--) {
|
||||||
|
@ -1255,9 +1255,9 @@ Blit_RGB565_32(SDL_BlitInfo * info, const Uint32 * map)
|
||||||
width = info->dst_w;
|
width = info->dst_w;
|
||||||
height = info->dst_h;
|
height = info->dst_h;
|
||||||
src = (Uint8 *) info->src;
|
src = (Uint8 *) info->src;
|
||||||
srcskip = info->s_skip;
|
srcskip = info->src_skip;
|
||||||
dst = (Uint32 *) info->dst;
|
dst = (Uint32 *) info->dst;
|
||||||
dstskip = info->dst_pitch / 4;
|
dstskip = info->dst_skip / 4;
|
||||||
|
|
||||||
#ifdef USE_DUFFS_LOOP
|
#ifdef USE_DUFFS_LOOP
|
||||||
while (height--) {
|
while (height--) {
|
||||||
|
@ -1877,9 +1877,9 @@ Blit_RGB888_index8_map(SDL_BlitInfo * info)
|
||||||
width = info->dst_w;
|
width = info->dst_w;
|
||||||
height = info->dst_h;
|
height = info->dst_h;
|
||||||
src = (Uint32 *) info->src;
|
src = (Uint32 *) info->src;
|
||||||
srcskip = info->s_skip / 4;
|
srcskip = info->src_skip / 4;
|
||||||
dst = info->dst;
|
dst = info->dst;
|
||||||
dstskip = info->dst_pitch;
|
dstskip = info->dst_skip;
|
||||||
map = info->table;
|
map = info->table;
|
||||||
|
|
||||||
#ifdef USE_DUFFS_LOOP
|
#ifdef USE_DUFFS_LOOP
|
||||||
|
@ -1950,11 +1950,11 @@ BlitNto1(SDL_BlitInfo * info)
|
||||||
width = info->dst_w;
|
width = info->dst_w;
|
||||||
height = info->dst_h;
|
height = info->dst_h;
|
||||||
src = info->src;
|
src = info->src;
|
||||||
srcskip = info->s_skip;
|
srcskip = info->src_skip;
|
||||||
dst = info->dst;
|
dst = info->dst;
|
||||||
dstskip = info->dst_pitch;
|
dstskip = info->dst_skip;
|
||||||
map = info->table;
|
map = info->table;
|
||||||
srcfmt = info->src;
|
srcfmt = info->src_fmt;
|
||||||
srcbpp = srcfmt->BytesPerPixel;
|
srcbpp = srcfmt->BytesPerPixel;
|
||||||
|
|
||||||
if (map == NULL) {
|
if (map == NULL) {
|
||||||
|
@ -2031,15 +2031,15 @@ Blit4to4MaskAlpha(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint32 *src = (Uint32 *) info->src;
|
Uint32 *src = (Uint32 *) info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint32 *dst = (Uint32 *) info->dst;
|
Uint32 *dst = (Uint32 *) info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
|
|
||||||
if (dstfmt->Amask) {
|
if (dstfmt->Amask) {
|
||||||
/* RGB->RGBA, SET_ALPHA */
|
/* RGB->RGBA, SET_ALPHA */
|
||||||
Uint32 mask = ((info->cmod >> 24) >> dstfmt->Aloss) << dstfmt->Ashift;
|
Uint32 mask = (info->a >> dstfmt->Aloss) << dstfmt->Ashift;
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
|
@ -2080,14 +2080,14 @@ BlitNtoN(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->BytesPerPixel;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int dstbpp = dstfmt->BytesPerPixel;
|
int dstbpp = dstfmt->BytesPerPixel;
|
||||||
unsigned alpha = dstfmt->Amask ? (info->cmod >> 24) : 0;
|
unsigned alpha = dstfmt->Amask ? info->a : 0;
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
|
@ -2115,12 +2115,12 @@ BlitNtoNCopyAlpha(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->BytesPerPixel;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int dstbpp = dstfmt->BytesPerPixel;
|
int dstbpp = dstfmt->BytesPerPixel;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
|
@ -2145,12 +2145,12 @@ BlitNto1Key(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
const Uint8 *palmap = info->table;
|
const Uint8 *palmap = info->table;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
Uint32 rgbmask = ~srcfmt->Amask;
|
Uint32 rgbmask = ~srcfmt->Amask;
|
||||||
int srcbpp;
|
int srcbpp;
|
||||||
Uint32 Pixel;
|
Uint32 Pixel;
|
||||||
|
@ -2211,11 +2211,11 @@ Blit2to2Key(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint16 *srcp = (Uint16 *) info->src;
|
Uint16 *srcp = (Uint16 *) info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint16 *dstp = (Uint16 *) info->dst;
|
Uint16 *dstp = (Uint16 *) info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
Uint32 rgbmask = ~info->src->Amask;
|
Uint32 rgbmask = ~info->src_fmt->Amask;
|
||||||
|
|
||||||
/* Set up some basic variables */
|
/* Set up some basic variables */
|
||||||
srcskip /= 2;
|
srcskip /= 2;
|
||||||
|
@ -2245,15 +2245,15 @@ BlitNtoNKey(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->BytesPerPixel;
|
||||||
int dstbpp = dstfmt->BytesPerPixel;
|
int dstbpp = dstfmt->BytesPerPixel;
|
||||||
unsigned alpha = dstfmt->Amask ? (info->cmod >> 24) : 0;
|
unsigned alpha = dstfmt->Amask ? info->a : 0;
|
||||||
Uint32 rgbmask = ~srcfmt->Amask;
|
Uint32 rgbmask = ~srcfmt->Amask;
|
||||||
|
|
||||||
/* Set up some basic variables */
|
/* Set up some basic variables */
|
||||||
|
@ -2288,12 +2288,12 @@ BlitNtoNKeyCopyAlpha(SDL_BlitInfo * info)
|
||||||
int width = info->dst_w;
|
int width = info->dst_w;
|
||||||
int height = info->dst_h;
|
int height = info->dst_h;
|
||||||
Uint8 *src = info->src;
|
Uint8 *src = info->src;
|
||||||
int srcskip = info->s_skip;
|
int srcskip = info->src_skip;
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_pitch;
|
int dstskip = info->dst_skip;
|
||||||
Uint32 ckey = info->ckey;
|
Uint32 ckey = info->colorkey;
|
||||||
SDL_PixelFormat *srcfmt = info->src;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
Uint32 rgbmask = ~srcfmt->Amask;
|
Uint32 rgbmask = ~srcfmt->Amask;
|
||||||
|
|
||||||
Uint8 srcbpp;
|
Uint8 srcbpp;
|
||||||
|
@ -2332,7 +2332,7 @@ struct blit_table
|
||||||
int dstbpp;
|
int dstbpp;
|
||||||
Uint32 dstR, dstG, dstB;
|
Uint32 dstR, dstG, dstB;
|
||||||
Uint32 blit_features;
|
Uint32 blit_features;
|
||||||
SDL_loblit blitfunc;
|
SDL_BlitFunc blitfunc;
|
||||||
enum
|
enum
|
||||||
{ NO_ALPHA = 1, SET_ALPHA = 2, COPY_ALPHA = 4 } alpha;
|
{ NO_ALPHA = 1, SET_ALPHA = 2, COPY_ALPHA = 4 } alpha;
|
||||||
};
|
};
|
||||||
|
@ -2403,60 +2403,34 @@ static const struct blit_table *normal_blit[] = {
|
||||||
/* Mask matches table, or table entry is zero */
|
/* Mask matches table, or table entry is zero */
|
||||||
#define MASKOK(x, y) (((x) == (y)) || ((y) == 0x00000000))
|
#define MASKOK(x, y) (((x) == (y)) || ((y) == 0x00000000))
|
||||||
|
|
||||||
SDL_loblit
|
SDL_BlitFunc
|
||||||
SDL_CalculateBlitN(SDL_Surface * surface, int blit_index)
|
SDL_CalculateBlitN(SDL_Surface * surface)
|
||||||
{
|
{
|
||||||
SDL_PixelFormat *srcfmt;
|
SDL_PixelFormat *srcfmt;
|
||||||
SDL_PixelFormat *dstfmt;
|
SDL_PixelFormat *dstfmt;
|
||||||
const struct blit_table *table;
|
const struct blit_table *table;
|
||||||
int which;
|
int which;
|
||||||
SDL_loblit blitfun;
|
SDL_BlitFunc blitfun;
|
||||||
|
|
||||||
/* Set up data for choosing the blit */
|
/* Set up data for choosing the blit */
|
||||||
srcfmt = surface->format;
|
srcfmt = surface->format;
|
||||||
dstfmt = surface->map->dst->format;
|
dstfmt = surface->map->dst->format;
|
||||||
|
|
||||||
if (blit_index & 2) {
|
|
||||||
/* alpha or alpha+colorkey */
|
|
||||||
return SDL_CalculateAlphaBlit(surface, blit_index);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We don't support destinations less than 8-bits */
|
/* We don't support destinations less than 8-bits */
|
||||||
if (dstfmt->BitsPerPixel < 8) {
|
if (dstfmt->BitsPerPixel < 8) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blit_index == 1) {
|
switch (surface->map->info.flags) {
|
||||||
/* colorkey blit: Here we don't have too many options, mostly
|
case 0:
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
blitfun = NULL;
|
blitfun = NULL;
|
||||||
if (dstfmt->BitsPerPixel == 8) {
|
if (dstfmt->BitsPerPixel == 8) {
|
||||||
/* We assume 8-bit destinations are palettized */
|
/* We assume 8-bit destinations are palettized */
|
||||||
if ((srcfmt->BytesPerPixel == 4) &&
|
if ((srcfmt->BytesPerPixel == 4) &&
|
||||||
(srcfmt->Rmask == 0x00FF0000) &&
|
(srcfmt->Rmask == 0x00FF0000) &&
|
||||||
(srcfmt->Gmask == 0x0000FF00) && (srcfmt->Bmask == 0x000000FF)) {
|
(srcfmt->Gmask == 0x0000FF00) &&
|
||||||
if (surface->map->table) {
|
(srcfmt->Bmask == 0x000000FF)) {
|
||||||
|
if (surface->map->info.table) {
|
||||||
blitfun = Blit_RGB888_index8_map;
|
blitfun = Blit_RGB888_index8_map;
|
||||||
} else {
|
} else {
|
||||||
blitfun = Blit_RGB888_index8;
|
blitfun = Blit_RGB888_index8;
|
||||||
|
@ -2487,25 +2461,43 @@ SDL_CalculateBlitN(SDL_Surface * surface, int blit_index)
|
||||||
|
|
||||||
if (blitfun == BlitNtoN) { /* default C fallback catch-all. Slow! */
|
if (blitfun == BlitNtoN) { /* default C fallback catch-all. Slow! */
|
||||||
/* Fastpath C fallback: 32bit RGB<->RGBA blit with matching RGB */
|
/* Fastpath C fallback: 32bit RGB<->RGBA blit with matching RGB */
|
||||||
if (srcfmt->BytesPerPixel == 4 && dstfmt->BytesPerPixel == 4 &&
|
if (srcfmt->BytesPerPixel == 4 && dstfmt->BytesPerPixel == 4
|
||||||
srcfmt->Rmask == dstfmt->Rmask &&
|
&& srcfmt->Rmask == dstfmt->Rmask
|
||||||
srcfmt->Gmask == dstfmt->Gmask &&
|
&& srcfmt->Gmask == dstfmt->Gmask
|
||||||
srcfmt->Bmask == dstfmt->Bmask) {
|
&& srcfmt->Bmask == dstfmt->Bmask) {
|
||||||
blitfun = Blit4to4MaskAlpha;
|
blitfun = Blit4to4MaskAlpha;
|
||||||
} else if (a_need == COPY_ALPHA) {
|
} else if (a_need == COPY_ALPHA) {
|
||||||
blitfun = BlitNtoNCopyAlpha;
|
blitfun = BlitNtoNCopyAlpha;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_ASM
|
|
||||||
if ((blitfun == BlitNtoN) || (blitfun == BlitNto1))
|
|
||||||
fprintf(stderr, "Using C blit\n");
|
|
||||||
else
|
|
||||||
fprintf(stderr, "Using optimized C blit\n");
|
|
||||||
#endif /* DEBUG_ASM */
|
|
||||||
|
|
||||||
return (blitfun);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -5262,7 +5262,7 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = {
|
SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = {
|
||||||
{ SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Scale },
|
{ SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Scale },
|
||||||
{ SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend },
|
{ SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend },
|
||||||
{ SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend_Scale },
|
{ SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_RGB888, (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD | SDL_COPY_NEAREST), SDL_CPU_ANY, SDL_Blit_RGB888_RGB888_Blend_Scale },
|
||||||
|
|
|
@ -95,12 +95,12 @@ SDL_BlitCopy(SDL_BlitInfo * info)
|
||||||
int w, h;
|
int w, h;
|
||||||
int srcskip, dstskip;
|
int srcskip, dstskip;
|
||||||
|
|
||||||
w = info->dst_w * info->dst->BytesPerPixel;
|
w = info->dst_w * info->dst_fmt->BytesPerPixel;
|
||||||
h = info->dst_h;
|
h = info->dst_h;
|
||||||
src = info->src;
|
src = info->src;
|
||||||
dst = info->dst;
|
dst = info->dst;
|
||||||
srcskip = w + info->s_skip;
|
srcskip = info->src_pitch;
|
||||||
dstskip = w + info->dst_pitch;
|
dstskip = info->dst_pitch;
|
||||||
|
|
||||||
#ifdef __SSE__
|
#ifdef __SSE__
|
||||||
if (SDL_HasSSE() && !((uintptr_t) src & 15) && !((uintptr_t) dst & 15)) {
|
if (SDL_HasSSE() && !((uintptr_t) src & 15) && !((uintptr_t) dst & 15)) {
|
||||||
|
@ -139,11 +139,11 @@ SDL_BlitCopyOverlap(SDL_BlitInfo * info)
|
||||||
int w, h;
|
int w, h;
|
||||||
int skip;
|
int skip;
|
||||||
|
|
||||||
w = info->dst_w * info->dst->BytesPerPixel;
|
w = info->dst_w * info->dst_fmt->BytesPerPixel;
|
||||||
h = info->dst_h;
|
h = info->dst_h;
|
||||||
src = info->src;
|
src = info->src;
|
||||||
dst = info->dst;
|
dst = info->dst;
|
||||||
skip = w + info->s_skip;
|
skip = info->src_pitch;
|
||||||
if ((dst < src) || (dst >= (src + h * skip))) {
|
if ((dst < src) || (dst >= (src + h * skip))) {
|
||||||
SDL_BlitCopy(info);
|
SDL_BlitCopy(info);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -668,12 +668,12 @@ Map1to1(SDL_Palette * src, SDL_Palette * dst, int *identical)
|
||||||
|
|
||||||
/* Map from Palette to BitField */
|
/* Map from Palette to BitField */
|
||||||
static Uint8 *
|
static Uint8 *
|
||||||
Map1toN(SDL_PixelFormat * src, Uint32 cmod, SDL_PixelFormat * dst)
|
Map1toN(SDL_PixelFormat * src, Uint8 Rmod, Uint8 Gmod, Uint8 Bmod, Uint8 Amod,
|
||||||
|
SDL_PixelFormat * dst)
|
||||||
{
|
{
|
||||||
Uint8 *map;
|
Uint8 *map;
|
||||||
int i;
|
int i;
|
||||||
int bpp;
|
int bpp;
|
||||||
unsigned Amod, Rmod, Gmod, Bmod;
|
|
||||||
SDL_Palette *pal = src->palette;
|
SDL_Palette *pal = src->palette;
|
||||||
|
|
||||||
bpp = ((dst->BytesPerPixel == 3) ? 4 : dst->BytesPerPixel);
|
bpp = ((dst->BytesPerPixel == 3) ? 4 : dst->BytesPerPixel);
|
||||||
|
@ -683,17 +683,12 @@ Map1toN(SDL_PixelFormat * src, Uint32 cmod, SDL_PixelFormat * dst)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Amod = (cmod >> 24) & 0xFF;
|
|
||||||
Rmod = (cmod >> 16) & 0xFF;
|
|
||||||
Gmod = (cmod >> 8) & 0xFF;
|
|
||||||
Bmod = (cmod >> 0) & 0xFF;
|
|
||||||
|
|
||||||
/* We memory copy to the pixel map so the endianness is preserved */
|
/* We memory copy to the pixel map so the endianness is preserved */
|
||||||
for (i = 0; i < pal->ncolors; ++i) {
|
for (i = 0; i < pal->ncolors; ++i) {
|
||||||
Uint8 A = Amod;
|
Uint8 A = Amod;
|
||||||
Uint8 R = (pal->colors[i].r * Rmod) / 255;
|
Uint8 R = (Uint8) ((pal->colors[i].r * Rmod) / 255);
|
||||||
Uint8 G = (pal->colors[i].g * Gmod) / 255;
|
Uint8 G = (Uint8) ((pal->colors[i].g * Gmod) / 255);
|
||||||
Uint8 B = (pal->colors[i].b * Bmod) / 255;
|
Uint8 B = (Uint8) ((pal->colors[i].b * Bmod) / 255);
|
||||||
ASSEMBLE_RGBA(&map[i * bpp], dst->BytesPerPixel, dst, R, G, B, A);
|
ASSEMBLE_RGBA(&map[i * bpp], dst->BytesPerPixel, dst, R, G, B, A);
|
||||||
}
|
}
|
||||||
return (map);
|
return (map);
|
||||||
|
@ -725,7 +720,10 @@ SDL_AllocBlitMap(void)
|
||||||
SDL_OutOfMemory();
|
SDL_OutOfMemory();
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
map->cmod = 0xFFFFFFFF;
|
map->info.r = 0xFF;
|
||||||
|
map->info.g = 0xFF;
|
||||||
|
map->info.b = 0xFF;
|
||||||
|
map->info.a = 0xFF;
|
||||||
|
|
||||||
/* It's ready to go */
|
/* It's ready to go */
|
||||||
return (map);
|
return (map);
|
||||||
|
@ -739,9 +737,9 @@ SDL_InvalidateMap(SDL_BlitMap * map)
|
||||||
}
|
}
|
||||||
map->dst = NULL;
|
map->dst = NULL;
|
||||||
map->format_version = (unsigned int) -1;
|
map->format_version = (unsigned int) -1;
|
||||||
if (map->table) {
|
if (map->info.table) {
|
||||||
SDL_free(map->table);
|
SDL_free(map->info.table);
|
||||||
map->table = NULL;
|
map->info.table = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int
|
int
|
||||||
|
@ -767,10 +765,10 @@ SDL_MapSurface(SDL_Surface * src, SDL_Surface * dst)
|
||||||
switch (dstfmt->BytesPerPixel) {
|
switch (dstfmt->BytesPerPixel) {
|
||||||
case 1:
|
case 1:
|
||||||
/* Palette --> Palette */
|
/* Palette --> Palette */
|
||||||
map->table =
|
map->info.table =
|
||||||
Map1to1(srcfmt->palette, dstfmt->palette, &map->identity);
|
Map1to1(srcfmt->palette, dstfmt->palette, &map->identity);
|
||||||
if (!map->identity) {
|
if (!map->identity) {
|
||||||
if (map->table == NULL) {
|
if (map->info.table == NULL) {
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -780,8 +778,10 @@ SDL_MapSurface(SDL_Surface * src, SDL_Surface * dst)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* Palette --> BitField */
|
/* Palette --> BitField */
|
||||||
map->table = Map1toN(srcfmt, src->map->cmod, dstfmt);
|
map->info.table =
|
||||||
if (map->table == NULL) {
|
Map1toN(srcfmt, src->map->info.r, src->map->info.g,
|
||||||
|
src->map->info.b, src->map->info.a, dstfmt);
|
||||||
|
if (map->info.table == NULL) {
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -791,9 +791,9 @@ SDL_MapSurface(SDL_Surface * src, SDL_Surface * dst)
|
||||||
switch (dstfmt->BytesPerPixel) {
|
switch (dstfmt->BytesPerPixel) {
|
||||||
case 1:
|
case 1:
|
||||||
/* BitField --> Palette */
|
/* BitField --> Palette */
|
||||||
map->table = MapNto1(srcfmt, dstfmt, &map->identity);
|
map->info.table = MapNto1(srcfmt, dstfmt, &map->identity);
|
||||||
if (!map->identity) {
|
if (!map->identity) {
|
||||||
if (map->table == NULL) {
|
if (map->info.table == NULL) {
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include "SDL_pixels_c.h"
|
#include "SDL_pixels_c.h"
|
||||||
#include "SDL_rect_c.h"
|
#include "SDL_rect_c.h"
|
||||||
#include "SDL_yuv_sw_c.h"
|
#include "SDL_yuv_sw_c.h"
|
||||||
#include "SDL_rendercopy.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* SDL surface based renderer implementation */
|
/* SDL surface based renderer implementation */
|
||||||
|
@ -431,81 +430,33 @@ SW_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
SW_UpdateRenderCopyFunc(SDL_Renderer * renderer, SDL_Texture * texture)
|
|
||||||
{
|
|
||||||
SDL_Window *window = SDL_GetWindowFromID(renderer->window);
|
|
||||||
SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
|
|
||||||
SDL_DisplayMode *displayMode = &display->current_mode;
|
|
||||||
SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
|
|
||||||
|
|
||||||
/* We only need a special copy function for advanced features */
|
|
||||||
if (texture->modMode
|
|
||||||
|| (texture->
|
|
||||||
blendMode & (SDL_TEXTUREBLENDMODE_ADD | SDL_TEXTUREBLENDMODE_MOD))
|
|
||||||
|| texture->scaleMode) {
|
|
||||||
surface->userdata =
|
|
||||||
SDL_GetRenderCopyFunc(texture->format, displayMode->format,
|
|
||||||
texture->modMode, texture->blendMode,
|
|
||||||
texture->scaleMode);
|
|
||||||
} else {
|
|
||||||
surface->userdata = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SW_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
|
SW_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||||
{
|
{
|
||||||
SW_UpdateRenderCopyFunc(renderer, texture);
|
SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
|
||||||
return 0;
|
return SDL_SetSurfaceColorMod(surface, texture->r, texture->g,
|
||||||
|
texture->b);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SW_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
|
SW_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||||
{
|
{
|
||||||
SW_UpdateRenderCopyFunc(renderer, texture);
|
SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
|
||||||
return 0;
|
return SDL_SetSurfaceAlphaMod(surface, texture->a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SW_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
|
SW_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||||
{
|
{
|
||||||
switch (texture->blendMode) {
|
SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
|
||||||
case SDL_TEXTUREBLENDMODE_NONE:
|
return SDL_SetSurfaceBlendMode(surface, texture->blendMode);
|
||||||
case SDL_TEXTUREBLENDMODE_MASK:
|
|
||||||
case SDL_TEXTUREBLENDMODE_BLEND:
|
|
||||||
case SDL_TEXTUREBLENDMODE_ADD:
|
|
||||||
case SDL_TEXTUREBLENDMODE_MOD:
|
|
||||||
SW_UpdateRenderCopyFunc(renderer, texture);
|
|
||||||
return 0;
|
|
||||||
default:
|
|
||||||
SDL_Unsupported();
|
|
||||||
texture->blendMode = SDL_TEXTUREBLENDMODE_NONE;
|
|
||||||
SW_UpdateRenderCopyFunc(renderer, texture);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SW_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture)
|
SW_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||||
{
|
{
|
||||||
switch (texture->scaleMode) {
|
SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
|
||||||
case SDL_TEXTURESCALEMODE_NONE:
|
return SDL_SetSurfaceBlendMode(surface, texture->scaleMode);
|
||||||
case SDL_TEXTURESCALEMODE_FAST:
|
|
||||||
SW_UpdateRenderCopyFunc(renderer, texture);
|
|
||||||
return 0;
|
|
||||||
case SDL_TEXTURESCALEMODE_SLOW:
|
|
||||||
case SDL_TEXTURESCALEMODE_BEST:
|
|
||||||
SDL_Unsupported();
|
|
||||||
texture->scaleMode = SDL_TEXTURESCALEMODE_FAST;
|
|
||||||
SW_UpdateRenderCopyFunc(renderer, texture);
|
|
||||||
return -1;
|
|
||||||
default:
|
|
||||||
SDL_Unsupported();
|
|
||||||
texture->scaleMode = SDL_TEXTURESCALEMODE_NONE;
|
|
||||||
SW_UpdateRenderCopyFunc(renderer, texture);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -629,47 +580,6 @@ SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||||
data->surface.pixels, data->surface.pitch);
|
data->surface.pixels, data->surface.pitch);
|
||||||
} else {
|
} else {
|
||||||
SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
|
SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
|
||||||
SDL_RenderCopyFunc copyfunc = (SDL_RenderCopyFunc) surface->userdata;
|
|
||||||
|
|
||||||
if (copyfunc) {
|
|
||||||
SDL_RenderCopyData copydata;
|
|
||||||
|
|
||||||
copydata.src =
|
|
||||||
(Uint8 *) surface->pixels + srcrect->y * surface->pitch +
|
|
||||||
srcrect->x * surface->format->BytesPerPixel;
|
|
||||||
copydata.src_w = srcrect->w;
|
|
||||||
copydata.src_h = srcrect->h;
|
|
||||||
copydata.src_pitch = surface->pitch;
|
|
||||||
copydata.dst = (Uint8 *) data->surface.pixels;
|
|
||||||
copydata.dst_w = dstrect->w;
|
|
||||||
copydata.dst_h = dstrect->h;
|
|
||||||
copydata.dst_pitch = data->surface.pitch;
|
|
||||||
copydata.flags = 0;
|
|
||||||
if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) {
|
|
||||||
copydata.flags |= SDL_RENDERCOPY_MODULATE_COLOR;
|
|
||||||
copydata.r = texture->r;
|
|
||||||
copydata.g = texture->g;
|
|
||||||
copydata.b = texture->b;
|
|
||||||
}
|
|
||||||
if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) {
|
|
||||||
copydata.flags |= SDL_RENDERCOPY_MODULATE_ALPHA;
|
|
||||||
copydata.a = texture->a;
|
|
||||||
}
|
|
||||||
if (texture->blendMode & SDL_TEXTUREBLENDMODE_MASK) {
|
|
||||||
copydata.flags |= SDL_RENDERCOPY_MASK;
|
|
||||||
} else if (texture->blendMode & SDL_TEXTUREBLENDMODE_BLEND) {
|
|
||||||
copydata.flags |= SDL_RENDERCOPY_BLEND;
|
|
||||||
} else if (texture->blendMode & SDL_TEXTUREBLENDMODE_ADD) {
|
|
||||||
copydata.flags |= SDL_RENDERCOPY_ADD;
|
|
||||||
} else if (texture->blendMode & SDL_TEXTUREBLENDMODE_MOD) {
|
|
||||||
copydata.flags |= SDL_RENDERCOPY_MOD;
|
|
||||||
}
|
|
||||||
if (texture->scaleMode) {
|
|
||||||
copydata.flags |= SDL_RENDERCOPY_NEAREST;
|
|
||||||
}
|
|
||||||
copyfunc(©data);
|
|
||||||
status = 0;
|
|
||||||
} else {
|
|
||||||
SDL_Rect real_srcrect = *srcrect;
|
SDL_Rect real_srcrect = *srcrect;
|
||||||
SDL_Rect real_dstrect;
|
SDL_Rect real_dstrect;
|
||||||
|
|
||||||
|
@ -683,7 +593,6 @@ SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||||
SDL_LowerBlit(surface, &real_srcrect, &data->surface,
|
SDL_LowerBlit(surface, &real_srcrect, &data->surface,
|
||||||
&real_dstrect);
|
&real_dstrect);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
data->renderer->UnlockTexture(data->renderer,
|
data->renderer->UnlockTexture(data->renderer,
|
||||||
data->texture[data->current_texture]);
|
data->texture[data->current_texture]);
|
||||||
return status;
|
return status;
|
||||||
|
|
|
@ -53,9 +53,6 @@ SDL_CreateRGBSurface(Uint32 flags,
|
||||||
SDL_FreeSurface(surface);
|
SDL_FreeSurface(surface);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (Amask) {
|
|
||||||
surface->flags |= SDL_SRCALPHA;
|
|
||||||
}
|
|
||||||
surface->w = width;
|
surface->w = width;
|
||||||
surface->h = height;
|
surface->h = height;
|
||||||
surface->pitch = SDL_CalculatePitch(surface);
|
surface->pitch = SDL_CalculatePitch(surface);
|
||||||
|
@ -138,6 +135,11 @@ SDL_CreateRGBSurface(Uint32 flags,
|
||||||
}
|
}
|
||||||
SDL_FormatChanged(surface);
|
SDL_FormatChanged(surface);
|
||||||
|
|
||||||
|
/* By default surface with an alpha mask are set up for blending */
|
||||||
|
if (Amask) {
|
||||||
|
SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_BLEND);
|
||||||
|
}
|
||||||
|
|
||||||
/* The surface is ready to go */
|
/* The surface is ready to go */
|
||||||
surface->refcount = 1;
|
surface->refcount = 1;
|
||||||
#ifdef CHECK_LEAKS
|
#ifdef CHECK_LEAKS
|
||||||
|
@ -212,26 +214,29 @@ SDL_SetSurfacePalette(SDL_Surface * surface, SDL_Palette * palette)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_SetSurfaceRLE(SDL_Surface *surface, int flag)
|
int
|
||||||
|
SDL_SetSurfaceRLE(SDL_Surface * surface, int flag)
|
||||||
{
|
{
|
||||||
Uint32 flags;
|
int flags;
|
||||||
|
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flags = surface->map->info.flags;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
surface->flags |= SDL_RLEACCELOK;
|
surface->map->info.flags |= SDL_COPY_RLE_DESIRED;
|
||||||
} else {
|
} else {
|
||||||
surface->flags &= ~SDL_RLEACCELOK;
|
surface->map->info.flags &= ~SDL_COPY_RLE_DESIRED;
|
||||||
}
|
}
|
||||||
if (surface->flags != flags) {
|
if (surface->map->info.flags != flags) {
|
||||||
SDL_InvalidateMap(surface->map);
|
SDL_InvalidateMap(surface->map);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key)
|
int
|
||||||
|
SDL_SetColorKey(SDL_Surface * surface, Uint32 flag, Uint32 key)
|
||||||
{
|
{
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
|
@ -253,10 +258,19 @@ int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key)
|
||||||
if (surface->map->info.flags != flags) {
|
if (surface->map->info.flags != flags) {
|
||||||
SDL_InvalidateMap(surface->map);
|
SDL_InvalidateMap(surface->map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Compatibility mode */
|
||||||
|
if (surface->map->info.flags & SDL_COPY_COLORKEY) {
|
||||||
|
surface->flags |= SDL_SRCCOLORKEY;
|
||||||
|
} else {
|
||||||
|
surface->flags &= ~SDL_SRCCOLORKEY;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)
|
int
|
||||||
|
SDL_SetSurfaceColorMod(SDL_Surface * surface, Uint8 r, Uint8 g, Uint8 b)
|
||||||
{
|
{
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
|
@ -281,7 +295,8 @@ int SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 * r, Uint8 * g, Uint8 * b)
|
int
|
||||||
|
SDL_GetSurfaceColorMod(SDL_Surface * surface, Uint8 * r, Uint8 * g, Uint8 * b)
|
||||||
{
|
{
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -299,7 +314,8 @@ int SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 * r, Uint8 * g, Uint8 * b
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha)
|
int
|
||||||
|
SDL_SetSurfaceAlphaMod(SDL_Surface * surface, Uint8 alpha)
|
||||||
{
|
{
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
|
@ -321,7 +337,8 @@ int SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 * alpha)
|
int
|
||||||
|
SDL_GetSurfaceAlphaMod(SDL_Surface * surface, Uint8 * alpha)
|
||||||
{
|
{
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -333,7 +350,8 @@ int SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 * alpha)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_SetSurfaceBlendMode(SDL_Surface *surface, int blendMode)
|
int
|
||||||
|
SDL_SetSurfaceBlendMode(SDL_Surface * surface, int blendMode)
|
||||||
{
|
{
|
||||||
int flags, status;
|
int flags, status;
|
||||||
|
|
||||||
|
@ -343,7 +361,8 @@ int SDL_SetSurfaceBlendMode(SDL_Surface *surface, int blendMode)
|
||||||
|
|
||||||
status = 0;
|
status = 0;
|
||||||
flags = surface->map->info.flags;
|
flags = surface->map->info.flags;
|
||||||
surface->map->info.flags &= ~(SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD);
|
surface->map->info.flags &=
|
||||||
|
~(SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD);
|
||||||
switch (blendMode) {
|
switch (blendMode) {
|
||||||
case SDL_TEXTUREBLENDMODE_NONE:
|
case SDL_TEXTUREBLENDMODE_NONE:
|
||||||
break;
|
break;
|
||||||
|
@ -368,10 +387,19 @@ int SDL_SetSurfaceBlendMode(SDL_Surface *surface, int blendMode)
|
||||||
if (surface->map->info.flags != flags) {
|
if (surface->map->info.flags != flags) {
|
||||||
SDL_InvalidateMap(surface->map);
|
SDL_InvalidateMap(surface->map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Compatibility mode */
|
||||||
|
if (surface->map->info.flags & SDL_COPY_BLEND) {
|
||||||
|
surface->flags |= SDL_SRCALPHA;
|
||||||
|
} else {
|
||||||
|
surface->flags &= ~SDL_SRCALPHA;
|
||||||
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_GetSurfaceBlendMode(SDL_Surface *surface, int *blendMode)
|
int
|
||||||
|
SDL_GetSurfaceBlendMode(SDL_Surface * surface, int *blendMode)
|
||||||
{
|
{
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -381,27 +409,30 @@ int SDL_GetSurfaceBlendMode(SDL_Surface *surface, int *blendMode)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(surface->map->info.flags & (SDL_COPY_MASK|SDL_COPY_BLEND|SDL_COPY_ADD|SDL_COPY_MOD)) {
|
switch (surface->map->info.
|
||||||
|
flags & (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD |
|
||||||
|
SDL_COPY_MOD)) {
|
||||||
case SDL_COPY_MASK:
|
case SDL_COPY_MASK:
|
||||||
*blendMode = SDL_TEXTUREBLENDMODE_MASK:
|
*blendMode = SDL_TEXTUREBLENDMODE_MASK;
|
||||||
break;
|
break;
|
||||||
case SDL_COPY_BLEND:
|
case SDL_COPY_BLEND:
|
||||||
*blendMode = SDL_TEXTUREBLENDMODE_BLEND:
|
*blendMode = SDL_TEXTUREBLENDMODE_BLEND;
|
||||||
break;
|
break;
|
||||||
case SDL_COPY_ADD:
|
case SDL_COPY_ADD:
|
||||||
*blendMode = SDL_TEXTUREBLENDMODE_ADD:
|
*blendMode = SDL_TEXTUREBLENDMODE_ADD;
|
||||||
break;
|
break;
|
||||||
case SDL_COPY_MOD:
|
case SDL_COPY_MOD:
|
||||||
*blendMode = SDL_TEXTUREBLENDMODE_MOD:
|
*blendMode = SDL_TEXTUREBLENDMODE_MOD;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
*blendMode = SDL_TEXTUREBLENDMODE_NONE:
|
*blendMode = SDL_TEXTUREBLENDMODE_NONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_SetSurfaceScaleMode(SDL_Surface *surface, int scaleMode)
|
int
|
||||||
|
SDL_SetSurfaceScaleMode(SDL_Surface * surface, int scaleMode)
|
||||||
{
|
{
|
||||||
int flags, status;
|
int flags, status;
|
||||||
|
|
||||||
|
@ -436,7 +467,8 @@ int SDL_SetSurfaceScaleMode(SDL_Surface *surface, int scaleMode)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_GetSurfaceScaleMode(SDL_Surface *surface, int *scaleMode)
|
int
|
||||||
|
SDL_GetSurfaceScaleMode(SDL_Surface * surface, int *scaleMode)
|
||||||
{
|
{
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -446,12 +478,12 @@ int SDL_GetSurfaceScaleMode(SDL_Surface *surface, int *scaleMode)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(surface->map->info.flags & (SDL_COPY_LINEAR)) {
|
switch (surface->map->info.flags & (SDL_COPY_NEAREST)) {
|
||||||
case SDL_COPY_LINEAR:
|
case SDL_COPY_NEAREST:
|
||||||
*scaleMode = SDL_TEXTURESCALEMODE_FAST:
|
*scaleMode = SDL_TEXTURESCALEMODE_FAST;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
*scaleMode = SDL_TEXTURESCALEMODE_NONE:
|
*scaleMode = SDL_TEXTURESCALEMODE_NONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -706,7 +738,8 @@ SDL_ConvertSurface(SDL_Surface * surface,
|
||||||
if (copy_flags & SDL_COPY_COLORKEY) {
|
if (copy_flags & SDL_COPY_COLORKEY) {
|
||||||
Uint8 keyR, keyG, keyB, keyA;
|
Uint8 keyR, keyG, keyB, keyA;
|
||||||
|
|
||||||
SDL_GetRGBA(colorkey, surface->format, &keyR, &keyG, &keyB, &keyA);
|
SDL_GetRGBA(surface->map->info.colorkey, surface->format, &keyR,
|
||||||
|
&keyG, &keyB, &keyA);
|
||||||
SDL_SetColorKey(convert, 1,
|
SDL_SetColorKey(convert, 1,
|
||||||
SDL_MapRGBA(convert->format, keyR, keyG, keyB, keyA));
|
SDL_MapRGBA(convert->format, keyR, keyG, keyB, keyA));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1552,7 +1552,9 @@ SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (surface->format->Amask || !(flags & (SDL_COPY_COLORKEY|SDL_COPY_MASK|SDL_COPY_BLEND))) {
|
if (surface->format->Amask
|
||||||
|
|| !(surface->map->info.flags &
|
||||||
|
(SDL_COPY_COLORKEY | SDL_COPY_MASK | SDL_COPY_BLEND))) {
|
||||||
bpp = fmt->BitsPerPixel;
|
bpp = fmt->BitsPerPixel;
|
||||||
Rmask = fmt->Rmask;
|
Rmask = fmt->Rmask;
|
||||||
Gmask = fmt->Gmask;
|
Gmask = fmt->Gmask;
|
||||||
|
@ -1602,31 +1604,34 @@ SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface)
|
||||||
dst_fmt = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask);
|
dst_fmt = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask);
|
||||||
if (dst_fmt) {
|
if (dst_fmt) {
|
||||||
if (SDL_ISPIXELFORMAT_INDEXED(format)) {
|
if (SDL_ISPIXELFORMAT_INDEXED(format)) {
|
||||||
dst_fmt->palette = SDL_AllocPalette((1 << SDL_BITSPERPIXEL(format)));
|
dst_fmt->palette =
|
||||||
|
SDL_AllocPalette((1 << SDL_BITSPERPIXEL(format)));
|
||||||
if (dst_fmt->palette) {
|
if (dst_fmt->palette) {
|
||||||
if (fmt->palette) {
|
/* FIXME: Should we try to copy fmt->palette? */
|
||||||
fixme
|
SDL_DitherColors(dst_fmt->palette->colors,
|
||||||
} else {
|
SDL_BITSPERPIXEL(format));
|
||||||
SDL_DitherColors(dst_fmt->palette->colors, SDL_BITSPERPIXEL(format));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (fmt->palette) {
|
|
||||||
dst_fmt->palette = fmt->palette;
|
|
||||||
} else {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cvt = SDL_ConvertSurface(surface, fmt, 0);
|
dst = SDL_ConvertSurface(surface, dst_fmt, 0);
|
||||||
if (cvt) {
|
if (dst) {
|
||||||
SDL_UpdateTexture(textureID, NULL, cvt->pixels, cvt->pitch);
|
SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch);
|
||||||
SDL_FreeSurface(cvt);
|
SDL_FreeSurface(dst);
|
||||||
}
|
}
|
||||||
SDL_FreeFormat(fmt);
|
if (dst_fmt->palette) {
|
||||||
|
SDL_FreePalette(dst_fmt->palette);
|
||||||
|
}
|
||||||
|
SDL_FreeFormat(dst_fmt);
|
||||||
|
}
|
||||||
|
if (!dst) {
|
||||||
|
SDL_DestroyTexture(textureID);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_ISPIXELFORMAT_INDEXED(format) && fmt->palette) {
|
if (SDL_ISPIXELFORMAT_INDEXED(format) && fmt->palette) {
|
||||||
SDL_SetTexturePalette(textureID, fmt->palette->colors, 0, fmt->palette->ncolors);
|
SDL_SetTexturePalette(textureID, fmt->palette->colors, 0,
|
||||||
|
fmt->palette->ncolors);
|
||||||
}
|
}
|
||||||
|
|
||||||
return textureID;
|
return textureID;
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include "../SDL_sysvideo.h"
|
#include "../SDL_sysvideo.h"
|
||||||
#include "../SDL_yuv_sw_c.h"
|
#include "../SDL_yuv_sw_c.h"
|
||||||
#include "../SDL_renderer_sw.h"
|
#include "../SDL_renderer_sw.h"
|
||||||
#include "../SDL_rendercopy.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* SDL surface based renderer implementation */
|
/* SDL surface based renderer implementation */
|
||||||
|
@ -160,55 +159,10 @@ SDL_DUMMY_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||||
} else {
|
} else {
|
||||||
SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
|
SDL_Surface *surface = (SDL_Surface *) texture->driverdata;
|
||||||
SDL_Surface *target = data->screens[data->current_screen];
|
SDL_Surface *target = data->screens[data->current_screen];
|
||||||
SDL_RenderCopyFunc copyfunc = (SDL_RenderCopyFunc) surface->userdata;
|
|
||||||
|
|
||||||
if (copyfunc) {
|
|
||||||
SDL_RenderCopyData copydata;
|
|
||||||
|
|
||||||
copydata.src =
|
|
||||||
(Uint8 *) surface->pixels + srcrect->y * surface->pitch +
|
|
||||||
srcrect->x * surface->format->BytesPerPixel;
|
|
||||||
copydata.src_w = srcrect->w;
|
|
||||||
copydata.src_h = srcrect->h;
|
|
||||||
copydata.src_pitch = surface->pitch;
|
|
||||||
copydata.dst =
|
|
||||||
(Uint8 *) target->pixels + dstrect->y * target->pitch +
|
|
||||||
dstrect->x * target->format->BytesPerPixel;
|
|
||||||
copydata.dst_w = dstrect->w;
|
|
||||||
copydata.dst_h = dstrect->h;
|
|
||||||
copydata.dst_pitch = target->pitch;
|
|
||||||
copydata.flags = 0;
|
|
||||||
if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) {
|
|
||||||
copydata.flags |= SDL_RENDERCOPY_MODULATE_COLOR;
|
|
||||||
copydata.r = texture->r;
|
|
||||||
copydata.g = texture->g;
|
|
||||||
copydata.b = texture->b;
|
|
||||||
}
|
|
||||||
if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) {
|
|
||||||
copydata.flags |= SDL_RENDERCOPY_MODULATE_ALPHA;
|
|
||||||
copydata.a = texture->a;
|
|
||||||
}
|
|
||||||
if (texture->blendMode & SDL_TEXTUREBLENDMODE_MASK) {
|
|
||||||
copydata.flags |= SDL_RENDERCOPY_MASK;
|
|
||||||
} else if (texture->blendMode & SDL_TEXTUREBLENDMODE_BLEND) {
|
|
||||||
copydata.flags |= SDL_RENDERCOPY_BLEND;
|
|
||||||
} else if (texture->blendMode & SDL_TEXTUREBLENDMODE_ADD) {
|
|
||||||
copydata.flags |= SDL_RENDERCOPY_ADD;
|
|
||||||
} else if (texture->blendMode & SDL_TEXTUREBLENDMODE_MOD) {
|
|
||||||
copydata.flags |= SDL_RENDERCOPY_MOD;
|
|
||||||
}
|
|
||||||
if (texture->scaleMode) {
|
|
||||||
copydata.flags |= SDL_RENDERCOPY_NEAREST;
|
|
||||||
}
|
|
||||||
copyfunc(©data);
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
SDL_Rect real_srcrect = *srcrect;
|
SDL_Rect real_srcrect = *srcrect;
|
||||||
SDL_Rect real_dstrect = *dstrect;
|
SDL_Rect real_dstrect = *dstrect;
|
||||||
|
|
||||||
return SDL_LowerBlit(surface, &real_srcrect, target,
|
return SDL_LowerBlit(surface, &real_srcrect, target, &real_dstrect);
|
||||||
&real_dstrect);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -384,7 +384,7 @@ __EOF__
|
||||||
sub output_copyfunctable
|
sub output_copyfunctable
|
||||||
{
|
{
|
||||||
print FILE <<__EOF__;
|
print FILE <<__EOF__;
|
||||||
static SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = {
|
SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = {
|
||||||
__EOF__
|
__EOF__
|
||||||
for (my $i = 0; $i <= $#src_formats; ++$i) {
|
for (my $i = 0; $i <= $#src_formats; ++$i) {
|
||||||
my $src = $src_formats[$i];
|
my $src = $src_formats[$i];
|
||||||
|
|
|
@ -253,7 +253,7 @@ void
|
||||||
MoveSprite(SDL_Surface * screen, SDL_Surface * light)
|
MoveSprite(SDL_Surface * screen, SDL_Surface * light)
|
||||||
{
|
{
|
||||||
SDL_Rect updates[2];
|
SDL_Rect updates[2];
|
||||||
int alpha;
|
Uint8 alpha;
|
||||||
|
|
||||||
/* Erase the sprite if it was visible */
|
/* Erase the sprite if it was visible */
|
||||||
if (sprite_visible) {
|
if (sprite_visible) {
|
||||||
|
@ -290,10 +290,10 @@ MoveSprite(SDL_Surface * screen, SDL_Surface * light)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update transparency (fade in and out) */
|
/* Update transparency (fade in and out) */
|
||||||
alpha = sprite->format->alpha;
|
SDL_GetSurfaceAlphaMod(sprite, &alpha);
|
||||||
if ((alpha + alpha_vel) < 0) {
|
if (((int) alpha + alpha_vel) < 0) {
|
||||||
alpha_vel = -alpha_vel;
|
alpha_vel = -alpha_vel;
|
||||||
} else if ((alpha + alpha_vel) > 255) {
|
} else if (((int) alpha + alpha_vel) > 255) {
|
||||||
alpha_vel = -alpha_vel;
|
alpha_vel = -alpha_vel;
|
||||||
}
|
}
|
||||||
SDL_SetAlpha(sprite, SDL_SRCALPHA, (Uint8) (alpha + alpha_vel));
|
SDL_SetAlpha(sprite, SDL_SRCALPHA, (Uint8) (alpha + alpha_vel));
|
||||||
|
|
|
@ -91,9 +91,6 @@ output_surface_details(const char *name, SDL_Surface * surface)
|
||||||
printf(" depth : %d bits per pixel\n",
|
printf(" depth : %d bits per pixel\n",
|
||||||
surface->format->BitsPerPixel);
|
surface->format->BitsPerPixel);
|
||||||
printf(" pitch : %d\n", (int) surface->pitch);
|
printf(" pitch : %d\n", (int) surface->pitch);
|
||||||
printf(" alpha : %d\n", (int) surface->format->alpha);
|
|
||||||
printf(" colorkey : 0x%X\n",
|
|
||||||
(unsigned int) surface->format->colorkey);
|
|
||||||
|
|
||||||
printf(" red bits : 0x%08X mask, %d shift, %d loss\n",
|
printf(" red bits : 0x%08X mask, %d shift, %d loss\n",
|
||||||
(int) surface->format->Rmask,
|
(int) surface->format->Rmask,
|
||||||
|
@ -216,8 +213,10 @@ setup_test(int argc, char **argv)
|
||||||
Uint32 origdstalphaflags = 0;
|
Uint32 origdstalphaflags = 0;
|
||||||
Uint32 srcalphaflags = 0;
|
Uint32 srcalphaflags = 0;
|
||||||
Uint32 dstalphaflags = 0;
|
Uint32 dstalphaflags = 0;
|
||||||
int srcalpha = 255;
|
Uint8 origsrcalpha = 255;
|
||||||
int dstalpha = 255;
|
Uint8 origdstalpha = 255;
|
||||||
|
Uint8 srcalpha = 255;
|
||||||
|
Uint8 dstalpha = 255;
|
||||||
int screenSurface = 0;
|
int screenSurface = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
@ -313,8 +312,10 @@ setup_test(int argc, char **argv)
|
||||||
(dest->flags & SDL_SRCALPHA) | (dest->flags & SDL_RLEACCEL);
|
(dest->flags & SDL_SRCALPHA) | (dest->flags & SDL_RLEACCEL);
|
||||||
origsrcalphaflags = srcalphaflags;
|
origsrcalphaflags = srcalphaflags;
|
||||||
origdstalphaflags = dstalphaflags;
|
origdstalphaflags = dstalphaflags;
|
||||||
srcalpha = src->format->alpha;
|
SDL_GetSurfaceAlphaMod(src, &srcalpha);
|
||||||
dstalpha = dest->format->alpha;
|
SDL_GetSurfaceAlphaMod(dest, &dstalpha);
|
||||||
|
origsrcalpha = srcalpha;
|
||||||
|
origdstalpha = dstalpha;
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
const char *arg = argv[i];
|
const char *arg = argv[i];
|
||||||
|
|
||||||
|
@ -339,12 +340,10 @@ setup_test(int argc, char **argv)
|
||||||
else if (strcmp(arg, "--dstnorleaccel") == 0)
|
else if (strcmp(arg, "--dstnorleaccel") == 0)
|
||||||
dstalphaflags &= ~SDL_RLEACCEL;
|
dstalphaflags &= ~SDL_RLEACCEL;
|
||||||
}
|
}
|
||||||
if ((dstalphaflags != origdstalphaflags)
|
if ((dstalphaflags != origdstalphaflags) || (origdstalpha != dstalpha))
|
||||||
|| (dstalpha != dest->format->alpha))
|
SDL_SetAlpha(dest, dstalphaflags, dstalpha);
|
||||||
SDL_SetAlpha(dest, dstalphaflags, (Uint8) dstalpha);
|
if ((srcalphaflags != origsrcalphaflags) || (origsrcalpha != srcalpha))
|
||||||
if ((srcalphaflags != origsrcalphaflags)
|
SDL_SetAlpha(src, srcalphaflags, srcalpha);
|
||||||
|| (srcalpha != src->format->alpha))
|
|
||||||
SDL_SetAlpha(src, srcalphaflags, (Uint8) srcalpha);
|
|
||||||
|
|
||||||
/* set some sane defaults so we can see if the blit code is broken... */
|
/* set some sane defaults so we can see if the blit code is broken... */
|
||||||
SDL_FillRect(dest, NULL, SDL_MapRGB(dest->format, 0, 0, 0));
|
SDL_FillRect(dest, NULL, SDL_MapRGB(dest->format, 0, 0, 0));
|
||||||
|
|
|
@ -201,7 +201,7 @@ SDL_GL_LoadTexture(SDL_Surface * surface, GLfloat * texcoord)
|
||||||
|
|
||||||
/* Save the alpha blending attributes */
|
/* Save the alpha blending attributes */
|
||||||
saved_flags = surface->flags & (SDL_SRCALPHA | SDL_RLEACCELOK);
|
saved_flags = surface->flags & (SDL_SRCALPHA | SDL_RLEACCELOK);
|
||||||
saved_alpha = surface->format->alpha;
|
SDL_GetSurfaceAlphaMod(surface, &saved_alpha);
|
||||||
if ((saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA) {
|
if ((saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA) {
|
||||||
SDL_SetAlpha(surface, 0, 0);
|
SDL_SetAlpha(surface, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -487,8 +487,6 @@ main(int argc, char **argv)
|
||||||
format.Gloss = 0;
|
format.Gloss = 0;
|
||||||
format.Bloss = 0;
|
format.Bloss = 0;
|
||||||
format.Aloss = 8;
|
format.Aloss = 8;
|
||||||
format.colorkey = 0;
|
|
||||||
format.alpha = 0;
|
|
||||||
|
|
||||||
newsurf = SDL_ConvertSurface(pic, &format, SDL_SWSURFACE);
|
newsurf = SDL_ConvertSurface(pic, &format, SDL_SWSURFACE);
|
||||||
if (!newsurf) {
|
if (!newsurf) {
|
||||||
|
|
|
@ -521,8 +521,6 @@ main(int argc, char **argv)
|
||||||
format.Gloss = 0;
|
format.Gloss = 0;
|
||||||
format.Bloss = 0;
|
format.Bloss = 0;
|
||||||
format.Aloss = 8;
|
format.Aloss = 8;
|
||||||
format.colorkey = 0;
|
|
||||||
format.alpha = 0;
|
|
||||||
|
|
||||||
newsurf =
|
newsurf =
|
||||||
SDL_ConvertSurface(MooseFrame[i], &format, SDL_SWSURFACE);
|
SDL_ConvertSurface(MooseFrame[i], &format, SDL_SWSURFACE);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue