Prevent conflicts when linking both SDL2 and SDL2_gfx

This commit is contained in:
Sam Lantinga 2013-10-20 21:34:38 -07:00
parent aa86e05d21
commit 4ca34ad4a4
3 changed files with 16 additions and 14 deletions

View File

@ -609,8 +609,8 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
retval = SDL_BlitScaled(src, srcrect, surface_scaled, &tmp_rect); retval = SDL_BlitScaled(src, srcrect, surface_scaled, &tmp_rect);
if (!retval) { if (!retval) {
_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, -angle, &dstwidth, &dstheight, &cangle, &sangle); SDLgfx_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, -angle, &dstwidth, &dstheight, &cangle, &sangle);
surface_rotated = _rotateSurface(surface_scaled, -angle, dstwidth/2, dstheight/2, GetScaleQuality(), flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, dstwidth, dstheight, cangle, sangle); surface_rotated = SDLgfx_rotateSurface(surface_scaled, -angle, dstwidth/2, dstheight/2, GetScaleQuality(), flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, dstwidth, dstheight, cangle, sangle);
if(surface_rotated) { if(surface_rotated) {
/* Find out where the new origin is by rotating the four final_rect points around the center and then taking the extremes */ /* Find out where the new origin is by rotating the four final_rect points around the center and then taking the extremes */
abscenterx = final_rect.x + (int)center->x; abscenterx = final_rect.x + (int)center->x;

View File

@ -84,7 +84,8 @@ to a situation where the program can segfault.
/* ! /* !
\brief Returns colorkey info for a surface \brief Returns colorkey info for a surface
*/ */
Uint32 _colorkey(SDL_Surface *src) static Uint32
_colorkey(SDL_Surface *src)
{ {
Uint32 key = 0; Uint32 key = 0;
SDL_GetColorKey(src, &key); SDL_GetColorKey(src, &key);
@ -104,9 +105,10 @@ Uint32 _colorkey(SDL_Surface *src)
\param sangle The cosine of the angle \param sangle The cosine of the angle
*/ */
void _rotozoomSurfaceSizeTrig(int width, int height, double angle, void
int *dstwidth, int *dstheight, SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle,
double *cangle, double *sangle) int *dstwidth, int *dstheight,
double *cangle, double *sangle)
{ {
double x, y, cx, cy, sx, sy; double x, y, cx, cy, sx, sy;
double radangle; double radangle;
@ -153,7 +155,8 @@ Assumes dst surface was allocated with the correct dimensions.
\param flipy Flag indicating vertical mirroring should be applied. \param flipy Flag indicating vertical mirroring should be applied.
\param smooth Flag indicating anti-aliasing should be used. \param smooth Flag indicating anti-aliasing should be used.
*/ */
void _transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy, int smooth) static void
_transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy, int smooth)
{ {
int x, y, t1, t2, dx, dy, xd, yd, sdx, sdy, ax, ay, ex, ey, sw, sh; int x, y, t1, t2, dx, dy, xd, yd, sdx, sdy, ax, ay, ex, ey, sw, sh;
tColorRGBA c00, c01, c10, c11, cswap; tColorRGBA c00, c01, c10, c11, cswap;
@ -270,7 +273,8 @@ Assumes dst surface was allocated with the correct dimensions.
\param flipx Flag indicating horizontal mirroring should be applied. \param flipx Flag indicating horizontal mirroring should be applied.
\param flipy Flag indicating vertical mirroring should be applied. \param flipy Flag indicating vertical mirroring should be applied.
*/ */
void transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy) static void
transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy)
{ {
int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay; int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay;
tColorY *pc, *sp; tColorY *pc, *sp;
@ -315,8 +319,6 @@ void transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int
} }
/* ! /* !
\brief Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing. \brief Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing.
@ -340,7 +342,8 @@ or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
*/ */
SDL_Surface *_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, int smooth, int flipx, int flipy, int dstwidth, int dstheight, double cangle, double sangle) SDL_Surface *
SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, int smooth, int flipx, int flipy, int dstwidth, int dstheight, double cangle, double sangle)
{ {
SDL_Surface *rz_src; SDL_Surface *rz_src;
SDL_Surface *rz_dst; SDL_Surface *rz_dst;
@ -496,4 +499,3 @@ SDL_Surface *_rotateSurface(SDL_Surface * src, double angle, int centerx, int ce
*/ */
return (rz_dst); return (rz_dst);
} }

View File

@ -2,6 +2,6 @@
#define MIN(a,b) (((a) < (b)) ? (a) : (b)) #define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif #endif
extern SDL_Surface *_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, int smooth, int flipx, int flipy, int dstwidth, int dstheight, double cangle, double sangle); extern SDL_Surface *SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, int smooth, int flipx, int flipy, int dstwidth, int dstheight, double cangle, double sangle);
extern void _rotozoomSurfaceSizeTrig(int width, int height, double angle, int *dstwidth, int *dstheight, double *cangle, double *sangle); extern void SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, int *dstwidth, int *dstheight, double *cangle, double *sangle);