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

Unified Diff: include/effects/SkLayerDrawLooper.h

Issue 133813005: Builder class for SkLayerDrawLooper. (Closed) Base URL: https://skia.googlesource.com/skia.git@draw_looper_context
Patch Set: 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 | src/effects/SkLayerDrawLooper.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/effects/SkLayerDrawLooper.h
diff --git a/include/effects/SkLayerDrawLooper.h b/include/effects/SkLayerDrawLooper.h
index edffee648660d6d89aa1224d0cfb87c44c445751..70781596ade46de5cbed7c40034a1d5a74ab7645 100644
--- a/include/effects/SkLayerDrawLooper.h
+++ b/include/effects/SkLayerDrawLooper.h
@@ -141,7 +141,45 @@ private:
MyRegistrar();
};
+ friend class SkLayerDrawLooperBuilder;
typedef SkDrawLooper INHERITED;
};
+class SK_API SkLayerDrawLooperBuilder {
+public:
+ SkLayerDrawLooperBuilder();
+ ~SkLayerDrawLooperBuilder();
+
+ /**
+ * 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 SkLayerDrawLooper::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 SkLayerDrawLooper::LayerInfo&);
+
+ /**
+ * Pass list of layers onto newly built looper and return it. This will
+ * also reset the builder, so it can be used to build another looper.
+ */
+ SkDrawLooper* createLooper();
reed1 2014/02/07 18:32:22 possibly call this detachLooper(), as in other pla
Dominik Grewe 2014/02/07 18:57:02 Done.
+
+private:
+ SkLayerDrawLooper::Rec* fRecs;
+ SkLayerDrawLooper::Rec* fTopRec;
+ int fCount;
+};
+
#endif
« no previous file with comments | « no previous file | src/effects/SkLayerDrawLooper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698