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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 static bool IsMode(const SkXfermode* xfer, Mode mode); | 137 static bool IsMode(const SkXfermode* xfer, Mode mode); |
138 | 138 |
139 /** Return an SkXfermode object for the specified mode. | 139 /** Return an SkXfermode object for the specified mode. |
140 */ | 140 */ |
141 static SkXfermode* Create(Mode mode); | 141 static SkXfermode* Create(Mode mode); |
142 | 142 |
143 /** Return a function pointer to a routine that applies the specified | 143 /** Return a function pointer to a routine that applies the specified |
144 porter-duff transfer mode. | 144 porter-duff transfer mode. |
145 */ | 145 */ |
146 static SkXfermodeProc GetProc(Mode mode); | 146 static SkXfermodeProc GetProc(Mode mode); |
| 147 static SkXfermodeProc4f GetProc4f(Mode); |
147 | 148 |
148 /** | 149 /** |
149 * If the specified mode can be represented by a pair of Coeff, then return | 150 * If the specified mode can be represented by a pair of Coeff, then return |
150 * true and set (if not NULL) the corresponding coeffs. If the mode is | 151 * true and set (if not NULL) the corresponding coeffs. If the mode is |
151 * not representable as a pair of Coeffs, return false and ignore the | 152 * not representable as a pair of Coeffs, return false and ignore the |
152 * src and dst parameters. | 153 * src and dst parameters. |
153 */ | 154 */ |
154 static bool ModeAsCoeff(Mode mode, Coeff* src, Coeff* dst); | 155 static bool ModeAsCoeff(Mode mode, Coeff* src, Coeff* dst); |
155 | 156 |
156 SK_ATTR_DEPRECATED("use AsMode(...)") | 157 SK_ATTR_DEPRECATED("use AsMode(...)") |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 kDstIsSRGB_PM4fFlag = 1 << 1, | 235 kDstIsSRGB_PM4fFlag = 1 << 1, |
235 }; | 236 }; |
236 struct PM4fState { | 237 struct PM4fState { |
237 const SkXfermode* fXfer; | 238 const SkXfermode* fXfer; |
238 uint32_t fFlags; | 239 uint32_t fFlags; |
239 }; | 240 }; |
240 typedef void (*PM4fProc1)(const PM4fState&, uint32_t dst[], const SkPM4f& sr
c, | 241 typedef void (*PM4fProc1)(const PM4fState&, uint32_t dst[], const SkPM4f& sr
c, |
241 int count, const SkAlpha coverage[]); | 242 int count, const SkAlpha coverage[]); |
242 typedef void (*PM4fProcN)(const PM4fState&, uint32_t dst[], const SkPM4f src
[], | 243 typedef void (*PM4fProcN)(const PM4fState&, uint32_t dst[], const SkPM4f src
[], |
243 int count, const SkAlpha coverage[]); | 244 int count, const SkAlpha coverage[]); |
| 245 |
244 static PM4fProc1 GetPM4fProc1(Mode, uint32_t flags); | 246 static PM4fProc1 GetPM4fProc1(Mode, uint32_t flags); |
245 static PM4fProcN GetPM4fProcN(Mode, uint32_t flags); | 247 static PM4fProcN GetPM4fProcN(Mode, uint32_t flags); |
246 virtual PM4fProc1 getPM4fProc1(uint32_t flags) const; | 248 virtual PM4fProc1 getPM4fProc1(uint32_t flags) const; |
247 virtual PM4fProcN getPM4fProcN(uint32_t flags) const; | 249 virtual PM4fProcN getPM4fProcN(uint32_t flags) const; |
248 | 250 |
249 protected: | 251 protected: |
250 SkXfermode() {} | 252 SkXfermode() {} |
251 /** The default implementation of xfer32/xfer16/xferA8 in turn call this | 253 /** The default implementation of xfer32/xfer16/xferA8 in turn call this |
252 method, 1 color at a time (upscaled to a SkPMColor). The default | 254 method, 1 color at a time (upscaled to a SkPMColor). The default |
253 implementation of this method just returns dst. If performance is | 255 implementation of this method just returns dst. If performance is |
254 important, your subclass should override xfer32/xfer16/xferA8 directly. | 256 important, your subclass should override xfer32/xfer16/xferA8 directly. |
255 | 257 |
256 This method will not be called directly by the client, so it need not | 258 This method will not be called directly by the client, so it need not |
257 be implemented if your subclass has overridden xfer32/xfer16/xferA8 | 259 be implemented if your subclass has overridden xfer32/xfer16/xferA8 |
258 */ | 260 */ |
259 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const; | 261 virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst) const; |
260 | 262 |
261 private: | 263 private: |
262 enum { | 264 enum { |
263 kModeCount = kLastMode + 1 | 265 kModeCount = kLastMode + 1 |
264 }; | 266 }; |
265 | 267 |
266 typedef SkFlattenable INHERITED; | 268 typedef SkFlattenable INHERITED; |
267 }; | 269 }; |
268 | 270 |
269 #endif | 271 #endif |
OLD | NEW |