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 GrInvariantOutput; | 13 class GrInvariantOutput; |
14 | 14 |
15 /** | 15 /** |
16 * 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. |
17 * 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 |
18 * 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 |
19 * 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 |
20 * 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 |
21 * FS. | 21 * FS. |
22 */ | 22 */ |
23 class GrSimpleTextureEffect : public GrSingleTextureEffect { | 23 class GrSimpleTextureEffect : public GrSingleTextureEffect { |
24 public: | 24 public: |
25 /* unfiltered, clamp mode */ | 25 /* unfiltered, clamp mode */ |
26 static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, | 26 static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, |
27 GrTexture* tex, | 27 GrTexture* tex, |
28 const SkMatrix& matrix, | 28 const SkMatrix& matrix, |
29 GrCoordSet coordSet = kLocal_GrCoordSet)
{ | 29 GrCoordSet coordSet = kLocal_GrCoordSet)
{ |
30 return SkNEW_ARGS(GrSimpleTextureEffect, (procDataManager, tex, matrix, | 30 return new GrSimpleTextureEffect(procDataManager, tex, matrix, |
31 GrTextureParams::kNone_FilterM
ode, coordSet)); | 31 GrTextureParams::kNone_FilterMode, coor
dSet); |
32 } | 32 } |
33 | 33 |
34 /* clamp mode */ | 34 /* clamp mode */ |
35 static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, | 35 static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, |
36 GrTexture* tex, | 36 GrTexture* tex, |
37 const SkMatrix& matrix, | 37 const SkMatrix& matrix, |
38 GrTextureParams::FilterMode filterMode, | 38 GrTextureParams::FilterMode filterMode, |
39 GrCoordSet coordSet = kLocal_GrCoordSet)
{ | 39 GrCoordSet coordSet = kLocal_GrCoordSet)
{ |
40 return SkNEW_ARGS(GrSimpleTextureEffect, (procDataManager, tex, matrix,
filterMode, | 40 return new GrSimpleTextureEffect(procDataManager, tex, matrix, filterMod
e, coordSet); |
41 coordSet)); | |
42 } | 41 } |
43 | 42 |
44 static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, | 43 static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, |
45 GrTexture* tex, | 44 GrTexture* tex, |
46 const SkMatrix& matrix, | 45 const SkMatrix& matrix, |
47 const GrTextureParams& p, | 46 const GrTextureParams& p, |
48 GrCoordSet coordSet = kLocal_GrCoordSet)
{ | 47 GrCoordSet coordSet = kLocal_GrCoordSet)
{ |
49 return SkNEW_ARGS(GrSimpleTextureEffect, (procDataManager, tex, matrix,
p, coordSet)); | 48 return new GrSimpleTextureEffect(procDataManager, tex, matrix, p, coordS
et); |
50 } | 49 } |
51 | 50 |
52 virtual ~GrSimpleTextureEffect() {} | 51 virtual ~GrSimpleTextureEffect() {} |
53 | 52 |
54 const char* name() const override { return "SimpleTexture"; } | 53 const char* name() const override { return "SimpleTexture"; } |
55 | 54 |
56 private: | 55 private: |
57 GrSimpleTextureEffect(GrProcessorDataManager* procDataManager, | 56 GrSimpleTextureEffect(GrProcessorDataManager* procDataManager, |
58 GrTexture* texture, | 57 GrTexture* texture, |
59 const SkMatrix& matrix, | 58 const SkMatrix& matrix, |
(...skipping 19 matching lines...) Expand all Loading... |
79 bool onIsEqual(const GrFragmentProcessor& other) const override { return tru
e; } | 78 bool onIsEqual(const GrFragmentProcessor& other) const override { return tru
e; } |
80 | 79 |
81 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; | 80 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
82 | 81 |
83 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 82 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
84 | 83 |
85 typedef GrSingleTextureEffect INHERITED; | 84 typedef GrSingleTextureEffect INHERITED; |
86 }; | 85 }; |
87 | 86 |
88 #endif | 87 #endif |
OLD | NEW |