GFX: Use degree conversion common math funcs
This commit is contained in:
parent
8e1f712327
commit
e00881804f
2 changed files with 5 additions and 3 deletions
|
@ -22,12 +22,13 @@
|
||||||
|
|
||||||
|
|
||||||
#include "graphics/transform_tools.h"
|
#include "graphics/transform_tools.h"
|
||||||
|
#include "common/math.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
namespace Graphics {
|
namespace Graphics {
|
||||||
|
|
||||||
FloatPoint TransformTools::transformPoint(FloatPoint point, const float rotate, const Common::Point &zoom, const bool mirrorX, const bool mirrorY) {
|
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 x = point.x;
|
||||||
float y = point.y;
|
float y = point.y;
|
||||||
x = (x * zoom.x) / kDefaultZoomX;
|
x = (x * zoom.x) / kDefaultZoomX;
|
||||||
|
|
|
@ -796,8 +796,9 @@ TransparentSurface *TransparentSurface::rotoscaleT(const TransformStruct &transf
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 invAngle = 360 - (transform._angle % 360);
|
uint32 invAngle = 360 - (transform._angle % 360);
|
||||||
float invCos = cos(invAngle * M_PI / 180.0);
|
float invAngleRad = Common::deg2rad<uint32,float>(invAngle);
|
||||||
float invSin = sin(invAngle * M_PI / 180.0);
|
float invCos = cos(invAngleRad);
|
||||||
|
float invSin = sin(invAngleRad);
|
||||||
|
|
||||||
int icosx = (int)(invCos * (65536.0f * kDefaultZoomX / transform._zoom.x));
|
int icosx = (int)(invCos * (65536.0f * kDefaultZoomX / transform._zoom.x));
|
||||||
int isinx = (int)(invSin * (65536.0f * kDefaultZoomX / transform._zoom.x));
|
int isinx = (int)(invSin * (65536.0f * kDefaultZoomX / transform._zoom.x));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue