From 90a5607d32f4d191cb7ed3947c7e9edf60ea2209 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 29 Aug 2018 20:23:42 -0700 Subject: [PATCH] Fixed compiler warning and use higher precision in angle calculation --- src/render/opengles2/SDL_render_gles2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index 2a2e84457..fe51b9aaf 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -1857,8 +1857,6 @@ GLES2_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *s return GL_CheckError("", renderer); } -#define PI 3.14159265f - static int GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip) @@ -1880,7 +1878,7 @@ GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_CENTER); data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_ANGLE); - radian_angle = PI * (360.0f - angle) / 180.f; + radian_angle = (float)(M_PI * (360.0 - angle) / 180.0); fAngle[0] = fAngle[2] = fAngle[4] = fAngle[6] = (GLfloat)SDL_sin(radian_angle); /* render expects cos value - 1 (see GLES2_VertexSrc_Default_) */ fAngle[1] = fAngle[3] = fAngle[5] = fAngle[7] = (GLfloat)SDL_cos(radian_angle) - 1.0f;