From e00881804f4e3be2f332b6fdd67885f8af124e6d Mon Sep 17 00:00:00 2001 From: David Fioramonti Date: Thu, 24 May 2018 17:48:55 -0700 Subject: GFX: Use degree conversion common math funcs --- graphics/transform_tools.cpp | 3 ++- graphics/transparent_surface.cpp | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/graphics/transform_tools.cpp b/graphics/transform_tools.cpp index 6e87b6321a..a0617ff236 100644 --- a/graphics/transform_tools.cpp +++ b/graphics/transform_tools.cpp @@ -22,12 +22,13 @@ #include "graphics/transform_tools.h" +#include "common/math.h" #include namespace Graphics { FloatPoint TransformTools::transformPoint(FloatPoint point, const float rotate, const Common::Point &zoom, const bool mirrorX, const bool mirrorY) { - float rotateRad = rotate * M_PI / 180.0f; + float rotateRad = Common::deg2rad(rotate); float x = point.x; float y = point.y; x = (x * zoom.x) / kDefaultZoomX; diff --git a/graphics/transparent_surface.cpp b/graphics/transparent_surface.cpp index 10f69b5281..2a6fa7bfdf 100644 --- a/graphics/transparent_surface.cpp +++ b/graphics/transparent_surface.cpp @@ -796,8 +796,9 @@ TransparentSurface *TransparentSurface::rotoscaleT(const TransformStruct &transf } uint32 invAngle = 360 - (transform._angle % 360); - float invCos = cos(invAngle * M_PI / 180.0); - float invSin = sin(invAngle * M_PI / 180.0); + float invAngleRad = Common::deg2rad(invAngle); + float invCos = cos(invAngleRad); + float invSin = sin(invAngleRad); int icosx = (int)(invCos * (65536.0f * kDefaultZoomX / transform._zoom.x)); int isinx = (int)(invSin * (65536.0f * kDefaultZoomX / transform._zoom.x)); -- cgit v1.2.3