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 GrDistanceFieldTextureEffect_DEFINED |
9 #define GrCustomCoordsTextureEffect_DEFINED | 9 #define GrDistanceFieldTextureEffect_DEFINED |
10 | 10 |
11 #include "GrEffect.h" | 11 #include "GrEffect.h" |
12 #include "GrVertexEffect.h" | 12 #include "GrVertexEffect.h" |
13 | 13 |
14 class GrGLCustomCoordsTextureEffect; | 14 class GrGLDistanceFieldTextureEffect; |
15 | 15 |
16 /** | 16 /** |
17 * The output color of this effect is a modulation of the input color and a samp
le from a texture. | 17 * The output color of this effect is a modulation of the input color and a samp
le from a |
| 18 * distance field texture (using a smoothed step function near 0.5). |
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 GrVertexEffect { | 22 class GrDistanceFieldTextureEffect : public GrVertexEffect { |
22 public: | 23 public: |
23 static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& p) { | 24 static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& p) { |
24 AutoEffectUnref effect(SkNEW_ARGS(GrCustomCoordsTextureEffect, (tex, p))
); | 25 AutoEffectUnref effect(SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, p)
)); |
25 return CreateEffectRef(effect); | 26 return CreateEffectRef(effect); |
26 } | 27 } |
27 | 28 |
28 virtual ~GrCustomCoordsTextureEffect() {} | 29 virtual ~GrDistanceFieldTextureEffect() {} |
29 | 30 |
30 static const char* Name() { return "Texture"; } | 31 static const char* Name() { return "Texture"; } |
31 | 32 |
32 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const SK_OVERRIDE; | 33 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const SK_OVERRIDE; |
33 | 34 |
34 typedef GrGLCustomCoordsTextureEffect GLEffect; | 35 typedef GrGLDistanceFieldTextureEffect GLEffect; |
35 | 36 |
36 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; | 37 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; |
37 | 38 |
38 private: | 39 private: |
39 GrCustomCoordsTextureEffect(GrTexture* texture, const GrTextureParams& param
s); | 40 GrDistanceFieldTextureEffect(GrTexture* texture, const GrTextureParams& para
ms); |
40 | 41 |
41 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE; | 42 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE; |
42 | 43 |
43 GrTextureAccess fTextureAccess; | 44 GrTextureAccess fTextureAccess; |
44 | 45 |
45 GR_DECLARE_EFFECT_TEST; | 46 GR_DECLARE_EFFECT_TEST; |
46 | 47 |
47 typedef GrVertexEffect INHERITED; | 48 typedef GrVertexEffect INHERITED; |
48 }; | 49 }; |
49 | 50 |
50 #endif | 51 #endif |
OLD | NEW |