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 const GrFragmentProcessor* Create(GrTexture* tex, |
25 const SkMatrix& matrix, | 25 const SkMatrix& matrix, |
26 GrCoordSet coordSet = kLocal_GrCoor
dSet) { | 26 GrCoordSet coordSet, //= kLocal_GrC
oordSet) { |
27 return new GrSimpleTextureEffect(tex, matrix, GrTextureParams::kNone_Fil
terMode, coordSet); | 27 GrRenderTarget* dst) { |
| 28 return new GrSimpleTextureEffect(tex, matrix, |
| 29 GrTextureParams::kNone_FilterMode, coor
dSet, dst); |
28 } | 30 } |
29 | 31 |
30 /* clamp mode */ | 32 /* clamp mode */ |
31 static GrFragmentProcessor* Create(GrTexture* tex, | 33 static GrFragmentProcessor* Create(GrTexture* tex, |
32 const SkMatrix& matrix, | 34 const SkMatrix& matrix, |
33 GrTextureParams::FilterMode filterMode, | 35 GrTextureParams::FilterMode filterMode, |
34 GrCoordSet coordSet = kLocal_GrCoordSet)
{ | 36 GrCoordSet coordSet, // = kLocal_GrCoordS
et) { |
35 return new GrSimpleTextureEffect(tex, matrix, filterMode, coordSet); | 37 GrRenderTarget* dst) { |
| 38 return new GrSimpleTextureEffect(tex, matrix, filterMode, coordSet, dst)
; |
36 } | 39 } |
37 | 40 |
38 static GrFragmentProcessor* Create(GrTexture* tex, | 41 static GrFragmentProcessor* Create(GrTexture* tex, |
39 const SkMatrix& matrix, | 42 const SkMatrix& matrix, |
40 const GrTextureParams& p, | 43 const GrTextureParams& p, |
41 GrCoordSet coordSet = kLocal_GrCoordSet)
{ | 44 GrCoordSet coordSet, // = kLocal_GrCoordS
et) { |
42 return new GrSimpleTextureEffect(tex, matrix, p, coordSet); | 45 GrRenderTarget* dst) { |
| 46 return new GrSimpleTextureEffect(tex, matrix, p, coordSet, dst); |
43 } | 47 } |
44 | 48 |
45 virtual ~GrSimpleTextureEffect() {} | 49 virtual ~GrSimpleTextureEffect() {} |
46 | 50 |
47 const char* name() const override { return "SimpleTexture"; } | 51 const char* name() const override { return "SimpleTexture"; } |
48 | 52 |
49 private: | 53 private: |
50 GrSimpleTextureEffect(GrTexture* texture, | 54 GrSimpleTextureEffect(GrTexture* texture, |
51 const SkMatrix& matrix, | 55 const SkMatrix& matrix, |
52 GrTextureParams::FilterMode filterMode, | 56 GrTextureParams::FilterMode filterMode, |
53 GrCoordSet coordSet) | 57 GrCoordSet coordSet, GrRenderTarget* dst) |
54 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet) { | 58 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet, dst) { |
55 this->initClassID<GrSimpleTextureEffect>(); | 59 this->initClassID<GrSimpleTextureEffect>(); |
56 } | 60 } |
57 | 61 |
58 GrSimpleTextureEffect(GrTexture* texture, | 62 GrSimpleTextureEffect(GrTexture* texture, |
59 const SkMatrix& matrix, | 63 const SkMatrix& matrix, |
60 const GrTextureParams& params, | 64 const GrTextureParams& params, |
61 GrCoordSet coordSet) | 65 GrCoordSet coordSet, |
62 : GrSingleTextureEffect(texture, matrix, params, coordSet) { | 66 GrRenderTarget* dst) |
| 67 : GrSingleTextureEffect(texture, matrix, params, coordSet, dst) { |
63 this->initClassID<GrSimpleTextureEffect>(); | 68 this->initClassID<GrSimpleTextureEffect>(); |
64 } | 69 } |
65 | 70 |
66 GrGLFragmentProcessor* onCreateGLInstance() const override; | 71 GrGLFragmentProcessor* onCreateGLInstance() const override; |
67 | 72 |
68 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov
erride; | 73 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov
erride; |
69 | 74 |
70 bool onIsEqual(const GrFragmentProcessor& other) const override { return tru
e; } | 75 bool onIsEqual(const GrFragmentProcessor& other) const override { return tru
e; } |
71 | 76 |
72 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; | 77 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
73 | 78 |
74 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 79 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
75 | 80 |
76 typedef GrSingleTextureEffect INHERITED; | 81 typedef GrSingleTextureEffect INHERITED; |
77 }; | 82 }; |
78 | 83 |
79 #endif | 84 #endif |
OLD | NEW |