mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-02-14 07:43:14 +00:00
Group the blit copy flags to simplify code
This commit is contained in:
@@ -125,7 +125,7 @@ static SDL_bool SDL_UseAltivecPrefetch(void)
|
||||
static SDL_BlitFunc SDL_ChooseBlitFunc(SDL_PixelFormat src_format, SDL_PixelFormat dst_format, int flags,
|
||||
SDL_BlitFuncEntry *entries)
|
||||
{
|
||||
int i, flagcheck = (flags & (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL | SDL_COPY_COLORKEY | SDL_COPY_NEAREST));
|
||||
int i, flagcheck = (flags & (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_COLORKEY | SDL_COPY_NEAREST));
|
||||
static unsigned int features = 0x7fffffff;
|
||||
|
||||
/* Get the available CPU features */
|
||||
|
||||
@@ -30,12 +30,14 @@ extern const Uint16 SDL_expand_byte_10[];
|
||||
/* SDL blit copy flags */
|
||||
#define SDL_COPY_MODULATE_COLOR 0x00000001
|
||||
#define SDL_COPY_MODULATE_ALPHA 0x00000002
|
||||
#define SDL_COPY_MODULATE_MASK (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA)
|
||||
#define SDL_COPY_BLEND 0x00000010
|
||||
#define SDL_COPY_BLEND_PREMULTIPLIED 0x00000020
|
||||
#define SDL_COPY_ADD 0x00000040
|
||||
#define SDL_COPY_ADD_PREMULTIPLIED 0x00000080
|
||||
#define SDL_COPY_MOD 0x00000100
|
||||
#define SDL_COPY_MUL 0x00000200
|
||||
#define SDL_COPY_BLEND_MASK (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)
|
||||
#define SDL_COPY_COLORKEY 0x00000400
|
||||
#define SDL_COPY_NEAREST 0x00000800
|
||||
#define SDL_COPY_RLE_DESIRED 0x00001000
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -146,7 +146,7 @@ void SDL_Blit_Slow(SDL_BlitInfo *info)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL))) {
|
||||
if (flags & SDL_COPY_BLEND_MASK) {
|
||||
switch (dst_access) {
|
||||
case SlowBlitPixelAccess_Index8:
|
||||
dstpixel = *dst;
|
||||
@@ -206,7 +206,7 @@ void SDL_Blit_Slow(SDL_BlitInfo *info)
|
||||
srcB = (srcB * srcA) / 255;
|
||||
}
|
||||
}
|
||||
switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) {
|
||||
switch (flags & SDL_COPY_BLEND_MASK) {
|
||||
case 0:
|
||||
dstR = srcR;
|
||||
dstG = srcG;
|
||||
|
||||
@@ -722,7 +722,7 @@ int SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode)
|
||||
|
||||
status = 0;
|
||||
flags = surface->internal->map.info.flags;
|
||||
surface->internal->map.info.flags &= ~(SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL);
|
||||
surface->internal->map.info.flags &= ~SDL_COPY_BLEND_MASK;
|
||||
switch (blendMode) {
|
||||
case SDL_BLENDMODE_NONE:
|
||||
break;
|
||||
@@ -770,7 +770,7 @@ int SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (surface->internal->map.info.flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) {
|
||||
switch (surface->internal->map.info.flags & SDL_COPY_BLEND_MASK) {
|
||||
case SDL_COPY_BLEND:
|
||||
*blendMode = SDL_BLENDMODE_BLEND;
|
||||
break;
|
||||
@@ -1103,9 +1103,7 @@ int SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect,
|
||||
SDL_Surface *dst, const SDL_Rect *dstrect,
|
||||
SDL_ScaleMode scaleMode)
|
||||
{
|
||||
static const Uint32 complex_copy_flags = (SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA |
|
||||
SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL |
|
||||
SDL_COPY_COLORKEY);
|
||||
static const Uint32 complex_copy_flags = (SDL_COPY_MODULATE_MASK | SDL_COPY_BLEND_MASK | SDL_COPY_COLORKEY);
|
||||
|
||||
if (srcrect->w > SDL_MAX_UINT16 || srcrect->h > SDL_MAX_UINT16 ||
|
||||
dstrect->w > SDL_MAX_UINT16 || dstrect->h > SDL_MAX_UINT16) {
|
||||
|
||||
@@ -337,7 +337,7 @@ __EOF__
|
||||
__EOF__
|
||||
}
|
||||
print FILE <<__EOF__;
|
||||
switch (flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) {
|
||||
switch (flags & SDL_COPY_BLEND_MASK) {
|
||||
case SDL_COPY_BLEND:
|
||||
__EOF__
|
||||
if ($A_is_const_FF) {
|
||||
@@ -658,7 +658,7 @@ __EOF__
|
||||
my $flags = "";
|
||||
my $flag = "";
|
||||
if ( $modulate ) {
|
||||
$flag = "SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA";
|
||||
$flag = "SDL_COPY_MODULATE_MASK";
|
||||
if ( $flags eq "" ) {
|
||||
$flags = $flag;
|
||||
} else {
|
||||
@@ -666,7 +666,7 @@ __EOF__
|
||||
}
|
||||
}
|
||||
if ( $blend ) {
|
||||
$flag = "SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL";
|
||||
$flag = "SDL_COPY_BLEND_MASK";
|
||||
if ( $flags eq "" ) {
|
||||
$flags = $flag;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user