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 14 matching lines...) Expand all Loading... | |
25 * specified in the Modes enum. When an SkXfermode is assigned to an SkPaint, | 25 * specified in the Modes enum. When an SkXfermode is assigned to an SkPaint, |
26 * then objects drawn with that paint have the xfermode applied. | 26 * then objects drawn with that paint have the xfermode applied. |
27 * | 27 * |
28 * All subclasses are required to be reentrant-safe : it must be legal to share | 28 * All subclasses are required to be reentrant-safe : it must be legal to share |
29 * the same instance between several threads. | 29 * the same instance between several threads. |
30 */ | 30 */ |
31 class SK_API SkXfermode : public SkFlattenable { | 31 class SK_API SkXfermode : public SkFlattenable { |
32 public: | 32 public: |
33 SK_DECLARE_INST_COUNT(SkXfermode) | 33 SK_DECLARE_INST_COUNT(SkXfermode) |
34 | 34 |
35 SkXfermode() {} | |
36 | |
37 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, | 35 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, |
38 const SkAlpha aa[]) const; | 36 const SkAlpha aa[]) const; |
39 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, | 37 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, |
40 const SkAlpha aa[]) const; | 38 const SkAlpha aa[]) const; |
41 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count, | 39 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count, |
42 const SkAlpha aa[]) const; | 40 const SkAlpha aa[]) const; |
43 | 41 |
44 /** Enum of possible coefficients to describe some xfermodes | 42 /** Enum of possible coefficients to describe some xfermodes |
45 */ | 43 */ |
46 enum Coeff { | 44 enum Coeff { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 GrEffectRef** effect, | 209 GrEffectRef** effect, |
212 Coeff* src, | 210 Coeff* src, |
213 Coeff* dst, | 211 Coeff* dst, |
214 GrTexture* background = NULL); | 212 GrTexture* background = NULL); |
215 | 213 |
216 SkDEVCODE(virtual void toString(SkString* str) const = 0;) | 214 SkDEVCODE(virtual void toString(SkString* str) const = 0;) |
217 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 215 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
218 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode) | 216 SK_DEFINE_FLATTENABLE_TYPE(SkXfermode) |
219 | 217 |
220 protected: | 218 protected: |
219 SkXfermode() {} | |
221 SkXfermode(SkReadBuffer& rb) : SkFlattenable(rb) {} | 220 SkXfermode(SkReadBuffer& rb) : SkFlattenable(rb) {} |
222 | 221 |
223 /** The default implementation of xfer32/xfer16/xferA8 in turn call this | 222 /** The default implementation of xfer32/xfer16/xferA8 in turn call this |
224 method, 1 color at a time (upscaled to a SkPMColor). The default | 223 method, 1 color at a time (upscaled to a SkPMColor). The default |
225 implmentation of this method just returns dst. If performance is | 224 implmentation of this method just returns dst. If performance is |
226 important, your subclass should override xfer32/xfer16/xferA8 directly. | 225 important, your subclass should override xfer32/xfer16/xferA8 directly. |
227 | 226 |
228 This method will not be called directly by the client, so it need not | 227 This method will not be called directly by the client, so it need not |
229 be implemented if your subclass has overridden xfer32/xfer16/xferA8 | 228 be implemented if your subclass has overridden xfer32/xfer16/xferA8 |
230 */ | 229 */ |
(...skipping 12 matching lines...) Expand all Loading... | |
243 | 242 |
244 /////////////////////////////////////////////////////////////////////////////// | 243 /////////////////////////////////////////////////////////////////////////////// |
245 | 244 |
246 /** \class SkProcXfermode | 245 /** \class SkProcXfermode |
247 | 246 |
248 SkProcXfermode is a xfermode that applies the specified proc to its colors. | 247 SkProcXfermode is a xfermode that applies the specified proc to its colors. |
249 This class is not exported to java. | 248 This class is not exported to java. |
250 */ | 249 */ |
251 class SkProcXfermode : public SkXfermode { | 250 class SkProcXfermode : public SkXfermode { |
252 public: | 251 public: |
253 SkProcXfermode(SkXfermodeProc proc) : fProc(proc) {} | 252 SkProcXfermode(SkXfermodeProc proc) : fProc(proc) {} |
reed1
2014/02/18 14:06:22
Should this (all) constructor be protected?
| |
254 | 253 |
254 static SkProcXfermode* Create(SkXfermodeProc proc) { | |
255 return SkNEW_ARGS(SkProcXfermode, (proc)); | |
256 } | |
257 | |
255 // overrides from SkXfermode | 258 // overrides from SkXfermode |
256 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, | 259 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, |
257 const SkAlpha aa[]) const SK_OVERRIDE; | 260 const SkAlpha aa[]) const SK_OVERRIDE; |
258 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, | 261 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, |
259 const SkAlpha aa[]) const SK_OVERRIDE; | 262 const SkAlpha aa[]) const SK_OVERRIDE; |
260 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count, | 263 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count, |
261 const SkAlpha aa[]) const SK_OVERRIDE; | 264 const SkAlpha aa[]) const SK_OVERRIDE; |
262 | 265 |
263 SK_DEVELOPER_TO_STRING() | 266 SK_DEVELOPER_TO_STRING() |
264 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkProcXfermode) | 267 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkProcXfermode) |
(...skipping 11 matching lines...) Expand all Loading... | |
276 return fProc; | 279 return fProc; |
277 } | 280 } |
278 | 281 |
279 private: | 282 private: |
280 SkXfermodeProc fProc; | 283 SkXfermodeProc fProc; |
281 | 284 |
282 typedef SkXfermode INHERITED; | 285 typedef SkXfermode INHERITED; |
283 }; | 286 }; |
284 | 287 |
285 #endif | 288 #endif |
OLD | NEW |