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

Unified Diff: src/core/SkMatrix.cpp

Issue 151923006: Add rotation APIs in radians to SkCanvas, SkMatrix Base URL: https://skia.googlesource.com/skia.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
« include/core/SkCanvas.h ('K') | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMatrix.cpp
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index 33af64a41fe9f40e61756203b770f75cd1de3ee5..c03562d7e0d7615c8b5c240ca3a5b5c974b9e239 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -424,18 +424,50 @@ void SkMatrix::setSinCos(SkScalar sinV, SkScalar cosV) {
this->setTypeMask(kUnknown_Mask | kOnlyPerspectiveValid_Mask);
}
-void SkMatrix::setRotate(SkScalar degrees, SkScalar px, SkScalar py) {
+void SkMatrix::setRotateRadians(SkScalar radians, SkScalar px, SkScalar py) {
SkScalar sinV, cosV;
- sinV = SkScalarSinCos(SkDegreesToRadians(degrees), &cosV);
+ sinV = SkScalarSinCos(radians, &cosV);
this->setSinCos(sinV, cosV, px, py);
}
-void SkMatrix::setRotate(SkScalar degrees) {
+void SkMatrix::setRotateRadians(SkScalar radians) {
SkScalar sinV, cosV;
- sinV = SkScalarSinCos(SkDegreesToRadians(degrees), &cosV);
+ sinV = SkScalarSinCos(radians, &cosV);
this->setSinCos(sinV, cosV);
}
+bool SkMatrix::preRotateRadians(SkScalar radians, SkScalar px, SkScalar py) {
+ SkMatrix m;
+ m.setRotateRadians(radians, px, py);
+ return this->preConcat(m);
+}
+
+bool SkMatrix::preRotateRadians(SkScalar radians) {
+ SkMatrix m;
+ m.setRotateRadians(radians);
+ return this->preConcat(m);
+}
+
+bool SkMatrix::postRotateRadians(SkScalar radians, SkScalar px, SkScalar py) {
+ SkMatrix m;
+ m.setRotateRadians(radians, px, py);
+ return this->postConcat(m);
+}
+
+bool SkMatrix::postRotateRadians(SkScalar radians) {
+ SkMatrix m;
+ m.setRotateRadians(radians);
+ return this->postConcat(m);
+}
+
+void SkMatrix::setRotate(SkScalar degrees, SkScalar px, SkScalar py) {
+ this->setRotateRadians(SkDegreesToRadians(degrees), px, py);
+}
+
+void SkMatrix::setRotate(SkScalar degrees) {
+ this->setRotateRadians(SkDegreesToRadians(degrees));
+}
+
bool SkMatrix::preRotate(SkScalar degrees, SkScalar px, SkScalar py) {
SkMatrix m;
m.setRotate(degrees, px, py);
« include/core/SkCanvas.h ('K') | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698