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 SkNEW_ARGS(SkArithmeticMode_scalar, (k1, k2, k3, k4, enforcePMCol
or)); | 24 return SkNEW_ARGS(SkArithmeticMode_scalar, (k1, k2, k3, k4, enforcePMCol
or)); |
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**, GrTexture* background) const
override; | 34 bool asFragmentProcessor(GrFragmentProcessor**, GrShaderDataManager*, |
| 35 GrTexture* background) const override; |
35 | 36 |
36 bool asXPFactory(GrXPFactory**) const override; | 37 bool asXPFactory(GrXPFactory**) const override; |
37 #endif | 38 #endif |
38 | 39 |
39 private: | 40 private: |
40 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) { |
41 fK[0] = k1; | 42 fK[0] = k1; |
42 fK[1] = k2; | 43 fK[1] = k2; |
43 fK[2] = k3; | 44 fK[2] = k3; |
44 fK[3] = k4; | 45 fK[3] = k4; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 #endif | 229 #endif |
229 } | 230 } |
230 return SkArithmeticMode_scalar::Create(k1, k2, k3, k4, enforcePMColor); | 231 return SkArithmeticMode_scalar::Create(k1, k2, k3, k4, enforcePMColor); |
231 } | 232 } |
232 | 233 |
233 | 234 |
234 ////////////////////////////////////////////////////////////////////////////// | 235 ////////////////////////////////////////////////////////////////////////////// |
235 | 236 |
236 #if SK_SUPPORT_GPU | 237 #if SK_SUPPORT_GPU |
237 bool SkArithmeticMode_scalar::asFragmentProcessor(GrFragmentProcessor** fp, | 238 bool SkArithmeticMode_scalar::asFragmentProcessor(GrFragmentProcessor** fp, |
| 239 GrShaderDataManager* shaderDat
aManager, |
238 GrTexture* background) const { | 240 GrTexture* background) const { |
239 if (fp) { | 241 if (fp) { |
240 *fp = GrArithmeticFP::Create(SkScalarToFloat(fK[0]), | 242 *fp = GrArithmeticFP::Create(shaderDataManager, |
| 243 SkScalarToFloat(fK[0]), |
241 SkScalarToFloat(fK[1]), | 244 SkScalarToFloat(fK[1]), |
242 SkScalarToFloat(fK[2]), | 245 SkScalarToFloat(fK[2]), |
243 SkScalarToFloat(fK[3]), | 246 SkScalarToFloat(fK[3]), |
244 fEnforcePMColor, | 247 fEnforcePMColor, |
245 background); | 248 background); |
246 } | 249 } |
247 return true; | 250 return true; |
248 } | 251 } |
249 | 252 |
250 bool SkArithmeticMode_scalar::asXPFactory(GrXPFactory** xpf) const { | 253 bool SkArithmeticMode_scalar::asXPFactory(GrXPFactory** xpf) const { |
251 if (xpf) { | 254 if (xpf) { |
252 *xpf = GrArithmeticXPFactory::Create(SkScalarToFloat(fK[0]), | 255 *xpf = GrArithmeticXPFactory::Create(SkScalarToFloat(fK[0]), |
253 SkScalarToFloat(fK[1]), | 256 SkScalarToFloat(fK[1]), |
254 SkScalarToFloat(fK[2]), | 257 SkScalarToFloat(fK[2]), |
255 SkScalarToFloat(fK[3]), | 258 SkScalarToFloat(fK[3]), |
256 fEnforcePMColor); | 259 fEnforcePMColor); |
257 } | 260 } |
258 return true; | 261 return true; |
259 } | 262 } |
260 | 263 |
261 #endif | 264 #endif |
262 | 265 |
263 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) | 266 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) |
264 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) | 267 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) |
265 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 268 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |