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 "SkFlattenableBuffers.h" | 10 #include "SkFlattenableBuffers.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 fK[3] = k4; | 29 fK[3] = k4; |
30 } | 30 } |
31 | 31 |
32 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, | 32 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, |
33 const SkAlpha aa[]) const SK_OVERRIDE; | 33 const SkAlpha aa[]) const SK_OVERRIDE; |
34 | 34 |
35 SK_DEVELOPER_TO_STRING() | 35 SK_DEVELOPER_TO_STRING() |
36 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArithmeticMode_scalar) | 36 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArithmeticMode_scalar) |
37 | 37 |
38 #if SK_SUPPORT_GPU | 38 #if SK_SUPPORT_GPU |
39 virtual bool asNewEffectOrCoeff(GrEffectRef** effect, Coeff*, Coeff*, GrText
ure* background) const SK_OVERRIDE; | 39 virtual bool asNewEffect(GrEffectRef** effect, GrTexture* background) const
SK_OVERRIDE; |
40 #endif | 40 #endif |
41 | 41 |
42 private: | 42 private: |
43 SkArithmeticMode_scalar(SkFlattenableReadBuffer& buffer) : INHERITED(buffer)
{ | 43 SkArithmeticMode_scalar(SkFlattenableReadBuffer& buffer) : INHERITED(buffer)
{ |
44 fK[0] = buffer.readScalar(); | 44 fK[0] = buffer.readScalar(); |
45 fK[1] = buffer.readScalar(); | 45 fK[1] = buffer.readScalar(); |
46 fK[2] = buffer.readScalar(); | 46 fK[2] = buffer.readScalar(); |
47 fK[3] = buffer.readScalar(); | 47 fK[3] = buffer.readScalar(); |
48 } | 48 } |
49 | 49 |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 float k2 = rand->nextF(); | 401 float k2 = rand->nextF(); |
402 float k3 = rand->nextF(); | 402 float k3 = rand->nextF(); |
403 float k4 = rand->nextF(); | 403 float k4 = rand->nextF(); |
404 | 404 |
405 static AutoEffectUnref gEffect(SkNEW_ARGS(GrArithmeticEffect, (k1, k2, k3, k
4, NULL))); | 405 static AutoEffectUnref gEffect(SkNEW_ARGS(GrArithmeticEffect, (k1, k2, k3, k
4, NULL))); |
406 return CreateEffectRef(gEffect); | 406 return CreateEffectRef(gEffect); |
407 } | 407 } |
408 | 408 |
409 GR_DEFINE_EFFECT_TEST(GrArithmeticEffect); | 409 GR_DEFINE_EFFECT_TEST(GrArithmeticEffect); |
410 | 410 |
411 bool SkArithmeticMode_scalar::asNewEffectOrCoeff(GrEffectRef** effect, | 411 bool SkArithmeticMode_scalar::asNewEffect(GrEffectRef** effect, GrTexture* backg
round) const { |
412 Coeff*, | |
413 Coeff*, | |
414 GrTexture* background) const { | |
415 if (effect) { | 412 if (effect) { |
416 *effect = GrArithmeticEffect::Create(SkScalarToFloat(fK[0]), | 413 *effect = GrArithmeticEffect::Create(SkScalarToFloat(fK[0]), |
417 SkScalarToFloat(fK[1]), | 414 SkScalarToFloat(fK[1]), |
418 SkScalarToFloat(fK[2]), | 415 SkScalarToFloat(fK[2]), |
419 SkScalarToFloat(fK[3]), | 416 SkScalarToFloat(fK[3]), |
420 background); | 417 background); |
421 } | 418 } |
422 return true; | 419 return true; |
423 } | 420 } |
424 | 421 |
425 #endif | 422 #endif |
426 | 423 |
427 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) | 424 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) |
428 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) | 425 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) |
429 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 426 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |