Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
8 #ifndef GrDistanceFieldTextureEffect_DEFINED
9 #define GrDistanceFieldTextureEffect_DEFINED
11 #include "GrEffect.h"
12 #include "GrVertexEffect.h"
14 class GrGLDistanceFieldTextureEffect;
16 /**
17 * The output color of this effect is a modulation of the input color and a sample from a
18 * distance field texture (using a smoothed step function near 0.5).
19 * It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input
20 * coords are a custom attribute.
21 */
22 class GrDistanceFieldTextureEffect : public GrVertexEffect {
23 public:
24 static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& p, const SkISize& s) {
25 AutoEffectUnref effect(SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, p, s)));
26 return CreateEffectRef(effect);
27 }
29 virtual ~GrDistanceFieldTextureEffect() {}
31 static const char* Name() { return "DistanceFieldTexture"; }
33 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
34 const SkSize& getSize() const { return fSize; }
36 typedef GrGLDistanceFieldTextureEffect GLEffect;
38 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
40 private:
41 GrDistanceFieldTextureEffect(GrTexture* texture, const GrTextureParams& params,
42 const SkISize& textureSize);
44 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
46 GrTextureAccess fTextureAccess;
47 SkSize fSize;
49 GR_DECLARE_EFFECT_TEST;
51 typedef GrVertexEffect INHERITED;
52 };
54 #endif