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 14 matching lines...) Expand all Loading... |
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(const GrFragmentProcessor**, | 34 bool asFragmentProcessor(const GrFragmentProcessor**, |
35 const GrFragmentProcessor* dst) const override; | 35 const GrFragmentProcessor* dst, GrRenderTarget* dst
RT) 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(const GrFragmentProcessor** fp
, | 238 bool SkArithmeticMode_scalar::asFragmentProcessor(const GrFragmentProcessor** fp
, |
239 const GrFragmentProcessor* dst
) const { | 239 const GrFragmentProcessor* dst
, GrRenderTarget* dstRT) const { |
240 if (fp) { | 240 if (fp) { |
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, dstRT); |
247 } | 247 } |
248 return true; | 248 return true; |
249 } | 249 } |
250 | 250 |
251 bool SkArithmeticMode_scalar::asXPFactory(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 |