OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #ifndef GrSingleTextureEffect_DEFINED | 8 #ifndef GrSingleTextureEffect_DEFINED |
9 #define GrSingleTextureEffect_DEFINED | 9 #define GrSingleTextureEffect_DEFINED |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 const SkMatrix&, | 33 const SkMatrix&, |
34 const GrTextureParams&, | 34 const GrTextureParams&, |
35 GrCoordSet = kLocal_GrCoordSet); | 35 GrCoordSet = kLocal_GrCoordSet); |
36 | 36 |
37 /** | 37 /** |
38 * Can be used as a helper to implement subclass onComputeInvariantOutput().
It assumes that | 38 * Can be used as a helper to implement subclass onComputeInvariantOutput().
It assumes that |
39 * the subclass output color will be a modulation of the input color with a
value read from the | 39 * the subclass output color will be a modulation of the input color with a
value read from the |
40 * texture. | 40 * texture. |
41 */ | 41 */ |
42 void updateInvariantOutputForModulation(GrInvariantOutput* inout) const { | 42 void updateInvariantOutputForModulation(GrInvariantOutput* inout) const { |
43 if (GrPixelConfigIsOpaque(this->texture(0)->config())) { | 43 if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) { |
| 44 inout->mulByUnknownAlpha(); |
| 45 } else if (GrPixelConfigIsOpaque(this->texture(0)->config())) { |
44 inout->mulByUnknownOpaqueColor(); | 46 inout->mulByUnknownOpaqueColor(); |
45 } else { | 47 } else { |
46 inout->mulByUnknownColor(); | 48 inout->mulByUnknownColor(); |
47 } | 49 } |
48 } | 50 } |
49 | 51 |
50 private: | 52 private: |
51 GrCoordTransform fCoordTransform; | 53 GrCoordTransform fCoordTransform; |
52 GrTextureAccess fTextureAccess; | 54 GrTextureAccess fTextureAccess; |
53 | 55 |
54 typedef GrFragmentProcessor INHERITED; | 56 typedef GrFragmentProcessor INHERITED; |
55 }; | 57 }; |
56 | 58 |
57 #endif | 59 #endif |
OLD | NEW |