Index: src/core/SkCanvas.cpp |
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp |
index 551ca60742b3a6e280306bf92b8998d1e84c3251..6fbc4fe709c327f21c1c70dc8f6ac27990576bb5 100644 |
--- a/src/core/SkCanvas.cpp |
+++ b/src/core/SkCanvas.cpp |
@@ -2199,6 +2199,14 @@ void SkCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[], |
LOOPER_END |
} |
+static bool needs_autodrawlooper(SkCanvas* canvas, const SkPaint& paint) { |
+ return ((intptr_t)paint.getImageFilter() | |
+#ifdef SK_SUPPORT_LEGACY_DRAWFILTER |
+ (intptr_t)canvas->getDrawFilter() | |
+#endif |
+ (intptr_t)paint.getLooper() ) != 0; |
+} |
+ |
void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) { |
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRect()"); |
SkRect storage; |
@@ -2215,13 +2223,21 @@ void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) { |
bounds = &r; |
} |
- LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, SkDrawFilter::kRect_Type, bounds, false) |
+ if (needs_autodrawlooper(this, paint)) { |
+ LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, SkDrawFilter::kRect_Type, bounds, false) |
- while (iter.next()) { |
- iter.fDevice->drawRect(iter, r, looper.paint()); |
- } |
+ while (iter.next()) { |
+ iter.fDevice->drawRect(iter, r, looper.paint()); |
+ } |
- LOOPER_END |
+ LOOPER_END |
+ } else { |
+ this->predrawNotify(bounds, &paint, false); |
+ SkDrawIter iter(this); |
+ while (iter.next()) { |
+ iter.fDevice->drawRect(iter, r, paint); |
+ } |
+ } |
} |
void SkCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) { |