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 16 matching lines...) Expand all Loading... |
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(const GrFragmentProcessor**, | 34 bool asFragmentProcessor(const GrFragmentProcessor**, |
35 const GrFragmentProcessor* dst) const override; | 35 const GrFragmentProcessor* dst) const override; |
36 | 36 |
37 bool asXPFactory(const 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; |
46 fEnforcePMColor = enforcePMColor; | 46 fEnforcePMColor = enforcePMColor; |
47 } | 47 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 *fp = GrArithmeticFP::Create(SkScalarToFloat(fK[0]), | 241 *fp = GrArithmeticFP::Create(SkScalarToFloat(fK[0]), |
242 SkScalarToFloat(fK[1]), | 242 SkScalarToFloat(fK[1]), |
243 SkScalarToFloat(fK[2]), | 243 SkScalarToFloat(fK[2]), |
244 SkScalarToFloat(fK[3]), | 244 SkScalarToFloat(fK[3]), |
245 fEnforcePMColor, | 245 fEnforcePMColor, |
246 dst); | 246 dst); |
247 } | 247 } |
248 return true; | 248 return true; |
249 } | 249 } |
250 | 250 |
251 bool SkArithmeticMode_scalar::asXPFactory(const GrXPFactory** xpf) const { | 251 bool SkArithmeticMode_scalar::asXPFactory(GrXPFactory** xpf) const { |
252 if (xpf) { | 252 if (xpf) { |
253 *xpf = GrArithmeticXPFactory::Create(SkScalarToFloat(fK[0]), | 253 *xpf = GrArithmeticXPFactory::Create(SkScalarToFloat(fK[0]), |
254 SkScalarToFloat(fK[1]), | 254 SkScalarToFloat(fK[1]), |
255 SkScalarToFloat(fK[2]), | 255 SkScalarToFloat(fK[2]), |
256 SkScalarToFloat(fK[3]), | 256 SkScalarToFloat(fK[3]), |
257 fEnforcePMColor); | 257 fEnforcePMColor); |
258 } | 258 } |
259 return true; | 259 return true; |
260 } | 260 } |
261 | 261 |
262 #endif | 262 #endif |
263 | 263 |
264 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) | 264 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) |
265 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) | 265 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) |
266 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 266 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |