diff options
author | 2016-07-18 13:22:55 -0700 | |
---|---|---|
committer | 2016-07-18 13:22:55 -0700 | |
commit | 01a2ff8a325e17221b139968e337413df0c2e60c (patch) | |
tree | 0f7a0b81dbdb6c2a244ce605194bf9d67cbcacb4 | |
parent | 034f243c6de425dedf1786bba1aab30910b7ff53 (diff) |
check for culled-out paths inside SkDraw
BUG=629026
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2155213002
Review-Url: https://codereview.chromium.org/2155213002
-rw-r--r-- | src/core/SkDraw.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index efc43d2e80..32fe4bbe76 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -1017,6 +1017,27 @@ SkScalar SkDraw::ComputeResScaleForStroking(const SkMatrix& matrix) { void SkDraw::drawDevPath(const SkPath& devPath, const SkPaint& paint, bool drawCoverage, SkBlitter* customBlitter, bool doFill) const { + // Do a conservative quick-reject test, since a looper or other modifier may have moved us + // out of range. + if (!devPath.isInverseFillType()) { + // If we're a H or V line, our bounds will be empty. So we bloat here just so we don't + // appear empty to the intersects call. This also gives us slop in case we're antialiasing + SkRect pathBounds = devPath.getBounds().makeOutset(1, 1); + + if (paint.getMaskFilter()) { + paint.getMaskFilter()->computeFastBounds(pathBounds, &pathBounds); + + // Need to outset the path to work-around a bug in blurmaskfilter. When that is fixed + // we can remove this hack. See skbug.com/5542 + pathBounds.outset(7, 7); + } + + // Now compare against the clip's bounds + if (!SkRect::Make(fRC->getBounds()).intersects(pathBounds)) { + return; + } + } + SkBlitter* blitter = nullptr; SkAutoBlitterChoose blitterStorage; if (nullptr == customBlitter) { |