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>
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index 1d99e40..464e535 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -986,6 +986,8 @@
}
*/
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) {