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 or device space coords as input texture coords. The input coords
may be transformed | 18 * local coords or device space coords as input texture coords. The input coords
may be transformed |
19 * by a matrix. | 19 * by a matrix. |
20 */ | 20 */ |
21 class GrSimpleTextureEffect : public GrSingleTextureEffect { | 21 class GrSimpleTextureEffect : public GrSingleTextureEffect { |
22 public: | 22 public: |
23 /* unfiltered, clamp mode */ | 23 /* unfiltered, clamp mode */ |
24 static const GrFragmentProcessor* Create(GrTexture* tex, | 24 static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, |
25 const SkMatrix& matrix, | 25 const SkMatrix& matrix, |
26 GrCoordSet coordSet = kLocal_GrCoor
dSet) { | 26 GrCoordSet coordSet = kLocal_GrCoordS
et) { |
27 return new GrSimpleTextureEffect(tex, matrix, GrTextureParams::kNone_Fil
terMode, coordSet); | 27 return sk_sp<GrFragmentProcessor>( |
| 28 new GrSimpleTextureEffect(tex, matrix, GrTextureParams::kNone_Filter
Mode, coordSet)); |
28 } | 29 } |
29 | 30 |
30 /* clamp mode */ | 31 /* clamp mode */ |
31 static GrFragmentProcessor* Create(GrTexture* tex, | 32 static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, |
32 const SkMatrix& matrix, | 33 const SkMatrix& matrix, |
33 GrTextureParams::FilterMode filterMode, | 34 GrTextureParams::FilterMode filterMo
de, |
34 GrCoordSet coordSet = kLocal_GrCoordSet)
{ | 35 GrCoordSet coordSet = kLocal_GrCoord
Set) { |
35 return new GrSimpleTextureEffect(tex, matrix, filterMode, coordSet); | 36 return sk_sp<GrFragmentProcessor>( |
| 37 new GrSimpleTextureEffect(tex, matrix, filterMode, coordSet)); |
36 } | 38 } |
37 | 39 |
38 static GrFragmentProcessor* Create(GrTexture* tex, | 40 static sk_sp<GrFragmentProcessor> Make(GrTexture* tex, |
39 const SkMatrix& matrix, | 41 const SkMatrix& matrix, |
40 const GrTextureParams& p, | 42 const GrTextureParams& p, |
41 GrCoordSet coordSet = kLocal_GrCoordSet)
{ | 43 GrCoordSet coordSet = kLocal_GrCoordS
et) { |
42 return new GrSimpleTextureEffect(tex, matrix, p, coordSet); | 44 return sk_sp<GrFragmentProcessor>(new GrSimpleTextureEffect(tex, matrix,
p, coordSet)); |
43 } | 45 } |
44 | 46 |
45 virtual ~GrSimpleTextureEffect() {} | 47 virtual ~GrSimpleTextureEffect() {} |
46 | 48 |
47 const char* name() const override { return "SimpleTexture"; } | 49 const char* name() const override { return "SimpleTexture"; } |
48 | 50 |
49 private: | 51 private: |
50 GrSimpleTextureEffect(GrTexture* texture, | 52 GrSimpleTextureEffect(GrTexture* texture, |
51 const SkMatrix& matrix, | 53 const SkMatrix& matrix, |
52 GrTextureParams::FilterMode filterMode, | 54 GrTextureParams::FilterMode filterMode, |
(...skipping 17 matching lines...) Expand all Loading... |
70 bool onIsEqual(const GrFragmentProcessor& other) const override { return tru
e; } | 72 bool onIsEqual(const GrFragmentProcessor& other) const override { return tru
e; } |
71 | 73 |
72 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; | 74 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
73 | 75 |
74 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 76 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
75 | 77 |
76 typedef GrSingleTextureEffect INHERITED; | 78 typedef GrSingleTextureEffect INHERITED; |
77 }; | 79 }; |
78 | 80 |
79 #endif | 81 #endif |
OLD | NEW |