michael@0: /* michael@0: * Copyright 2013 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef GrCustomCoordsTextureEffect_DEFINED michael@0: #define GrCustomCoordsTextureEffect_DEFINED michael@0: michael@0: #include "GrEffect.h" michael@0: #include "GrVertexEffect.h" michael@0: michael@0: class GrGLCustomCoordsTextureEffect; michael@0: michael@0: /** michael@0: * The output color of this effect is a modulation of the input color and a sample from a texture. michael@0: * It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input michael@0: * coords are a custom attribute. michael@0: */ michael@0: class GrCustomCoordsTextureEffect : public GrVertexEffect { michael@0: public: michael@0: static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& p) { michael@0: AutoEffectUnref effect(SkNEW_ARGS(GrCustomCoordsTextureEffect, (tex, p))); michael@0: return CreateEffectRef(effect); michael@0: } michael@0: michael@0: virtual ~GrCustomCoordsTextureEffect() {} michael@0: michael@0: static const char* Name() { return "Texture"; } michael@0: michael@0: virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; michael@0: michael@0: typedef GrGLCustomCoordsTextureEffect GLEffect; michael@0: michael@0: virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; michael@0: michael@0: private: michael@0: GrCustomCoordsTextureEffect(GrTexture* texture, const GrTextureParams& params); michael@0: michael@0: virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE; michael@0: michael@0: GrTextureAccess fTextureAccess; michael@0: michael@0: GR_DECLARE_EFFECT_TEST; michael@0: michael@0: typedef GrVertexEffect INHERITED; michael@0: }; michael@0: michael@0: #endif