Index: include/effects/SkLayerDrawLooper.h |
diff --git a/include/effects/SkLayerDrawLooper.h b/include/effects/SkLayerDrawLooper.h |
index 6955192b53f2e6f9edeb94f49efd0858a8a73b2b..761f6c9ca7dd69f6c7f81532bde0e868fe170258 100644 |
--- a/include/effects/SkLayerDrawLooper.h |
+++ b/include/effects/SkLayerDrawLooper.h |
@@ -134,6 +134,48 @@ private: |
}; |
typedef SkDrawLooper INHERITED; |
+ |
+public: |
+ class SK_API Builder { |
+ public: |
+ Builder(); |
+ ~Builder(); |
+ |
+ /** |
+ * Call for each layer you want to add (from top to bottom). |
+ * This returns a paint you can modify, but that ptr is only valid until |
+ * the next call made to addLayer(). |
+ */ |
+ SkPaint* addLayer(const LayerInfo&); |
+ |
+ /** |
+ * This layer will draw with the original paint, at the specified offset |
+ */ |
+ void addLayer(SkScalar dx, SkScalar dy); |
+ |
+ /** |
+ * This layer will with the original paint and no offset. |
+ */ |
+ void addLayer() { this->addLayer(0, 0); } |
+ |
+ /// Similar to addLayer, but adds a layer to the top. |
+ SkPaint* addLayerOnTop(const LayerInfo&); |
+ |
+ /** |
+ * Pass list of layers on to newly built looper and return it. This will |
+ * also reset the builder, so it can be used to build another looper. |
+ */ |
+ SkLayerDrawLooper* detachLooper(); |
+ |
+ private: |
+ Rec* fRecs; |
+ Rec* fTopRec; |
+ int fCount; |
+ |
+ void initLooperAndReset(SkLayerDrawLooper* looper); |
+ |
+ friend class SkLayerDrawLooper; |
+ }; |
}; |
#endif |