blob: 670ac23d87541e148da29070e31cb71a028b20cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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
|