| 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 23 matching lines...) Expand all Loading... |
| 34 CoordsType = kLocal_CoordsType); | 34 CoordsType = kLocal_CoordsType); |
| 35 GrSingleTextureEffect(GrTexture*, | 35 GrSingleTextureEffect(GrTexture*, |
| 36 const SkMatrix&, | 36 const SkMatrix&, |
| 37 const GrTextureParams&, | 37 const GrTextureParams&, |
| 38 CoordsType = kLocal_CoordsType); | 38 CoordsType = kLocal_CoordsType); |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * Helper for subclass onIsEqual() functions. | 41 * Helper for subclass onIsEqual() functions. |
| 42 */ | 42 */ |
| 43 bool hasSameTextureParamsMatrixAndCoordsType(const GrSingleTextureEffect& ot
her) const { | 43 bool hasSameTextureParamsMatrixAndCoordsType(const GrSingleTextureEffect& ot
her) const { |
| 44 const GrTextureAccess& otherAccess = other.fTextureAccess; | |
| 45 // We don't have to check the accesses' swizzles because they are inferr
ed from the texture. | 44 // We don't have to check the accesses' swizzles because they are inferr
ed from the texture. |
| 46 return fTextureAccess.getTexture() == otherAccess.getTexture() && | 45 return fTextureAccess == other.fTextureAccess && |
| 47 fTextureAccess.getParams() == otherAccess.getParams() && | |
| 48 this->getMatrix().cheapEqualTo(other.getMatrix()) && | 46 this->getMatrix().cheapEqualTo(other.getMatrix()) && |
| 49 fCoordsType == other.fCoordsType; | 47 fCoordsType == other.fCoordsType; |
| 50 } | 48 } |
| 51 | 49 |
| 52 /** | 50 /** |
| 53 * Can be used as a helper to implement subclass getConstantColorComponents(
). It assumes that | 51 * Can be used as a helper to implement subclass getConstantColorComponents(
). It assumes that |
| 54 * the subclass output color will be a modulation of the input color with a
value read from the | 52 * the subclass output color will be a modulation of the input color with a
value read from the |
| 55 * texture. | 53 * texture. |
| 56 */ | 54 */ |
| 57 void updateConstantColorComponentsForModulation(GrColor* color, uint32_t* va
lidFlags) const { | 55 void updateConstantColorComponentsForModulation(GrColor* color, uint32_t* va
lidFlags) const { |
| 58 if ((*validFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(*c
olor) && | 56 if ((*validFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(*c
olor) && |
| 59 GrPixelConfigIsOpaque(this->texture(0)->config())) { | 57 GrPixelConfigIsOpaque(this->texture(0)->config())) { |
| 60 *validFlags = kA_GrColorComponentFlag; | 58 *validFlags = kA_GrColorComponentFlag; |
| 61 } else { | 59 } else { |
| 62 *validFlags = 0; | 60 *validFlags = 0; |
| 63 } | 61 } |
| 64 } | 62 } |
| 65 | 63 |
| 66 private: | 64 private: |
| 67 GrTextureAccess fTextureAccess; | 65 GrTextureAccess fTextureAccess; |
| 68 SkMatrix fMatrix; | 66 SkMatrix fMatrix; |
| 69 CoordsType fCoordsType; | 67 CoordsType fCoordsType; |
| 70 | 68 |
| 71 typedef GrEffect INHERITED; | 69 typedef GrEffect INHERITED; |
| 72 }; | 70 }; |
| 73 | 71 |
| 74 #endif | 72 #endif |
| OLD | NEW |