aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkMatrix.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/core/SkMatrix.h')
-rw-r--r--include/core/SkMatrix.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h
index f148e390b5..71e6b9737b 100644
--- a/include/core/SkMatrix.h
+++ b/include/core/SkMatrix.h
@@ -470,6 +470,18 @@ public:
return this->mapRect(rect, *rect);
}
+ /** Apply this matrix to the src rectangle, and write the four transformed
+ points into dst. The points written to dst will be the original top-left, top-right,
+ bottom-right, and bottom-left points transformed by the matrix.
+ @param dst Where the transformed quad is written.
+ @param rect The original rectangle to be transformed.
+ */
+ void mapRectToQuad(SkPoint dst[4], const SkRect& rect) const {
+ // This could potentially be faster if we only transformed each x and y of the rect once.
+ rect.toQuad(dst);
+ this->mapPoints(dst, 4);
+ }
+
/** Return the mean radius of a circle after it has been mapped by
this matrix. NOTE: in perspective this value assumes the circle
has its center at the origin.