blob: 5dc830aed18178cc6fdfbbac4e57c48b5c6483be [file] [log] [blame]
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +00001/*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef GrCustomCoordsTextureEffect_DEFINED
9#define GrCustomCoordsTextureEffect_DEFINED
10
11#include "GrEffect.h"
commit-bot@chromium.org234d4fb2013-09-30 19:55:49 +000012#include "GrVertexEffect.h"
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000013
14class GrGLCustomCoordsTextureEffect;
15
16/**
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.
20 */
commit-bot@chromium.org234d4fb2013-09-30 19:55:49 +000021class GrCustomCoordsTextureEffect : public GrVertexEffect {
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000022public:
23 static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& p) {
bsalomon55fad7a2014-07-08 07:34:20 -070024 return SkNEW_ARGS(GrCustomCoordsTextureEffect, (tex, p));
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000025 }
26
27 virtual ~GrCustomCoordsTextureEffect() {}
28
29 static const char* Name() { return "Texture"; }
30
31 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
32
33 typedef GrGLCustomCoordsTextureEffect GLEffect;
34
35 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
36
37private:
38 GrCustomCoordsTextureEffect(GrTexture* texture, const GrTextureParams& params);
39
40 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE;
41
42 GrTextureAccess fTextureAccess;
43
44 GR_DECLARE_EFFECT_TEST;
45
commit-bot@chromium.org234d4fb2013-09-30 19:55:49 +000046 typedef GrVertexEffect INHERITED;
commit-bot@chromium.org76eaf742013-09-30 18:41:38 +000047};
48
49#endif