Some more cleanup to make SDL common code friendly to SDL1 and SDL2
This commit is contained in:
@@ -46,7 +46,11 @@ ColorToNative (Color color)
|
|||||||
native.r = color.r;
|
native.r = color.r;
|
||||||
native.g = color.g;
|
native.g = color.g;
|
||||||
native.b = color.b;
|
native.b = color.b;
|
||||||
|
#if SDL_MAJOR_VERSION == 1
|
||||||
native.unused = 0;
|
native.unused = 0;
|
||||||
|
#else
|
||||||
|
native.a = color.a;
|
||||||
|
#endif
|
||||||
return native;
|
return native;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -533,12 +533,18 @@ blt_prim(SDL_Surface *src, SDL_Rect src_r, RenderPixelFn plot, int factor,
|
|||||||
mask = srcfmt->Amask;
|
mask = srcfmt->Amask;
|
||||||
key = 0;
|
key = 0;
|
||||||
}
|
}
|
||||||
|
#if SDL_MAJOR_VERSION == 1
|
||||||
else if (src->flags & SDL_SRCCOLORKEY)
|
else if (src->flags & SDL_SRCCOLORKEY)
|
||||||
{ // colorkey transparency
|
{ // colorkey transparency
|
||||||
mask = ~srcfmt->Amask;
|
mask = ~srcfmt->Amask;
|
||||||
key = srcfmt->colorkey & mask;
|
key = srcfmt->colorkey & mask;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
else if (SDL_GetColorKey (src, &key) == 0)
|
||||||
|
{
|
||||||
|
mask = ~0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
// TODO: calculate the source and destination pointers directly
|
// TODO: calculate the source and destination pointers directly
|
||||||
// instead of using the plot(x,y) version
|
// instead of using the plot(x,y) version
|
||||||
for (y = 0; y < src_r.h; ++y)
|
for (y = 0; y < src_r.h; ++y)
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include "port.h"
|
#include "port.h"
|
||||||
#include SDL_INCLUDE(SDL.h)
|
#include SDL_INCLUDE(SDL.h)
|
||||||
#include SDL_INCLUDE(SDL_byteorder.h)
|
|
||||||
|
|
||||||
#include "../gfxintrn.h"
|
#include "../gfxintrn.h"
|
||||||
#include "libs/graphics/tfb_draw.h"
|
#include "libs/graphics/tfb_draw.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user