aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Fioramonti2018-05-24 17:48:55 -0700
committerThierry Crozat2018-07-03 23:08:48 +0100
commite00881804f4e3be2f332b6fdd67885f8af124e6d (patch)
tree5b1a7774e5bb7dc502c449d050f5805cf2663eb4
parent8e1f71232737ca5cb3b57f664e3e4e36137f9181 (diff)
downloadscummvm-rg350-e00881804f4e3be2f332b6fdd67885f8af124e6d.tar.gz
scummvm-rg350-e00881804f4e3be2f332b6fdd67885f8af124e6d.tar.bz2
scummvm-rg350-e00881804f4e3be2f332b6fdd67885f8af124e6d.zip
GFX: Use degree conversion common math funcs
-rw-r--r--graphics/transform_tools.cpp3
-rw-r--r--graphics/transparent_surface.cpp5
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 <math.h>
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<float>(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<uint32,float>(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));