Chromium Code Reviews| 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 GrDistanceFieldTextureEffect_DEFINED | 8 #ifndef GrDistanceFieldTextureEffect_DEFINED |
| 9 #define GrDistanceFieldTextureEffect_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 GrGLDistanceFieldTextureEffect; | 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 | 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 * distance field texture (using a smoothed step function near 0.5). |
| 19 * 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 |
| 20 * coords are a custom attribute. | 20 * coords are a custom attribute. |
| 21 */ | 21 */ |
| 22 class GrDistanceFieldTextureEffect : public GrVertexEffect { | 22 class GrDistanceFieldTextureEffect : public GrVertexEffect { |
| 23 public: | 23 public: |
| 24 static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& p, const S kISize& s) { | 24 static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& p, const S kISize& s, |
|
bsalomon
2014/03/26 13:18:58
It seems a little weird that the public function h
jvanverth1
2014/03/26 16:24:00
I've removed it -- it's not necessary. I also adde
| |
| 25 AutoEffectUnref effect(SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, p, s))); | 25 bool u) { |
| 26 AutoEffectUnref effect(SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, p, s, u))); | |
| 26 return CreateEffectRef(effect); | 27 return CreateEffectRef(effect); |
| 27 } | 28 } |
| 28 | 29 |
| 29 virtual ~GrDistanceFieldTextureEffect() {} | 30 virtual ~GrDistanceFieldTextureEffect() {} |
| 30 | 31 |
| 31 static const char* Name() { return "DistanceFieldTexture"; } | 32 static const char* Name() { return "DistanceFieldTexture"; } |
| 32 | 33 |
| 33 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE; | 34 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE; |
| 34 const SkSize& getSize() const { return fSize; } | 35 const SkSize& getSize() const { return fSize; } |
| 36 bool isUniformScale() const { return fUniformScale; } | |
| 35 | 37 |
| 36 typedef GrGLDistanceFieldTextureEffect GLEffect; | 38 typedef GrGLDistanceFieldTextureEffect GLEffect; |
| 37 | 39 |
| 38 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; | 40 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; |
| 39 | 41 |
| 40 private: | 42 private: |
| 41 GrDistanceFieldTextureEffect(GrTexture* texture, const GrTextureParams& para ms, | 43 GrDistanceFieldTextureEffect(GrTexture* texture, const GrTextureParams& para ms, |
| 42 const SkISize& textureSize); | 44 const SkISize& textureSize, bool uniformScale); |
| 43 | 45 |
| 44 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE; | 46 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE; |
| 45 | 47 |
| 46 GrTextureAccess fTextureAccess; | 48 GrTextureAccess fTextureAccess; |
| 47 SkSize fSize; | 49 SkSize fSize; |
| 50 bool fUniformScale; | |
| 48 | 51 |
| 49 GR_DECLARE_EFFECT_TEST; | 52 GR_DECLARE_EFFECT_TEST; |
| 50 | 53 |
| 51 typedef GrVertexEffect INHERITED; | 54 typedef GrVertexEffect INHERITED; |
| 52 }; | 55 }; |
| 53 | 56 |
| 54 #endif | 57 #endif |
| OLD | NEW |