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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 Rec* fCurrRec; | 127 Rec* fCurrRec; |
128 | 128 |
129 static void ApplyInfo(SkPaint* dst, const SkPaint& src, const LayerInfo&); | 129 static void ApplyInfo(SkPaint* dst, const SkPaint& src, const LayerInfo&); |
130 | 130 |
131 class MyRegistrar : public SkFlattenable::Registrar { | 131 class MyRegistrar : public SkFlattenable::Registrar { |
132 public: | 132 public: |
133 MyRegistrar(); | 133 MyRegistrar(); |
134 }; | 134 }; |
135 | 135 |
136 typedef SkDrawLooper INHERITED; | 136 typedef SkDrawLooper INHERITED; |
| 137 |
| 138 public: |
| 139 class SK_API Builder { |
| 140 public: |
| 141 Builder(); |
| 142 ~Builder(); |
| 143 |
| 144 /** |
| 145 * Call for each layer you want to add (from top to bottom). |
| 146 * This returns a paint you can modify, but that ptr is only valid unti
l |
| 147 * the next call made to addLayer(). |
| 148 */ |
| 149 SkPaint* addLayer(const LayerInfo&); |
| 150 |
| 151 /** |
| 152 * This layer will draw with the original paint, at the specified offse
t |
| 153 */ |
| 154 void addLayer(SkScalar dx, SkScalar dy); |
| 155 |
| 156 /** |
| 157 * This layer will with the original paint and no offset. |
| 158 */ |
| 159 void addLayer() { this->addLayer(0, 0); } |
| 160 |
| 161 /// Similar to addLayer, but adds a layer to the top. |
| 162 SkPaint* addLayerOnTop(const LayerInfo&); |
| 163 |
| 164 /** |
| 165 * Pass list of layers on to newly built looper and return it. This wil
l |
| 166 * also reset the builder, so it can be used to build another looper. |
| 167 */ |
| 168 SkLayerDrawLooper* detachLooper(); |
| 169 |
| 170 private: |
| 171 Rec* fRecs; |
| 172 Rec* fTopRec; |
| 173 int fCount; |
| 174 |
| 175 void initLooperAndReset(SkLayerDrawLooper* looper); |
| 176 |
| 177 friend class SkLayerDrawLooper; |
| 178 }; |
137 }; | 179 }; |
138 | 180 |
139 #endif | 181 #endif |
OLD | NEW |