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 13 matching lines...) Expand all Loading... |
24 * "transfer-modes" in the drawing pipeline. The static function Create(Modes) | 24 * "transfer-modes" in the drawing pipeline. The static function Create(Modes) |
25 * can be called to return an instance of any of the predefined subclasses as | 25 * can be called to return an instance of any of the predefined subclasses as |
26 * specified in the Modes enum. When an SkXfermode is assigned to an SkPaint, | 26 * specified in the Modes enum. When an SkXfermode is assigned to an SkPaint, |
27 * then objects drawn with that paint have the xfermode applied. | 27 * then objects drawn with that paint have the xfermode applied. |
28 * | 28 * |
29 * All subclasses are required to be reentrant-safe : it must be legal to share | 29 * All subclasses are required to be reentrant-safe : it must be legal to share |
30 * the same instance between several threads. | 30 * the same instance between several threads. |
31 */ | 31 */ |
32 class SK_API SkXfermode : public SkFlattenable { | 32 class SK_API SkXfermode : public SkFlattenable { |
33 public: | 33 public: |
34 SK_DECLARE_INST_COUNT(SkXfermode) | |
35 | |
36 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, | 34 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, |
37 const SkAlpha aa[]) const; | 35 const SkAlpha aa[]) const; |
38 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, | 36 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, |
39 const SkAlpha aa[]) const; | 37 const SkAlpha aa[]) const; |
40 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count, | 38 virtual void xferA8(SkAlpha dst[], const SkPMColor src[], int count, |
41 const SkAlpha aa[]) const; | 39 const SkAlpha aa[]) const; |
42 | 40 |
43 /** Enum of possible coefficients to describe some xfermodes | 41 /** Enum of possible coefficients to describe some xfermodes |
44 */ | 42 */ |
45 enum Coeff { | 43 enum Coeff { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 */ | 160 */ |
163 static bool ModeAsCoeff(Mode mode, Coeff* src, Coeff* dst); | 161 static bool ModeAsCoeff(Mode mode, Coeff* src, Coeff* dst); |
164 | 162 |
165 SK_ATTR_DEPRECATED("use AsMode(...)") | 163 SK_ATTR_DEPRECATED("use AsMode(...)") |
166 static bool IsMode(const SkXfermode* xfer, Mode* mode) { | 164 static bool IsMode(const SkXfermode* xfer, Mode* mode) { |
167 return AsMode(xfer, mode); | 165 return AsMode(xfer, mode); |
168 } | 166 } |
169 | 167 |
170 /** | 168 /** |
171 * Returns whether or not the xfer mode can support treating coverage as alp
ha | 169 * Returns whether or not the xfer mode can support treating coverage as alp
ha |
172 */ | 170 */ |
173 virtual bool supportsCoverageAsAlpha() const; | 171 virtual bool supportsCoverageAsAlpha() const; |
174 | 172 |
175 /** | 173 /** |
176 * The same as calling xfermode->supportsCoverageAsAlpha(), except that thi
s also checks if | 174 * The same as calling xfermode->supportsCoverageAsAlpha(), except that thi
s also checks if |
177 * the xfermode is NULL, and if so, treats it as kSrcOver_Mode. | 175 * the xfermode is NULL, and if so, treats it as kSrcOver_Mode. |
178 */ | 176 */ |
179 static bool SupportsCoverageAsAlpha(const SkXfermode* xfer); | 177 static bool SupportsCoverageAsAlpha(const SkXfermode* xfer); |
180 | 178 |
181 enum SrcColorOpacity { | 179 enum SrcColorOpacity { |
182 // The src color is known to be opaque (alpha == 255) | 180 // The src color is known to be opaque (alpha == 255) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 241 |
244 private: | 242 private: |
245 enum { | 243 enum { |
246 kModeCount = kLastMode + 1 | 244 kModeCount = kLastMode + 1 |
247 }; | 245 }; |
248 | 246 |
249 typedef SkFlattenable INHERITED; | 247 typedef SkFlattenable INHERITED; |
250 }; | 248 }; |
251 | 249 |
252 #endif | 250 #endif |
OLD | NEW |