gfx/skia/trunk/src/gpu/effects/GrDistanceFieldTextureEffect.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/gpu/effects/GrDistanceFieldTextureEffect.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,54 @@
     1.4 +/*
     1.5 + * Copyright 2013 Google Inc.
     1.6 + *
     1.7 + * Use of this source code is governed by a BSD-style license that can be
     1.8 + * found in the LICENSE file.
     1.9 + */
    1.10 +
    1.11 +#ifndef GrDistanceFieldTextureEffect_DEFINED
    1.12 +#define GrDistanceFieldTextureEffect_DEFINED
    1.13 +
    1.14 +#include "GrEffect.h"
    1.15 +#include "GrVertexEffect.h"
    1.16 +
    1.17 +class GrGLDistanceFieldTextureEffect;
    1.18 +
    1.19 +/**
    1.20 + * The output color of this effect is a modulation of the input color and a sample from a
    1.21 + * distance field texture (using a smoothed step function near 0.5).
    1.22 + * It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input
    1.23 + * coords are a custom attribute.
    1.24 + */
    1.25 +class GrDistanceFieldTextureEffect : public GrVertexEffect {
    1.26 +public:
    1.27 +    static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& p, const SkISize& s) {
    1.28 +        AutoEffectUnref effect(SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, p, s)));
    1.29 +        return CreateEffectRef(effect);
    1.30 +    }
    1.31 +
    1.32 +    virtual ~GrDistanceFieldTextureEffect() {}
    1.33 +
    1.34 +    static const char* Name() { return "DistanceFieldTexture"; }
    1.35 +
    1.36 +    virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
    1.37 +    const SkSize& getSize() const { return fSize; }
    1.38 +
    1.39 +    typedef GrGLDistanceFieldTextureEffect GLEffect;
    1.40 +
    1.41 +    virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
    1.42 +
    1.43 +private:
    1.44 +    GrDistanceFieldTextureEffect(GrTexture* texture, const GrTextureParams& params,
    1.45 +                                 const SkISize& textureSize);
    1.46 +
    1.47 +    virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
    1.48 +
    1.49 +    GrTextureAccess fTextureAccess;
    1.50 +    SkSize          fSize;
    1.51 +
    1.52 +    GR_DECLARE_EFFECT_TEST;
    1.53 +
    1.54 +    typedef GrVertexEffect INHERITED;
    1.55 +};
    1.56 +
    1.57 +#endif

mercurial