aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkPaint.h
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-05-12 11:21:36 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-13 22:58:17 +0000
commit60751d7a069fb540aa468068f792fb6f4999832d (patch)
tree6c4b6fafba4006357bb8240db8f41eb28afeaf7b /include/core/SkPaint.h
parentee93e7803ac23beaed838834948091b0062465aa (diff)
Sort all user-supplied rects before computeFastBounds
https://codereview.chromium.org/908353002 fixed drawRect 2+ years ago, but drawOval and drawArc were still susceptible. This version ensures that all rects are sorted before we do the bounds check. Added a new makeSorted helper to simplify the code, and an assert to catch any future oversight. All other drawing functions compute their bounds rect in some way that already ensures it is sorted. Bug: skia: Change-Id: I8926b2dbe9d496d0876f1ac5313bd058ae4568b7 Reviewed-on: https://skia-review.googlesource.com/16702 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'include/core/SkPaint.h')
-rw-r--r--include/core/SkPaint.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index 1d99e4047b..464e535758 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -986,6 +986,8 @@ public:
}
*/
const SkRect& computeFastBounds(const SkRect& orig, SkRect* storage) const {
+ // Things like stroking, etc... will do math on the bounds rect, assuming that it's sorted.
+ SkASSERT(orig.isSorted());
SkPaint::Style style = this->getStyle();
// ultra fast-case: filling with no effects that affect geometry
if (kFill_Style == style) {