OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkXfermode_DEFINED | 10 #ifndef SkXfermode_DEFINED |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 * is NULL, and if so, treats it as kSrcOver_Mode. | 212 * is NULL, and if so, treats it as kSrcOver_Mode. |
213 */ | 213 */ |
214 static bool AsNewEffectOrCoeff(SkXfermode*, | 214 static bool AsNewEffectOrCoeff(SkXfermode*, |
215 GrContext*, | 215 GrContext*, |
216 GrEffectRef** effect, | 216 GrEffectRef** effect, |
217 Coeff* src, | 217 Coeff* src, |
218 Coeff* dst, | 218 Coeff* dst, |
219 GrTexture* background = NULL); | 219 GrTexture* background = NULL); |
220 | 220 |
221 SkDEVCODE(virtual void toString(SkString* str) const = 0;) | 221 SkDEVCODE(virtual void toString(SkString* str) const = 0;) |
222 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 222 SK_DECLARE_FLATTENABLE_GROUP_TYPE(SkXfermode) |
223 protected: | 223 protected: |
224 SkXfermode(SkFlattenableReadBuffer& rb) : SkFlattenable(rb) {} | 224 SkXfermode(SkFlattenableReadBuffer& rb) : SkFlattenable(rb) {} |
225 | 225 |
226 /** The default implementation of xfer32/xfer16/xferA8 in turn call this | 226 /** The default implementation of xfer32/xfer16/xferA8 in turn call this |
227 method, 1 color at a time (upscaled to a SkPMColor). The default | 227 method, 1 color at a time (upscaled to a SkPMColor). The default |
228 implmentation of this method just returns dst. If performance is | 228 implmentation of this method just returns dst. If performance is |
229 important, your subclass should override xfer32/xfer16/xferA8 directly. | 229 important, your subclass should override xfer32/xfer16/xferA8 directly. |
230 | 230 |
231 This method will not be called directly by the client, so it need not | 231 This method will not be called directly by the client, so it need not |
232 be implemented if your subclass has overridden xfer32/xfer16/xferA8 | 232 be implemented if your subclass has overridden xfer32/xfer16/xferA8 |
233 */ | 233 */ |
234 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const; | 234 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const; |
235 | 235 |
236 private: | 236 private: |
237 enum { | 237 enum { |
238 kModeCount = kLastMode + 1 | 238 kModeCount = kLastMode + 1 |
239 }; | 239 }; |
240 | 240 |
241 friend class SkGraphics; | 241 friend class SkGraphics; |
242 static void Term(); | 242 static void Term(); |
243 | |
244 typedef SkFlattenable INHERITED; | 243 typedef SkFlattenable INHERITED; |
245 }; | 244 }; |
246 | 245 |
247 /////////////////////////////////////////////////////////////////////////////// | 246 /////////////////////////////////////////////////////////////////////////////// |
248 | 247 |
249 /** \class SkProcXfermode | 248 /** \class SkProcXfermode |
250 | 249 |
251 SkProcXfermode is a xfermode that applies the specified proc to its colors. | 250 SkProcXfermode is a xfermode that applies the specified proc to its colors. |
252 This class is not exported to java. | 251 This class is not exported to java. |
253 */ | 252 */ |
254 class SkProcXfermode : public SkXfermode { | 253 class SkProcXfermode : public SkXfermode { |
255 public: | 254 public: |
256 SkProcXfermode(SkXfermodeProc proc) : fProc(proc) {} | 255 SkProcXfermode(SkXfermodeProc proc) : fProc(proc) {} |
257 | 256 |
258 // overrides from SkXfermode | 257 // overrides from SkXfermode |
259 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, | 258 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, |
260 const SkAlpha aa[]) const SK_OVERRIDE; | 259 const SkAlpha aa[]) const SK_OVERRIDE; |
261 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, | 260 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, |
262 const SkAlpha aa[]) const SK_OVERRIDE; | 261 const SkAlpha aa[]) const SK_OVERRIDE; |
263 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count, | 262 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count, |
264 const SkAlpha aa[]) const SK_OVERRIDE; | 263 const SkAlpha aa[]) const SK_OVERRIDE; |
265 | 264 |
266 SK_DEVELOPER_TO_STRING() | 265 SK_DEVELOPER_TO_STRING() |
267 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkProcXfermode) | 266 SK_DEFINE_FLATTENABLE_SERIALIZABLE_TYPE(SkProcXfermode) |
268 | 267 |
269 protected: | 268 protected: |
270 SkProcXfermode(SkFlattenableReadBuffer&); | 269 SkProcXfermode(SkFlattenableReadBuffer&); |
271 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; | 270 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
272 | 271 |
273 // allow subclasses to update this after we unflatten | 272 // allow subclasses to update this after we unflatten |
274 void setProc(SkXfermodeProc proc) { | 273 void setProc(SkXfermodeProc proc) { |
275 fProc = proc; | 274 fProc = proc; |
276 } | 275 } |
277 | 276 |
278 private: | 277 private: |
279 SkXfermodeProc fProc; | 278 SkXfermodeProc fProc; |
280 | 279 |
281 typedef SkXfermode INHERITED; | 280 typedef SkXfermode INHERITED; |
282 }; | 281 }; |
283 | 282 |
284 #endif | 283 #endif |
OLD | NEW |