grab from latest android



git-svn-id: http://skia.googlecode.com/svn/trunk@27 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/effects/SkLayerDrawLooper.h b/include/effects/SkLayerDrawLooper.h
new file mode 100644
index 0000000..670ac23
--- /dev/null
+++ b/include/effects/SkLayerDrawLooper.h
@@ -0,0 +1,70 @@
+#ifndef SkLayerDrawLooper_DEFINED
+#define SkLayerDrawLooper_DEFINED
+
+#include "SkDrawLooper.h"
+
+struct SkPoint;
+
+class SkLayerDrawLooper : public SkDrawLooper {
+public:
+            SkLayerDrawLooper();
+    virtual ~SkLayerDrawLooper();
+    
+    /** 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 this object.
+     */
+    SkPaint* addLayer(SkScalar dx, SkScalar dy);
+    
+    /** Helper for addLayer() which passes (0, 0) for the offset parameters
+     */
+    SkPaint* addLayer() {
+        return this->addLayer(0, 0);
+    }
+    
+    // overrides from SkDrawLooper
+    virtual void init(SkCanvas*, SkPaint*);
+    virtual bool next();
+    virtual void restore();
+
+    // must be public for Registrar :(
+    static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
+        return SkNEW_ARGS(SkLayerDrawLooper, (buffer));
+    }
+    
+protected:
+    SkLayerDrawLooper(SkFlattenableReadBuffer&);
+
+    // overrides from SkFlattenable
+    virtual void flatten(SkFlattenableWriteBuffer& );
+    virtual Factory getFactory() { return CreateProc; }
+    
+private:
+    struct Rec {
+        Rec*    fNext;
+        SkPaint fPaint;
+        SkPoint fOffset;
+        
+        static Rec* Reverse(Rec*);
+    };
+    Rec*    fRecs;
+    int     fCount;
+    
+    struct Iter {
+        SkPaint     fSavedPaint;
+        SkPaint*    fPaint;
+        SkCanvas*   fCanvas;
+        Rec*        fRec;
+    };
+    Iter    fIter;
+    
+    class MyRegistrar : public SkFlattenable::Registrar {
+    public:
+        MyRegistrar();
+    };
+    
+    typedef SkDrawLooper INHERITED;
+};
+
+
+#endif