| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 GrSimpleTextureEffect_DEFINED | 8 #ifndef GrSimpleTextureEffect_DEFINED |
| 9 #define GrSimpleTextureEffect_DEFINED | 9 #define GrSimpleTextureEffect_DEFINED |
| 10 | 10 |
| 11 #include "GrSingleTextureEffect.h" | 11 #include "GrSingleTextureEffect.h" |
| 12 | 12 |
| 13 class GrGLSimpleTextureEffect; | |
| 14 class GrInvariantOutput; | 13 class GrInvariantOutput; |
| 15 | 14 |
| 16 /** | 15 /** |
| 17 * The output color of this effect is a modulation of the input color and a samp
le from a texture. | 16 * The output color of this effect is a modulation of the input color and a samp
le from a texture. |
| 18 * It allows explicit specification of the filtering and wrap modes (GrTexturePa
rams). It can use | 17 * It allows explicit specification of the filtering and wrap modes (GrTexturePa
rams). It can use |
| 19 * local coords, positions, or a custom vertex attribute as input texture coords
. The input coords | 18 * local coords, positions, or a custom vertex attribute as input texture coords
. The input coords |
| 20 * can have a matrix applied in the VS in both the local and position cases but
not with a custom | 19 * can have a matrix applied in the VS in both the local and position cases but
not with a custom |
| 21 * attribute coords at this time. It will add a varying to input interpolate tex
ture coords to the | 20 * attribute coords at this time. It will add a varying to input interpolate tex
ture coords to the |
| 22 * FS. | 21 * FS. |
| 23 */ | 22 */ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 41 | 40 |
| 42 static GrFragmentProcessor* Create(GrTexture* tex, | 41 static GrFragmentProcessor* Create(GrTexture* tex, |
| 43 const SkMatrix& matrix, | 42 const SkMatrix& matrix, |
| 44 const GrTextureParams& p, | 43 const GrTextureParams& p, |
| 45 GrCoordSet coordSet = kLocal_GrCoordSet)
{ | 44 GrCoordSet coordSet = kLocal_GrCoordSet)
{ |
| 46 return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, p, coordSet)); | 45 return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, p, coordSet)); |
| 47 } | 46 } |
| 48 | 47 |
| 49 virtual ~GrSimpleTextureEffect() {} | 48 virtual ~GrSimpleTextureEffect() {} |
| 50 | 49 |
| 51 static const char* Name() { return "Texture"; } | 50 virtual const char* name() const SK_OVERRIDE { return "SimpleTexture"; } |
| 52 | 51 |
| 53 typedef GrGLSimpleTextureEffect GLProcessor; | 52 virtual void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) cons
t SK_OVERRIDE; |
| 54 | 53 |
| 55 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; | 54 virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; |
| 55 |
| 56 virtual uint32_t classID() const { |
| 57 static uint32_t id = GenClassID(); |
| 58 return id; |
| 59 } |
| 56 | 60 |
| 57 private: | 61 private: |
| 58 GrSimpleTextureEffect(GrTexture* texture, | 62 GrSimpleTextureEffect(GrTexture* texture, |
| 59 const SkMatrix& matrix, | 63 const SkMatrix& matrix, |
| 60 GrTextureParams::FilterMode filterMode, | 64 GrTextureParams::FilterMode filterMode, |
| 61 GrCoordSet coordSet) | 65 GrCoordSet coordSet) |
| 62 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet) { | 66 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet) { |
| 63 } | 67 } |
| 64 | 68 |
| 65 GrSimpleTextureEffect(GrTexture* texture, | 69 GrSimpleTextureEffect(GrTexture* texture, |
| 66 const SkMatrix& matrix, | 70 const SkMatrix& matrix, |
| 67 const GrTextureParams& params, | 71 const GrTextureParams& params, |
| 68 GrCoordSet coordSet) | 72 GrCoordSet coordSet) |
| 69 : GrSingleTextureEffect(texture, matrix, params, coordSet) { | 73 : GrSingleTextureEffect(texture, matrix, params, coordSet) { |
| 70 } | 74 } |
| 71 | 75 |
| 72 virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE {
return true; } | 76 virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE {
return true; } |
| 73 | 77 |
| 74 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE; | 78 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE; |
| 75 | 79 |
| 76 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 80 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
| 77 | 81 |
| 78 typedef GrSingleTextureEffect INHERITED; | 82 typedef GrSingleTextureEffect INHERITED; |
| 79 }; | 83 }; |
| 80 | 84 |
| 81 #endif | 85 #endif |
| OLD | NEW |