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; |
56 | 55 |
57 private: | 56 private: |
58 GrSimpleTextureEffect(GrTexture* texture, | 57 GrSimpleTextureEffect(GrTexture* texture, |
59 const SkMatrix& matrix, | 58 const SkMatrix& matrix, |
60 GrTextureParams::FilterMode filterMode, | 59 GrTextureParams::FilterMode filterMode, |
61 GrCoordSet coordSet) | 60 GrCoordSet coordSet) |
62 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet) { | 61 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet) { |
| 62 this->initClassID<GrSimpleTextureEffect>(); |
63 } | 63 } |
64 | 64 |
65 GrSimpleTextureEffect(GrTexture* texture, | 65 GrSimpleTextureEffect(GrTexture* texture, |
66 const SkMatrix& matrix, | 66 const SkMatrix& matrix, |
67 const GrTextureParams& params, | 67 const GrTextureParams& params, |
68 GrCoordSet coordSet) | 68 GrCoordSet coordSet) |
69 : GrSingleTextureEffect(texture, matrix, params, coordSet) { | 69 : GrSingleTextureEffect(texture, matrix, params, coordSet) { |
| 70 this->initClassID<GrSimpleTextureEffect>(); |
70 } | 71 } |
71 | 72 |
72 virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE {
return true; } | 73 virtual bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE {
return true; } |
73 | 74 |
74 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE; | 75 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE; |
75 | 76 |
76 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 77 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
77 | 78 |
78 typedef GrSingleTextureEffect INHERITED; | 79 typedef GrSingleTextureEffect INHERITED; |
79 }; | 80 }; |
80 | 81 |
81 #endif | 82 #endif |
OLD | NEW |