blob: 346a6f48d8413a99c2b9bf0d12b34c1b72970906 [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
bsalomon@google.com422e81a2012-10-25 14:11:03 +000035 typedef GrGLSingleTextureEffect GLEffect;
tomhudson@google.comaa72eab2012-07-19 18:01:07 +000036
bsalomon@google.com396e61f2012-10-25 19:00:29 +000037 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
tomhudson@google.comaa72eab2012-07-19 18:01:07 +000038
tomhudson@google.comd0c1a062012-07-12 17:23:52 +000039private:
bsalomon@google.comf271cc72012-10-24 19:35:13 +000040 GR_DECLARE_EFFECT_TEST;
bsalomon@google.com0a7672f2012-08-03 18:12:20 +000041
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