Prevent conflicts when linking both SDL2 and SDL2_gfx
authorSam Lantinga <slouken@libsdl.org>
Sun, 20 Oct 2013 21:34:38 -0700
changeset 7859af63b63e7aac
parent 7858 170c9f4c3c28
child 7860 2b0bcdea3a79
Prevent conflicts when linking both SDL2 and SDL2_gfx
src/render/software/SDL_render_sw.c
src/render/software/SDL_rotate.c
src/render/software/SDL_rotate.h
     1.1 --- a/src/render/software/SDL_render_sw.c	Sun Oct 20 20:49:36 2013 -0700
     1.2 +++ b/src/render/software/SDL_render_sw.c	Sun Oct 20 21:34:38 2013 -0700
     1.3 @@ -609,8 +609,8 @@
     1.4  
     1.5          retval = SDL_BlitScaled(src, srcrect, surface_scaled, &tmp_rect);
     1.6          if (!retval) {
     1.7 -            _rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, -angle, &dstwidth, &dstheight, &cangle, &sangle);
     1.8 -            surface_rotated = _rotateSurface(surface_scaled, -angle, dstwidth/2, dstheight/2, GetScaleQuality(), flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, dstwidth, dstheight, cangle, sangle);
     1.9 +            SDLgfx_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, -angle, &dstwidth, &dstheight, &cangle, &sangle);
    1.10 +            surface_rotated = SDLgfx_rotateSurface(surface_scaled, -angle, dstwidth/2, dstheight/2, GetScaleQuality(), flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, dstwidth, dstheight, cangle, sangle);
    1.11              if(surface_rotated) {
    1.12                  /* Find out where the new origin is by rotating the four final_rect points around the center and then taking the extremes */
    1.13                  abscenterx = final_rect.x + (int)center->x;
     2.1 --- a/src/render/software/SDL_rotate.c	Sun Oct 20 20:49:36 2013 -0700
     2.2 +++ b/src/render/software/SDL_rotate.c	Sun Oct 20 21:34:38 2013 -0700
     2.3 @@ -84,7 +84,8 @@
     2.4  /* !
     2.5  \brief Returns colorkey info for a surface
     2.6  */
     2.7 -Uint32 _colorkey(SDL_Surface *src)
     2.8 +static Uint32
     2.9 +_colorkey(SDL_Surface *src)
    2.10  {
    2.11      Uint32 key = 0;
    2.12      SDL_GetColorKey(src, &key);
    2.13 @@ -104,9 +105,10 @@
    2.14  \param sangle The cosine of the angle
    2.15  
    2.16  */
    2.17 -void _rotozoomSurfaceSizeTrig(int width, int height, double angle,
    2.18 -                              int *dstwidth, int *dstheight,
    2.19 -                              double *cangle, double *sangle)
    2.20 +void
    2.21 +SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle,
    2.22 +                               int *dstwidth, int *dstheight,
    2.23 +                               double *cangle, double *sangle)
    2.24  {
    2.25      double x, y, cx, cy, sx, sy;
    2.26      double radangle;
    2.27 @@ -153,7 +155,8 @@
    2.28  \param flipy Flag indicating vertical mirroring should be applied.
    2.29  \param smooth Flag indicating anti-aliasing should be used.
    2.30  */
    2.31 -void _transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy, int smooth)
    2.32 +static void
    2.33 +_transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy, int smooth)
    2.34  {
    2.35      int x, y, t1, t2, dx, dy, xd, yd, sdx, sdy, ax, ay, ex, ey, sw, sh;
    2.36      tColorRGBA c00, c01, c10, c11, cswap;
    2.37 @@ -270,7 +273,8 @@
    2.38  \param flipx Flag indicating horizontal mirroring should be applied.
    2.39  \param flipy Flag indicating vertical mirroring should be applied.
    2.40  */
    2.41 -void transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy)
    2.42 +static void
    2.43 +transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin, int icos, int flipx, int flipy)
    2.44  {
    2.45      int x, y, dx, dy, xd, yd, sdx, sdy, ax, ay;
    2.46      tColorY *pc, *sp;
    2.47 @@ -315,8 +319,6 @@
    2.48  }
    2.49  
    2.50  
    2.51 -
    2.52 -
    2.53  /* !
    2.54  \brief Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing.
    2.55  
    2.56 @@ -340,7 +342,8 @@
    2.57  
    2.58  */
    2.59  
    2.60 -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)
    2.61 +SDL_Surface *
    2.62 +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)
    2.63  {
    2.64      SDL_Surface *rz_src;
    2.65      SDL_Surface *rz_dst;
    2.66 @@ -496,4 +499,3 @@
    2.67      */
    2.68      return (rz_dst);
    2.69  }
    2.70 -
     3.1 --- a/src/render/software/SDL_rotate.h	Sun Oct 20 20:49:36 2013 -0700
     3.2 +++ b/src/render/software/SDL_rotate.h	Sun Oct 20 21:34:38 2013 -0700
     3.3 @@ -2,6 +2,6 @@
     3.4  #define MIN(a,b)    (((a) < (b)) ? (a) : (b))
     3.5  #endif
     3.6  
     3.7 -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);
     3.8 -extern void _rotozoomSurfaceSizeTrig(int width, int height, double angle, int *dstwidth, int *dstheight, double *cangle, double *sangle);
     3.9 +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);
    3.10 +extern void SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, int *dstwidth, int *dstheight, double *cangle, double *sangle);
    3.11