OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "SkArithmeticMode.h" | 8 #include "SkArithmeticMode.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 return new SkArithmeticMode_scalar(k1, k2, k3, k4, enforcePMColor); | 24 return new SkArithmeticMode_scalar(k1, k2, k3, k4, enforcePMColor); |
25 } | 25 } |
26 | 26 |
27 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, | 27 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, |
28 const SkAlpha aa[]) const override; | 28 const SkAlpha aa[]) const override; |
29 | 29 |
30 SK_TO_STRING_OVERRIDE() | 30 SK_TO_STRING_OVERRIDE() |
31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArithmeticMode_scalar) | 31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArithmeticMode_scalar) |
32 | 32 |
33 #if SK_SUPPORT_GPU | 33 #if SK_SUPPORT_GPU |
34 bool asFragmentProcessor(GrFragmentProcessor**, GrProcessorDataManager*, | 34 bool asFragmentProcessor(const GrFragmentProcessor**, GrProcessorDataManager
*, |
35 GrTexture* background) const override; | 35 const GrFragmentProcessor* dst) const override; |
36 | 36 |
37 bool asXPFactory(GrXPFactory**) const override; | 37 bool asXPFactory(GrXPFactory**) const override; |
38 #endif | 38 #endif |
39 | 39 |
40 private: | 40 private: |
41 SkArithmeticMode_scalar(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4,
bool enforcePMColor) { | 41 SkArithmeticMode_scalar(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4,
bool enforcePMColor) { |
42 fK[0] = k1; | 42 fK[0] = k1; |
43 fK[1] = k2; | 43 fK[1] = k2; |
44 fK[2] = k3; | 44 fK[2] = k3; |
45 fK[3] = k4; | 45 fK[3] = k4; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 return new SkArithmeticMode_linear (i2, i3, i4); | 228 return new SkArithmeticMode_linear (i2, i3, i4); |
229 #endif | 229 #endif |
230 } | 230 } |
231 return SkArithmeticMode_scalar::Create(k1, k2, k3, k4, enforcePMColor); | 231 return SkArithmeticMode_scalar::Create(k1, k2, k3, k4, enforcePMColor); |
232 } | 232 } |
233 | 233 |
234 | 234 |
235 ////////////////////////////////////////////////////////////////////////////// | 235 ////////////////////////////////////////////////////////////////////////////// |
236 | 236 |
237 #if SK_SUPPORT_GPU | 237 #if SK_SUPPORT_GPU |
238 bool SkArithmeticMode_scalar::asFragmentProcessor(GrFragmentProcessor** fp, | 238 bool SkArithmeticMode_scalar::asFragmentProcessor(const GrFragmentProcessor** fp
, |
239 GrProcessorDataManager* procDa
taManager, | 239 GrProcessorDataManager* procDa
taManager, |
240 GrTexture* background) const { | 240 const GrFragmentProcessor* dst
) const { |
241 if (fp) { | 241 if (fp) { |
242 *fp = GrArithmeticFP::Create(procDataManager, | 242 *fp = GrArithmeticFP::Create(procDataManager, |
243 SkScalarToFloat(fK[0]), | 243 SkScalarToFloat(fK[0]), |
244 SkScalarToFloat(fK[1]), | 244 SkScalarToFloat(fK[1]), |
245 SkScalarToFloat(fK[2]), | 245 SkScalarToFloat(fK[2]), |
246 SkScalarToFloat(fK[3]), | 246 SkScalarToFloat(fK[3]), |
247 fEnforcePMColor, | 247 fEnforcePMColor, |
248 background); | 248 dst); |
249 } | 249 } |
250 return true; | 250 return true; |
251 } | 251 } |
252 | 252 |
253 bool SkArithmeticMode_scalar::asXPFactory(GrXPFactory** xpf) const { | 253 bool SkArithmeticMode_scalar::asXPFactory(GrXPFactory** xpf) const { |
254 if (xpf) { | 254 if (xpf) { |
255 *xpf = GrArithmeticXPFactory::Create(SkScalarToFloat(fK[0]), | 255 *xpf = GrArithmeticXPFactory::Create(SkScalarToFloat(fK[0]), |
256 SkScalarToFloat(fK[1]), | 256 SkScalarToFloat(fK[1]), |
257 SkScalarToFloat(fK[2]), | 257 SkScalarToFloat(fK[2]), |
258 SkScalarToFloat(fK[3]), | 258 SkScalarToFloat(fK[3]), |
259 fEnforcePMColor); | 259 fEnforcePMColor); |
260 } | 260 } |
261 return true; | 261 return true; |
262 } | 262 } |
263 | 263 |
264 #endif | 264 #endif |
265 | 265 |
266 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) | 266 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) |
267 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) | 267 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) |
268 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 268 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |