Index: include/core/SkMatrix.h |
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h |
index f148e390b5cd4930f2d985f61a286cda3748b7cc..71e6b9737b6ddbc7d9f94ec091b5be860e364680 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. |