Fixed compiler warning and use higher precision in angle calculation
authorSam Lantinga <slouken@libsdl.org>
Wed, 29 Aug 2018 20:23:42 -0700
changeset 121648b71c22d6714
parent 12163 dd056c76593a
child 12165 c7e321efcbab
Fixed compiler warning and use higher precision in angle calculation
src/render/opengles2/SDL_render_gles2.c
     1.1 --- a/src/render/opengles2/SDL_render_gles2.c	Wed Aug 29 20:23:39 2018 -0700
     1.2 +++ b/src/render/opengles2/SDL_render_gles2.c	Wed Aug 29 20:23:42 2018 -0700
     1.3 @@ -1857,8 +1857,6 @@
     1.4      return GL_CheckError("", renderer);
     1.5  }
     1.6  
     1.7 -#define PI 3.14159265f
     1.8 -
     1.9  static int
    1.10  GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect,
    1.11                   const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
    1.12 @@ -1880,7 +1878,7 @@
    1.13      data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_CENTER);
    1.14      data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_ANGLE);
    1.15  
    1.16 -    radian_angle = PI * (360.0f - angle) / 180.f;
    1.17 +    radian_angle = (float)(M_PI * (360.0 - angle) / 180.0);
    1.18      fAngle[0] = fAngle[2] = fAngle[4] = fAngle[6] = (GLfloat)SDL_sin(radian_angle);
    1.19      /* render expects cos value - 1 (see GLES2_VertexSrc_Default_) */
    1.20      fAngle[1] = fAngle[3] = fAngle[5] = fAngle[7] = (GLfloat)SDL_cos(radian_angle) - 1.0f;