Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2295)

Unified Diff: Source/platform/transforms/AffineTransform.cpp

Issue 166273019: Add rotateRadians function to AffineTransform (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/transforms/AffineTransform.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/transforms/AffineTransform.cpp
diff --git a/Source/platform/transforms/AffineTransform.cpp b/Source/platform/transforms/AffineTransform.cpp
index effb9df601047f879f925d31953641e05ef94923..44517294e4dadca823d55a9f4211f5c872bee1b1 100644
--- a/Source/platform/transforms/AffineTransform.cpp
+++ b/Source/platform/transforms/AffineTransform.cpp
@@ -134,7 +134,11 @@ AffineTransform& AffineTransform::multiply(const AffineTransform& other)
AffineTransform& AffineTransform::rotate(double a)
{
// angle is in degree. Switch to radian
- a = deg2rad(a);
+ return rotateRadians(deg2rad(a));
+}
+
+AffineTransform& AffineTransform::rotateRadians(double a)
+{
double cosAngle = cos(a);
double sinAngle = sin(a);
AffineTransform rot(cosAngle, sinAngle, -sinAngle, cosAngle, 0, 0);
@@ -178,7 +182,7 @@ AffineTransform& AffineTransform::scaleNonUniform(double sx, double sy)
AffineTransform& AffineTransform::rotateFromVector(double x, double y)
{
- return rotate(rad2deg(atan2(y, x)));
+ return rotateRadians(atan2(y, x));
}
AffineTransform& AffineTransform::flipX()
@@ -372,7 +376,7 @@ bool AffineTransform::decompose(DecomposedType& decomp) const
double angle = atan2(m.b(), m.a());
// Remove rotation from matrix
- m.rotate(rad2deg(-angle));
+ m.rotateRadians(-angle);
// Return results
decomp.scaleX = sx;
@@ -396,7 +400,7 @@ void AffineTransform::recompose(const DecomposedType& decomp)
this->setD(decomp.remainderD);
this->setE(decomp.translateX);
this->setF(decomp.translateY);
- this->rotate(rad2deg(decomp.angle));
+ this->rotateRadians(decomp.angle);
this->scale(decomp.scaleX, decomp.scaleY);
}
« no previous file with comments | « Source/platform/transforms/AffineTransform.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698