Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Unified Diff: src/core/SkDraw.cpp

Issue 2155213002: check for culled-out paths inside SkDraw (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add slop (see skbug.com/5542) Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkDraw.cpp
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index efc43d2e8080df0a7395ddb52b1c46400527c25e..32fe4bbe766506643f798fdb2798e9fcc21e0dce 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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698