GFX: Use degree conversion common math funcs

This commit is contained in:
David Fioramonti 2018-05-24 17:48:55 -07:00 committed by Thierry Crozat
parent 8e1f712327
commit e00881804f
2 changed files with 5 additions and 3 deletions

View file

@ -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;

View file

@ -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));