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.
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright 2013 Google Inc. |
michael@0 | 3 | * |
michael@0 | 4 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 5 | * found in the LICENSE file. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | #ifndef GrDistanceFieldTextureEffect_DEFINED |
michael@0 | 9 | #define GrDistanceFieldTextureEffect_DEFINED |
michael@0 | 10 | |
michael@0 | 11 | #include "GrEffect.h" |
michael@0 | 12 | #include "GrVertexEffect.h" |
michael@0 | 13 | |
michael@0 | 14 | class GrGLDistanceFieldTextureEffect; |
michael@0 | 15 | |
michael@0 | 16 | /** |
michael@0 | 17 | * The output color of this effect is a modulation of the input color and a sample from a |
michael@0 | 18 | * distance field texture (using a smoothed step function near 0.5). |
michael@0 | 19 | * It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input |
michael@0 | 20 | * coords are a custom attribute. |
michael@0 | 21 | */ |
michael@0 | 22 | class GrDistanceFieldTextureEffect : public GrVertexEffect { |
michael@0 | 23 | public: |
michael@0 | 24 | static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& p, const SkISize& s) { |
michael@0 | 25 | AutoEffectUnref effect(SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, p, s))); |
michael@0 | 26 | return CreateEffectRef(effect); |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | virtual ~GrDistanceFieldTextureEffect() {} |
michael@0 | 30 | |
michael@0 | 31 | static const char* Name() { return "DistanceFieldTexture"; } |
michael@0 | 32 | |
michael@0 | 33 | virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; |
michael@0 | 34 | const SkSize& getSize() const { return fSize; } |
michael@0 | 35 | |
michael@0 | 36 | typedef GrGLDistanceFieldTextureEffect GLEffect; |
michael@0 | 37 | |
michael@0 | 38 | virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; |
michael@0 | 39 | |
michael@0 | 40 | private: |
michael@0 | 41 | GrDistanceFieldTextureEffect(GrTexture* texture, const GrTextureParams& params, |
michael@0 | 42 | const SkISize& textureSize); |
michael@0 | 43 | |
michael@0 | 44 | virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE; |
michael@0 | 45 | |
michael@0 | 46 | GrTextureAccess fTextureAccess; |
michael@0 | 47 | SkSize fSize; |
michael@0 | 48 | |
michael@0 | 49 | GR_DECLARE_EFFECT_TEST; |
michael@0 | 50 | |
michael@0 | 51 | typedef GrVertexEffect INHERITED; |
michael@0 | 52 | }; |
michael@0 | 53 | |
michael@0 | 54 | #endif |