| 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 16 matching lines...) Expand all Loading... |
| 27 GrSingleTextureEffect(GrTexture*, const SkMatrix&, GrCoordSet = kLocal_GrCoo
rdSet); | 27 GrSingleTextureEffect(GrTexture*, const SkMatrix&, GrCoordSet = kLocal_GrCoo
rdSet); |
| 28 /** clamp mode */ | 28 /** clamp mode */ |
| 29 GrSingleTextureEffect(GrTexture*, const SkMatrix&, GrTextureParams::FilterMo
de filterMode, | 29 GrSingleTextureEffect(GrTexture*, const SkMatrix&, GrTextureParams::FilterMo
de filterMode, |
| 30 GrCoordSet = kLocal_GrCoordSet); | 30 GrCoordSet = kLocal_GrCoordSet); |
| 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. | |
| 38 */ | |
| 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. | |
| 41 return fTextureAccess == other.fTextureAccess; | |
| 42 } | |
| 43 | |
| 44 /** | |
| 45 * Can be used as a helper to implement subclass onComputeInvariantOutput().
It assumes that | 37 * Can be used as a helper to implement subclass onComputeInvariantOutput().
It assumes that |
| 46 * the subclass output color will be a modulation of the input color with a
value read from the | 38 * the subclass output color will be a modulation of the input color with a
value read from the |
| 47 * texture. | 39 * texture. |
| 48 */ | 40 */ |
| 49 void updateInvariantOutputForModulation(InvariantOutput* inout) const { | 41 void updateInvariantOutputForModulation(InvariantOutput* inout) const { |
| 50 if (GrPixelConfigIsOpaque(this->texture(0)->config())) { | 42 if (GrPixelConfigIsOpaque(this->texture(0)->config())) { |
| 51 inout->mulByUnknownOpaqueColor(); | 43 inout->mulByUnknownOpaqueColor(); |
| 52 } else { | 44 } else { |
| 53 inout->mulByUnknownColor(); | 45 inout->mulByUnknownColor(); |
| 54 } | 46 } |
| 55 } | 47 } |
| 56 | 48 |
| 57 private: | 49 private: |
| 58 GrCoordTransform fCoordTransform; | 50 GrCoordTransform fCoordTransform; |
| 59 GrTextureAccess fTextureAccess; | 51 GrTextureAccess fTextureAccess; |
| 60 | 52 |
| 61 typedef GrFragmentProcessor INHERITED; | 53 typedef GrFragmentProcessor INHERITED; |
| 62 }; | 54 }; |
| 63 | 55 |
| 64 #endif | 56 #endif |
| OLD | NEW |