OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkLayerDrawLooper_DEFINED | 8 #ifndef SkLayerDrawLooper_DEFINED |
9 #define SkLayerDrawLooper_DEFINED | 9 #define SkLayerDrawLooper_DEFINED |
10 | 10 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 void flatten(SkWriteBuffer&) const override; | 88 void flatten(SkWriteBuffer&) const override; |
89 | 89 |
90 private: | 90 private: |
91 struct Rec { | 91 struct Rec { |
92 Rec* fNext; | 92 Rec* fNext; |
93 SkPaint fPaint; | 93 SkPaint fPaint; |
94 LayerInfo fInfo; | 94 LayerInfo fInfo; |
95 }; | 95 }; |
96 Rec* fRecs; | 96 Rec* fRecs; |
97 Rec* fTopRec; | |
98 int fCount; | 97 int fCount; |
99 | 98 |
100 // state-machine during the init/next cycle | 99 // state-machine during the init/next cycle |
101 class LayerDrawLooperContext : public SkDrawLooper::Context { | 100 class LayerDrawLooperContext : public SkDrawLooper::Context { |
102 public: | 101 public: |
103 explicit LayerDrawLooperContext(const SkLayerDrawLooper* looper); | 102 explicit LayerDrawLooperContext(const SkLayerDrawLooper* looper); |
104 | 103 |
105 protected: | 104 protected: |
106 bool next(SkCanvas*, SkPaint* paint) override; | 105 bool next(SkCanvas*, SkPaint* paint) override; |
107 | 106 |
108 private: | 107 private: |
109 Rec* fCurrRec; | 108 Rec* fCurrRec; |
110 | 109 |
111 static void ApplyInfo(SkPaint* dst, const SkPaint& src, const LayerInfo&
); | 110 static void ApplyInfo(SkPaint* dst, const SkPaint& src, const LayerInfo&
); |
112 }; | 111 }; |
113 | 112 |
114 class MyRegistrar : public SkFlattenable::Registrar { | |
115 public: | |
116 MyRegistrar(); | |
117 }; | |
118 | |
119 typedef SkDrawLooper INHERITED; | 113 typedef SkDrawLooper INHERITED; |
120 | 114 |
121 public: | 115 public: |
122 class SK_API Builder { | 116 class SK_API Builder { |
123 public: | 117 public: |
124 Builder(); | 118 Builder(); |
125 ~Builder(); | 119 ~Builder(); |
126 | 120 |
127 /** | 121 /** |
128 * Call for each layer you want to add (from top to bottom). | 122 * Call for each layer you want to add (from top to bottom). |
(...skipping 22 matching lines...) Expand all Loading... |
151 SkLayerDrawLooper* detachLooper(); | 145 SkLayerDrawLooper* detachLooper(); |
152 | 146 |
153 private: | 147 private: |
154 Rec* fRecs; | 148 Rec* fRecs; |
155 Rec* fTopRec; | 149 Rec* fTopRec; |
156 int fCount; | 150 int fCount; |
157 }; | 151 }; |
158 }; | 152 }; |
159 | 153 |
160 #endif | 154 #endif |
OLD | NEW |