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 GrCustomCoordsTextureEffect_DEFINED | 8 #ifndef GrCustomCoordsTextureEffect_DEFINED |
9 #define GrCustomCoordsTextureEffect_DEFINED | 9 #define GrCustomCoordsTextureEffect_DEFINED |
10 | 10 |
11 #include "GrProcessor.h" | 11 #include "GrProcessor.h" |
12 #include "GrGeometryProcessor.h" | 12 #include "GrGeometryProcessor.h" |
13 | 13 |
14 class GrGLCustomCoordsTextureEffect; | 14 class GrGLCustomCoordsTextureEffect; |
| 15 class GrInvariantOutput; |
15 | 16 |
16 /** | 17 /** |
17 * The output color of this effect is a modulation of the input color and a samp
le from a texture. | 18 * 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). The input | 19 * It allows explicit specification of the filtering and wrap modes (GrTexturePa
rams). The input |
19 * coords are a custom attribute. | 20 * coords are a custom attribute. |
20 */ | 21 */ |
21 class GrCustomCoordsTextureEffect : public GrGeometryProcessor { | 22 class GrCustomCoordsTextureEffect : public GrGeometryProcessor { |
22 public: | 23 public: |
23 static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& p)
{ | 24 static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& p)
{ |
24 return SkNEW_ARGS(GrCustomCoordsTextureEffect, (tex, p)); | 25 return SkNEW_ARGS(GrCustomCoordsTextureEffect, (tex, p)); |
25 } | 26 } |
26 | 27 |
27 virtual ~GrCustomCoordsTextureEffect() {} | 28 virtual ~GrCustomCoordsTextureEffect() {} |
28 | 29 |
29 static const char* Name() { return "Texture"; } | 30 static const char* Name() { return "Texture"; } |
30 | 31 |
31 const GrShaderVar& inTextureCoords() const { return fInTextureCoords; } | 32 const GrShaderVar& inTextureCoords() const { return fInTextureCoords; } |
32 | 33 |
33 typedef GrGLCustomCoordsTextureEffect GLProcessor; | 34 typedef GrGLCustomCoordsTextureEffect GLProcessor; |
34 | 35 |
35 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; | 36 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERR
IDE; |
36 | 37 |
37 private: | 38 private: |
38 GrCustomCoordsTextureEffect(GrTexture* texture, const GrTextureParams& param
s); | 39 GrCustomCoordsTextureEffect(GrTexture* texture, const GrTextureParams& param
s); |
39 | 40 |
40 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; | 41 virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE; |
41 | 42 |
42 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; | 43 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE; |
43 | 44 |
44 GrTextureAccess fTextureAccess; | 45 GrTextureAccess fTextureAccess; |
45 const GrShaderVar& fInTextureCoords; | 46 const GrShaderVar& fInTextureCoords; |
46 | 47 |
47 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 48 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
48 | 49 |
49 typedef GrGeometryProcessor INHERITED; | 50 typedef GrGeometryProcessor INHERITED; |
50 }; | 51 }; |
51 | 52 |
52 #endif | 53 #endif |
OLD | NEW |