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 11 matching lines...) Expand all Loading... |
22 | 22 |
23 class SkArithmeticMode_scalar : public SkXfermode { | 23 class SkArithmeticMode_scalar : public SkXfermode { |
24 public: | 24 public: |
25 static SkArithmeticMode_scalar* Create(SkScalar k1, SkScalar k2, SkScalar k3
, SkScalar k4) { | 25 static SkArithmeticMode_scalar* Create(SkScalar k1, SkScalar k2, SkScalar k3
, SkScalar k4) { |
26 return SkNEW_ARGS(SkArithmeticMode_scalar, (k1, k2, k3, k4)); | 26 return SkNEW_ARGS(SkArithmeticMode_scalar, (k1, k2, k3, k4)); |
27 } | 27 } |
28 | 28 |
29 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, | 29 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, |
30 const SkAlpha aa[]) const SK_OVERRIDE; | 30 const SkAlpha aa[]) const SK_OVERRIDE; |
31 | 31 |
32 SK_DEVELOPER_TO_STRING() | 32 SK_TO_STRING_OVERRIDE() |
33 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArithmeticMode_scalar) | 33 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArithmeticMode_scalar) |
34 | 34 |
35 #if SK_SUPPORT_GPU | 35 #if SK_SUPPORT_GPU |
36 virtual bool asNewEffect(GrEffectRef** effect, GrTexture* background) const
SK_OVERRIDE; | 36 virtual bool asNewEffect(GrEffectRef** effect, GrTexture* background) const
SK_OVERRIDE; |
37 #endif | 37 #endif |
38 | 38 |
39 private: | 39 private: |
40 SkArithmeticMode_scalar(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4)
{ | 40 SkArithmeticMode_scalar(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4)
{ |
41 fK[0] = k1; | 41 fK[0] = k1; |
42 fK[1] = k2; | 42 fK[1] = k2; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 int scale = a + (a >> 7); | 166 int scale = a + (a >> 7); |
167 r = SkAlphaMul(r, scale); | 167 r = SkAlphaMul(r, scale); |
168 g = SkAlphaMul(g, scale); | 168 g = SkAlphaMul(g, scale); |
169 b = SkAlphaMul(b, scale); | 169 b = SkAlphaMul(b, scale); |
170 } | 170 } |
171 dst[i] = SkPackARGB32(a, r, g, b); | 171 dst[i] = SkPackARGB32(a, r, g, b); |
172 } | 172 } |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 #ifdef SK_DEVELOPER | 176 #ifndef SK_IGNORE_TO_STRING |
177 void SkArithmeticMode_scalar::toString(SkString* str) const { | 177 void SkArithmeticMode_scalar::toString(SkString* str) const { |
178 str->append("SkArithmeticMode_scalar: "); | 178 str->append("SkArithmeticMode_scalar: "); |
179 for (int i = 0; i < 4; ++i) { | 179 for (int i = 0; i < 4; ++i) { |
180 str->appendScalar(fK[i]); | 180 str->appendScalar(fK[i]); |
181 if (i < 3) { | 181 if (i < 3) { |
182 str->append(" "); | 182 str->append(" "); |
183 } | 183 } |
184 } | 184 } |
185 } | 185 } |
186 #endif | 186 #endif |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 background); | 408 background); |
409 } | 409 } |
410 return true; | 410 return true; |
411 } | 411 } |
412 | 412 |
413 #endif | 413 #endif |
414 | 414 |
415 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) | 415 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) |
416 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) | 416 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) |
417 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 417 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |