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

Unified Diff: src/core/SkCanvas.cpp

Issue 2248373004: quick check to not use AutoDrawLooper (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 4 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/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) {
« 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