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 GrGLSimpleTextureEffect; | 13 class GrGLSimpleTextureEffect; |
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 GrEffectRef* Create(GrTexture* tex, | 26 static GrEffectRef* Create(GrTexture* tex, |
27 const SkMatrix& matrix, | 27 const SkMatrix& matrix, |
28 GrCoordSet coordSet = kLocal_GrCoordSet) { | 28 GrCoordSet coordSet = kLocal_GrCoordSet) { |
robertphillips
2014/07/07 22:06:47
overlength ?
bsalomon
2014/07/08 13:54:30
Done.
| |
29 AutoEffectUnref effect(SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, G rTextureParams::kNone_FilterMode, coordSet))); | 29 return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, GrTextureParams:: kNone_FilterMode, coordSet)); |
30 return CreateEffectRef(effect); | |
31 } | 30 } |
32 | 31 |
33 /* clamp mode */ | 32 /* clamp mode */ |
34 static GrEffectRef* Create(GrTexture* tex, | 33 static GrEffectRef* Create(GrTexture* tex, |
35 const SkMatrix& matrix, | 34 const SkMatrix& matrix, |
36 GrTextureParams::FilterMode filterMode, | 35 GrTextureParams::FilterMode filterMode, |
37 GrCoordSet coordSet = kLocal_GrCoordSet) { | 36 GrCoordSet coordSet = kLocal_GrCoordSet) { |
38 AutoEffectUnref effect( | 37 return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, filterMode, coord Set)); |
39 SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, filterMode, coordSet ))); | |
40 return CreateEffectRef(effect); | |
41 } | 38 } |
42 | 39 |
43 static GrEffectRef* Create(GrTexture* tex, | 40 static GrEffectRef* Create(GrTexture* tex, |
44 const SkMatrix& matrix, | 41 const SkMatrix& matrix, |
45 const GrTextureParams& p, | 42 const GrTextureParams& p, |
46 GrCoordSet coordSet = kLocal_GrCoordSet) { | 43 GrCoordSet coordSet = kLocal_GrCoordSet) { |
47 AutoEffectUnref effect(SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, p , coordSet))); | 44 return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, p, coordSet)); |
48 return CreateEffectRef(effect); | |
49 } | 45 } |
50 | 46 |
51 virtual ~GrSimpleTextureEffect() {} | 47 virtual ~GrSimpleTextureEffect() {} |
52 | 48 |
53 static const char* Name() { return "Texture"; } | 49 static const char* Name() { return "Texture"; } |
54 | 50 |
55 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE; | 51 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE; |
56 | 52 |
57 typedef GrGLSimpleTextureEffect GLEffect; | 53 typedef GrGLSimpleTextureEffect GLEffect; |
58 | 54 |
(...skipping 18 matching lines...) Expand all Loading... | |
77 const GrSimpleTextureEffect& ste = CastEffect<GrSimpleTextureEffect>(oth er); | 73 const GrSimpleTextureEffect& ste = CastEffect<GrSimpleTextureEffect>(oth er); |
78 return this->hasSameTextureParamsMatrixAndSourceCoords(ste); | 74 return this->hasSameTextureParamsMatrixAndSourceCoords(ste); |
79 } | 75 } |
80 | 76 |
81 GR_DECLARE_EFFECT_TEST; | 77 GR_DECLARE_EFFECT_TEST; |
82 | 78 |
83 typedef GrSingleTextureEffect INHERITED; | 79 typedef GrSingleTextureEffect INHERITED; |
84 }; | 80 }; |
85 | 81 |
86 #endif | 82 #endif |
OLD | NEW |