1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/gpu/effects/GrCustomCoordsTextureEffect.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,50 @@ 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 GrCustomCoordsTextureEffect_DEFINED 1.12 +#define GrCustomCoordsTextureEffect_DEFINED 1.13 + 1.14 +#include "GrEffect.h" 1.15 +#include "GrVertexEffect.h" 1.16 + 1.17 +class GrGLCustomCoordsTextureEffect; 1.18 + 1.19 +/** 1.20 + * The output color of this effect is a modulation of the input color and a sample from a texture. 1.21 + * It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input 1.22 + * coords are a custom attribute. 1.23 + */ 1.24 +class GrCustomCoordsTextureEffect : public GrVertexEffect { 1.25 +public: 1.26 + static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& p) { 1.27 + AutoEffectUnref effect(SkNEW_ARGS(GrCustomCoordsTextureEffect, (tex, p))); 1.28 + return CreateEffectRef(effect); 1.29 + } 1.30 + 1.31 + virtual ~GrCustomCoordsTextureEffect() {} 1.32 + 1.33 + static const char* Name() { return "Texture"; } 1.34 + 1.35 + virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE; 1.36 + 1.37 + typedef GrGLCustomCoordsTextureEffect GLEffect; 1.38 + 1.39 + virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; 1.40 + 1.41 +private: 1.42 + GrCustomCoordsTextureEffect(GrTexture* texture, const GrTextureParams& params); 1.43 + 1.44 + virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE; 1.45 + 1.46 + GrTextureAccess fTextureAccess; 1.47 + 1.48 + GR_DECLARE_EFFECT_TEST; 1.49 + 1.50 + typedef GrVertexEffect INHERITED; 1.51 +}; 1.52 + 1.53 +#endif