Chromium Code Reviews| 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; |
| }; |