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 getConstantColorComponents(
). It assumes that | 47 * Can be used as a helper to implement subclass onComputeInvariantOutput().
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 updateConstantColorComponentsForModulation(GrColor* color, uint32_t* va
lidFlags) const { | 51 void updateInvariantOutputForModulation(InvariantOutput* inout) const { |
52 if ((*validFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(*c
olor) && | 52 if (inout->isOpaque() && GrPixelConfigIsOpaque(this->texture(0)->config(
))) { |
53 GrPixelConfigIsOpaque(this->texture(0)->config())) { | 53 inout->fValidFlags = kA_GrColorComponentFlag; |
54 *validFlags = kA_GrColorComponentFlag; | |
55 } else { | 54 } else { |
56 *validFlags = 0; | 55 inout->fValidFlags = 0; |
57 } | 56 } |
58 } | 57 } |
59 | 58 |
60 private: | 59 private: |
61 GrCoordTransform fCoordTransform; | 60 GrCoordTransform fCoordTransform; |
62 GrTextureAccess fTextureAccess; | 61 GrTextureAccess fTextureAccess; |
63 | 62 |
64 typedef GrFragmentProcessor INHERITED; | 63 typedef GrFragmentProcessor INHERITED; |
65 }; | 64 }; |
66 | 65 |
67 #endif | 66 #endif |
OLD | NEW |