GrSingleTextureEffect.h revision 1ce49fc91714ce8974d11246d29ebe7b97b5fe98
1/*
2 * Copyright 2012 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 GrSingleTextureEffect_DEFINED
9#define GrSingleTextureEffect_DEFINED
10
11#include "GrCustomStage.h"
12
13class GrGLSingleTextureEffect;
14
15/**
16 * An effect that merely blits a single texture; commonly used as a base class.
17 */
18class GrSingleTextureEffect : public GrCustomStage {
19
20public:
21    /** Uses default texture params (unfiltered, clamp) */
22    GrSingleTextureEffect(GrTexture* texture);
23
24    /** Uses default tile mode (clamp) */
25    GrSingleTextureEffect(GrTexture* texture, bool bilerp);
26
27    GrSingleTextureEffect(GrTexture* texture, const GrTextureParams&);
28
29    virtual ~GrSingleTextureEffect();
30
31    virtual int numTextures() const SK_OVERRIDE;
32    virtual const GrTextureAccess& textureAccess(int index) const SK_OVERRIDE;
33
34    static const char* Name() { return "Single Texture"; }
35
36    typedef GrGLSingleTextureEffect GLProgramStage;
37
38    virtual const GrProgramStageFactory& getFactory() const SK_OVERRIDE;
39
40private:
41    GR_DECLARE_CUSTOM_STAGE_TEST;
42
43    GrTextureAccess fTextureAccess;
44
45    typedef GrCustomStage INHERITED;
46};
47
48#endif
49