| 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 |
| 11 #include "GrFragmentProcessor.h" | 11 #include "GrFragmentProcessor.h" |
| 12 #include "GrCoordTransform.h" |
| 13 #include "GrInvariantOutput.h" |
| 12 #include "SkMatrix.h" | 14 #include "SkMatrix.h" |
| 13 #include "GrCoordTransform.h" | |
| 14 | 15 |
| 15 class GrTexture; | 16 class GrTexture; |
| 16 | 17 |
| 17 /** | 18 /** |
| 18 * A base class for effects that draw a single texture with a texture matrix. Th
is effect has no | 19 * A base class for effects that draw a single texture with a texture matrix. Th
is effect has no |
| 19 * backend implementations. One must be provided by the subclass. | 20 * backend implementations. One must be provided by the subclass. |
| 20 */ | 21 */ |
| 21 class GrSingleTextureEffect : public GrFragmentProcessor { | 22 class GrSingleTextureEffect : public GrFragmentProcessor { |
| 22 public: | 23 public: |
| 23 virtual ~GrSingleTextureEffect(); | 24 virtual ~GrSingleTextureEffect(); |
| 24 | 25 |
| 25 protected: | 26 protected: |
| 26 /** unfiltered, clamp mode */ | 27 /** unfiltered, clamp mode */ |
| 27 GrSingleTextureEffect(GrTexture*, const SkMatrix&, GrCoordSet = kLocal_GrCoo
rdSet); | 28 GrSingleTextureEffect(GrTexture*, const SkMatrix&, GrCoordSet = kLocal_GrCoo
rdSet); |
| 28 /** clamp mode */ | 29 /** clamp mode */ |
| 29 GrSingleTextureEffect(GrTexture*, const SkMatrix&, GrTextureParams::FilterMo
de filterMode, | 30 GrSingleTextureEffect(GrTexture*, const SkMatrix&, GrTextureParams::FilterMo
de filterMode, |
| 30 GrCoordSet = kLocal_GrCoordSet); | 31 GrCoordSet = kLocal_GrCoordSet); |
| 31 GrSingleTextureEffect(GrTexture*, | 32 GrSingleTextureEffect(GrTexture*, |
| 32 const SkMatrix&, | 33 const SkMatrix&, |
| 33 const GrTextureParams&, | 34 const GrTextureParams&, |
| 34 GrCoordSet = kLocal_GrCoordSet); | 35 GrCoordSet = kLocal_GrCoordSet); |
| 35 | 36 |
| 36 /** | 37 /** |
| 37 * Can be used as a helper to implement subclass onComputeInvariantOutput().
It assumes that | 38 * Can be used as a helper to implement subclass onComputeInvariantOutput().
It assumes that |
| 38 * the subclass output color will be a modulation of the input color with a
value read from the | 39 * the subclass output color will be a modulation of the input color with a
value read from the |
| 39 * texture. | 40 * texture. |
| 40 */ | 41 */ |
| 41 void updateInvariantOutputForModulation(InvariantOutput* inout) const { | 42 void updateInvariantOutputForModulation(GrInvariantOutput* inout) const { |
| 42 if (GrPixelConfigIsOpaque(this->texture(0)->config())) { | 43 if (GrPixelConfigIsOpaque(this->texture(0)->config())) { |
| 43 inout->mulByUnknownOpaqueColor(); | 44 inout->mulByUnknownOpaqueColor(); |
| 44 } else { | 45 } else { |
| 45 inout->mulByUnknownColor(); | 46 inout->mulByUnknownColor(); |
| 46 } | 47 } |
| 47 } | 48 } |
| 48 | 49 |
| 49 private: | 50 private: |
| 50 GrCoordTransform fCoordTransform; | 51 GrCoordTransform fCoordTransform; |
| 51 GrTextureAccess fTextureAccess; | 52 GrTextureAccess fTextureAccess; |
| 52 | 53 |
| 53 typedef GrFragmentProcessor INHERITED; | 54 typedef GrFragmentProcessor INHERITED; |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 #endif | 57 #endif |
| OLD | NEW |