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

Unified Diff: include/core/SkDrawLooper.h

Issue 155513012: [WIP] Add Context to SkDrawLooper. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make methods const. Created 6 years, 10 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 | include/effects/SkBlurDrawLooper.h » ('j') | include/effects/SkBlurDrawLooper.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkDrawLooper.h
diff --git a/include/core/SkDrawLooper.h b/include/core/SkDrawLooper.h
index 4609c1dcf90ddb67a4708909ea209b5063fcfe18..04db0bed829c1f743ea62280d7f0c9a4a33dc98f 100644
--- a/include/core/SkDrawLooper.h
+++ b/include/core/SkDrawLooper.h
@@ -30,10 +30,19 @@ public:
SK_DECLARE_INST_COUNT(SkDrawLooper)
/**
+ * Holds state during a draw. A new object is returned by init() and must
+ * be passed into all subsequent calls of next(). The final call to next()
+ * will also delete the context.
+ * Subclasses of SkDrawLooper should create a subclass of this object to
+ * hold state specific to their subclass.
+ */
+ struct SK_API DrawContext {};
+
+ /**
* Called right before something is being drawn. This will be followed by
* calls to next() until next() returns false.
*/
- virtual void init(SkCanvas*) = 0;
+ virtual DrawContext* init(SkCanvas*) const = 0;
/**
* Called in a loop (after init()). Each time true is returned, the object
@@ -47,7 +56,7 @@ public:
* that the canvas has been restored to the state it was initially, before
* init() was first called.
*/
- virtual bool next(SkCanvas*, SkPaint* paint) = 0;
+ bool next(SkCanvas* canvas, SkPaint* paint, DrawContext* context) const;
scroggo 2014/02/06 17:57:13 It's a little weird that the parameter that's pass
/**
* The fast bounds functions are used to enable the paint to be culled early
@@ -70,6 +79,9 @@ protected:
SkDrawLooper() {}
SkDrawLooper(SkReadBuffer& buffer) : INHERITED(buffer) {}
+ virtual bool next_internal(
scroggo 2014/02/06 17:57:13 I think our typical naming convention would be onN
+ SkCanvas* canvas, SkPaint* paint, DrawContext* context) const = 0;
+
private:
typedef SkFlattenable INHERITED;
};
« no previous file with comments | « no previous file | include/effects/SkBlurDrawLooper.h » ('j') | include/effects/SkBlurDrawLooper.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698