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

Unified Diff: include/core/SkMatrix.h

Issue 1003813003: some utils for rect and matrix (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | include/core/SkRect.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkMatrix.h
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h
index da7838b78195c6a7d101a29399a49406270714e2..a272051067e7dabb511ac38d9ad01f07c206fd55 100644
--- a/include/core/SkMatrix.h
+++ b/include/core/SkMatrix.h
@@ -457,6 +457,12 @@ public:
this->getMapXYProc()(*this, x, y, result);
}
+ SkPoint mapXY(SkScalar x, SkScalar y) const {
+ SkPoint result;
+ this->getMapXYProc()(*this, x, y, &result);
+ return result;
+ }
+
/** Apply this matrix to the array of vectors specified by src, and write
the transformed vectors into the array of vectors specified by dst.
This is similar to mapPoints, but ignores any translation in the matrix.
@@ -480,6 +486,17 @@ public:
this->mapVectors(vecs, vecs, count);
}
+ void mapVector(SkScalar dx, SkScalar dy, SkVector* result) const {
+ SkVector vec = { dx, dy };
+ this->mapVectors(result, &vec, 1);
+ }
+
+ SkVector mapVector(SkScalar dx, SkScalar dy) const {
+ SkVector vec = { dx, dy };
+ this->mapVectors(&vec, &vec, 1);
+ return vec;
+ }
+
/** Apply this matrix to the src rectangle, and write the transformed
rectangle into dst. This is accomplished by transforming the 4 corners
of src, and then setting dst to the bounds of those points.
« no previous file with comments | « no previous file | include/core/SkRect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698