aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2018-05-16 21:28:55 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-17 14:02:43 +0000
commitc06754b0466e14e1611fa3144bf337289e6ca82f (patch)
tree287a31a09b4556003569103655a855f8eefd43a6 /include
parentbd74e6a02ae0e7b031aa1d1cd73062dba2c93daf (diff)
mapRect should not fiddle with nonfinite values.
Docs-Preview: https://skia.org/?cl=128682 Bug: skia:7967 Change-Id: Ic43387b7705ee8385b8df2430886484ff856077c Reviewed-on: https://skia-review.googlesource.com/128682 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/core/SkMatrix.h9
-rw-r--r--include/core/SkRect.h6
2 files changed, 15 insertions, 0 deletions
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h
index 6a990526ab..9733590167 100644
--- a/include/core/SkMatrix.h
+++ b/include/core/SkMatrix.h
@@ -1452,6 +1452,15 @@ public:
return this->mapRect(rect, *rect);
}
+ /**
+ * Map the rectangle though the matrix, and return the bounds of the transformed points.
+ */
+ SkRect mapRect(const SkRect& src) const {
+ SkRect dst;
+ (void)this->mapRect(&dst, src);
+ return dst;
+ }
+
/** Maps four corners of rect to dst. SkPoint are mapped by multiplying each
rect corner by SkMatrix. rect corner is processed in this order:
(rect.fLeft, rect.fTop), (rect.fRight, rect.fTop), (rect.fRight, rect.fBottom),
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index 4bf84d91e8..d4a9c05c68 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -1077,6 +1077,12 @@ struct SK_API SkRect {
*/
bool setBoundsCheck(const SkPoint pts[], int count);
+ /**
+ * Like setBoundsCheck() but this does not check for finite/nonfinite values. If any of the
+ * points are nonfinite, then the bounds will also be nonfinite.
+ */
+ void setBoundsNoCheck(const SkPoint pts[], int count);
+
/** Sets bounds to the smallest SkRect enclosing SkPoint p0 and p1. The result is
sorted and may be empty. Does not check to see if values are finite.