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 26 matching lines...) Expand all Loading... |
37 * Helper for subclass onIsEqual() functions. | 37 * Helper for subclass onIsEqual() functions. |
38 */ | 38 */ |
39 bool hasSameTextureParamsMatrixAndSourceCoords(const GrSingleTextureEffect&
other) const { | 39 bool hasSameTextureParamsMatrixAndSourceCoords(const GrSingleTextureEffect&
other) const { |
40 // We don't have to check the accesses' swizzles because they are inferr
ed from the texture. | 40 // We don't have to check the accesses' swizzles because they are inferr
ed from the texture. |
41 return fTextureAccess == other.fTextureAccess && | 41 return fTextureAccess == other.fTextureAccess && |
42 fCoordTransform.getMatrix().cheapEqualTo(other.fCoordTransform.ge
tMatrix()) && | 42 fCoordTransform.getMatrix().cheapEqualTo(other.fCoordTransform.ge
tMatrix()) && |
43 fCoordTransform.sourceCoords() == other.fCoordTransform.sourceCoo
rds(); | 43 fCoordTransform.sourceCoords() == other.fCoordTransform.sourceCoo
rds(); |
44 } | 44 } |
45 | 45 |
46 /** | 46 /** |
47 * Can be used as a helper to implement subclass onComputeInvariantOutput().
It assumes that | 47 * Can be used as a helper to implement subclass getConstantColorComponents(
). It assumes that |
48 * the subclass output color will be a modulation of the input color with a
value read from the | 48 * the subclass output color will be a modulation of the input color with a
value read from the |
49 * texture. | 49 * texture. |
50 */ | 50 */ |
51 void updateInvariantOutputForModulation(InvariantOutput* inout) const { | 51 void updateConstantColorComponentsForModulation(GrColor* color, uint32_t* va
lidFlags) const { |
52 if (inout->isOpaque() && GrPixelConfigIsOpaque(this->texture(0)->config(
))) { | 52 if ((*validFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(*c
olor) && |
53 inout->fValidFlags = kA_GrColorComponentFlag; | 53 GrPixelConfigIsOpaque(this->texture(0)->config())) { |
| 54 *validFlags = kA_GrColorComponentFlag; |
54 } else { | 55 } else { |
55 inout->fValidFlags = 0; | 56 *validFlags = 0; |
56 } | 57 } |
57 } | 58 } |
58 | 59 |
59 private: | 60 private: |
60 GrCoordTransform fCoordTransform; | 61 GrCoordTransform fCoordTransform; |
61 GrTextureAccess fTextureAccess; | 62 GrTextureAccess fTextureAccess; |
62 | 63 |
63 typedef GrFragmentProcessor INHERITED; | 64 typedef GrFragmentProcessor INHERITED; |
64 }; | 65 }; |
65 | 66 |
66 #endif | 67 #endif |
OLD | NEW |