aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar Ben Wagner <benjaminwagner@google.com>2017-10-06 15:08:23 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-07 18:26:51 +0000
commit3cd0bef0fd9d062bbcc313c329b4f31925e8ded7 (patch)
treeff5e04f05e3b7e80eab4db11c91402e624e8e90a /include/core
parent196efbf71cdd9a64b807e5e869cd45da5a66ac36 (diff)
Fix a couple float-cast-overflow in SkScan*.
Bug: skia:5060 Change-Id: I60a48993c77631aaad9354bb86b13204dc618bf4 Reviewed-on: https://skia-review.googlesource.com/47422 Commit-Queue: Ben Wagner <benjaminwagner@google.com> Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkRect.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/core/SkRect.h b/include/core/SkRect.h
index 2cc2604941..12afddd9ce 100644
--- a/include/core/SkRect.h
+++ b/include/core/SkRect.h
@@ -411,6 +411,14 @@ struct SK_API SkRect {
return r;
}
+ // The largest SkRect for which round() is well-defined.
+ static SkRect SK_WARN_UNUSED_RESULT MakeLargestS32() {
+ const SkRect r = MakeLTRB(SK_MinS32FitsInFloat, SK_MinS32FitsInFloat,
+ SK_MaxS32FitsInFloat, SK_MaxS32FitsInFloat);
+ SkASSERT(r == Make(r.roundOut()));
+ return r;
+ }
+
static constexpr SkRect SK_WARN_UNUSED_RESULT MakeWH(SkScalar w, SkScalar h) {
return SkRect{0, 0, w, h};
}