blob: 4d0a40f33538b0b79d62614a5618c79e42557a6d [file] [log] [blame]
tomhudson@google.comd0c1a062012-07-12 17:23:52 +00001/*
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
tomhudson@google.comaa72eab2012-07-19 18:01:07 +000013class GrGLSingleTextureEffect;
14
15/**
16 * An effect that merely blits a single texture; commonly used as a base class.
17 */
tomhudson@google.comd0c1a062012-07-12 17:23:52 +000018class GrSingleTextureEffect : public GrCustomStage {
19
20public:
bsalomon@google.com1ce49fc2012-09-18 14:14:49 +000021 /** Uses default texture params (unfiltered, clamp) */
tomhudson@google.comd0c1a062012-07-12 17:23:52 +000022 GrSingleTextureEffect(GrTexture* texture);
bsalomon@google.com1ce49fc2012-09-18 14:14:49 +000023
24 /** Uses default tile mode (clamp) */
25 GrSingleTextureEffect(GrTexture* texture, bool bilerp);
26
27 GrSingleTextureEffect(GrTexture* texture, const GrTextureParams&);
28
tomhudson@google.comd0c1a062012-07-12 17:23:52 +000029 virtual ~GrSingleTextureEffect();
30
bsalomon@google.com6d003d12012-09-11 15:45:20 +000031 virtual int numTextures() const SK_OVERRIDE;
32 virtual const GrTextureAccess& textureAccess(int index) const SK_OVERRIDE;
tomhudson@google.comd0c1a062012-07-12 17:23:52 +000033
tomhudson@google.comaa72eab2012-07-19 18:01:07 +000034 static const char* Name() { return "Single Texture"; }
35
36 typedef GrGLSingleTextureEffect GLProgramStage;
37
38 virtual const GrProgramStageFactory& getFactory() const SK_OVERRIDE;
39
tomhudson@google.comd0c1a062012-07-12 17:23:52 +000040private:
bsalomon@google.com0a7672f2012-08-03 18:12:20 +000041 GR_DECLARE_CUSTOM_STAGE_TEST;
42
bsalomon@google.com6d003d12012-09-11 15:45:20 +000043 GrTextureAccess fTextureAccess;
tomhudson@google.comd0c1a062012-07-12 17:23:52 +000044
45 typedef GrCustomStage INHERITED;
46};
47
48#endif