2 * Copyright 2013 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef GrCustomCoordsTextureEffect_DEFINED
9 #define GrCustomCoordsTextureEffect_DEFINED
11 #include "GrProcessor.h"
12 #include "GrGeometryProcessor.h"
14 class GrGLCustomCoordsTextureEffect;
17 * The output color of this effect is a modulation of the input color and a sample from a texture.
18 * It allows explicit specification of the filtering and wrap modes (GrTextureParams). The input
19 * coords are a custom attribute.
21 class GrCustomCoordsTextureEffect : public GrGeometryProcessor {
23 static GrGeometryProcessor* Create(GrTexture* tex, const GrTextureParams& p) {
24 return SkNEW_ARGS(GrCustomCoordsTextureEffect, (tex, p));
27 virtual ~GrCustomCoordsTextureEffect() {}
29 static const char* Name() { return "Texture"; }
31 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
33 const GrShaderVar& inTextureCoords() const { return fInTextureCoords; }
35 typedef GrGLCustomCoordsTextureEffect GLProcessor;
37 virtual const GrBackendGeometryProcessorFactory& getFactory() const SK_OVERRIDE;
40 GrCustomCoordsTextureEffect(GrTexture* texture, const GrTextureParams& params);
42 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE;
44 GrTextureAccess fTextureAccess;
45 const GrShaderVar& fInTextureCoords;
47 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
49 typedef GrGeometryProcessor INHERITED;