blob: d35d70d7dd37e95d3aecee4895e0dd710e5cd3e7 (
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
|
#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*);
virtual bool next(SkCanvas*, SkPaint* paint);
// 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;
// state-machine during the init/next cycle
Rec* fCurrRec;
class MyRegistrar : public SkFlattenable::Registrar {
public:
MyRegistrar();
};
typedef SkDrawLooper INHERITED;
};
#endif
|