blob: 92ab92a275e32f22ee8bbdb73d97cf2f87172575 [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
bsalomon@google.coma469c282012-10-24 18:28:34 +000011#include "GrEffect.h"
tomhudson@google.comd0c1a062012-07-12 17:23:52 +000012
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 */
bsalomon@google.coma469c282012-10-24 18:28:34 +000018class GrSingleTextureEffect : public GrEffect {
tomhudson@google.comd0c1a062012-07-12 17:23:52 +000019
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 const GrTextureAccess& textureAccess(int index) const SK_OVERRIDE;
tomhudson@google.comd0c1a062012-07-12 17:23:52 +000032
tomhudson@google.comaa72eab2012-07-19 18:01:07 +000033 static const char* Name() { return "Single Texture"; }
34
35 typedef GrGLSingleTextureEffect GLProgramStage;
36
37 virtual const GrProgramStageFactory& getFactory() const SK_OVERRIDE;
38
tomhudson@google.comd0c1a062012-07-12 17:23:52 +000039private:
bsalomon@google.com0a7672f2012-08-03 18:12:20 +000040 GR_DECLARE_CUSTOM_STAGE_TEST;
41
bsalomon@google.com6d003d12012-09-11 15:45:20 +000042 GrTextureAccess fTextureAccess;
tomhudson@google.comd0c1a062012-07-12 17:23:52 +000043
bsalomon@google.coma469c282012-10-24 18:28:34 +000044 typedef GrEffect INHERITED;
tomhudson@google.comd0c1a062012-07-12 17:23:52 +000045};
46
47#endif