| 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 20 matching lines...) Expand all Loading... |
| 31 GrSingleTextureEffect(GrTexture*, | 31 GrSingleTextureEffect(GrTexture*, |
| 32 const SkMatrix&, | 32 const SkMatrix&, |
| 33 const GrTextureParams&, | 33 const GrTextureParams&, |
| 34 GrCoordSet = kLocal_GrCoordSet); | 34 GrCoordSet = kLocal_GrCoordSet); |
| 35 | 35 |
| 36 /** | 36 /** |
| 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()) && | |
| 43 fCoordTransform.sourceCoords() == other.fCoordTransform.sourceCoo
rds(); | |
| 44 } | 42 } |
| 45 | 43 |
| 46 /** | 44 /** |
| 47 * Can be used as a helper to implement subclass onComputeInvariantOutput().
It assumes that | 45 * 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 | 46 * the subclass output color will be a modulation of the input color with a
value read from the |
| 49 * texture. | 47 * texture. |
| 50 */ | 48 */ |
| 51 void updateInvariantOutputForModulation(InvariantOutput* inout) const { | 49 void updateInvariantOutputForModulation(InvariantOutput* inout) const { |
| 52 if (GrPixelConfigIsOpaque(this->texture(0)->config())) { | 50 if (GrPixelConfigIsOpaque(this->texture(0)->config())) { |
| 53 inout->mulByUnknownOpaqueColor(); | 51 inout->mulByUnknownOpaqueColor(); |
| 54 } else { | 52 } else { |
| 55 inout->mulByUnknownColor(); | 53 inout->mulByUnknownColor(); |
| 56 } | 54 } |
| 57 } | 55 } |
| 58 | 56 |
| 59 private: | 57 private: |
| 60 GrCoordTransform fCoordTransform; | 58 GrCoordTransform fCoordTransform; |
| 61 GrTextureAccess fTextureAccess; | 59 GrTextureAccess fTextureAccess; |
| 62 | 60 |
| 63 typedef GrFragmentProcessor INHERITED; | 61 typedef GrFragmentProcessor INHERITED; |
| 64 }; | 62 }; |
| 65 | 63 |
| 66 #endif | 64 #endif |
| OLD | NEW |