tomhudson@google.com | d0c1a06 | 2012-07-12 17:23:52 +0000 | [diff] [blame] | 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 | |
bsalomon@google.com | a469c28 | 2012-10-24 18:28:34 +0000 | [diff] [blame^] | 11 | #include "GrEffect.h" |
tomhudson@google.com | d0c1a06 | 2012-07-12 17:23:52 +0000 | [diff] [blame] | 12 | |
tomhudson@google.com | aa72eab | 2012-07-19 18:01:07 +0000 | [diff] [blame] | 13 | class GrGLSingleTextureEffect; |
| 14 | |
| 15 | /** |
| 16 | * An effect that merely blits a single texture; commonly used as a base class. |
| 17 | */ |
bsalomon@google.com | a469c28 | 2012-10-24 18:28:34 +0000 | [diff] [blame^] | 18 | class GrSingleTextureEffect : public GrEffect { |
tomhudson@google.com | d0c1a06 | 2012-07-12 17:23:52 +0000 | [diff] [blame] | 19 | |
| 20 | public: |
bsalomon@google.com | 1ce49fc | 2012-09-18 14:14:49 +0000 | [diff] [blame] | 21 | /** Uses default texture params (unfiltered, clamp) */ |
tomhudson@google.com | d0c1a06 | 2012-07-12 17:23:52 +0000 | [diff] [blame] | 22 | GrSingleTextureEffect(GrTexture* texture); |
bsalomon@google.com | 1ce49fc | 2012-09-18 14:14:49 +0000 | [diff] [blame] | 23 | |
| 24 | /** Uses default tile mode (clamp) */ |
| 25 | GrSingleTextureEffect(GrTexture* texture, bool bilerp); |
| 26 | |
| 27 | GrSingleTextureEffect(GrTexture* texture, const GrTextureParams&); |
| 28 | |
tomhudson@google.com | d0c1a06 | 2012-07-12 17:23:52 +0000 | [diff] [blame] | 29 | virtual ~GrSingleTextureEffect(); |
| 30 | |
bsalomon@google.com | 6d003d1 | 2012-09-11 15:45:20 +0000 | [diff] [blame] | 31 | virtual const GrTextureAccess& textureAccess(int index) const SK_OVERRIDE; |
tomhudson@google.com | d0c1a06 | 2012-07-12 17:23:52 +0000 | [diff] [blame] | 32 | |
tomhudson@google.com | aa72eab | 2012-07-19 18:01:07 +0000 | [diff] [blame] | 33 | static const char* Name() { return "Single Texture"; } |
| 34 | |
| 35 | typedef GrGLSingleTextureEffect GLProgramStage; |
| 36 | |
| 37 | virtual const GrProgramStageFactory& getFactory() const SK_OVERRIDE; |
| 38 | |
tomhudson@google.com | d0c1a06 | 2012-07-12 17:23:52 +0000 | [diff] [blame] | 39 | private: |
bsalomon@google.com | 0a7672f | 2012-08-03 18:12:20 +0000 | [diff] [blame] | 40 | GR_DECLARE_CUSTOM_STAGE_TEST; |
| 41 | |
bsalomon@google.com | 6d003d1 | 2012-09-11 15:45:20 +0000 | [diff] [blame] | 42 | GrTextureAccess fTextureAccess; |
tomhudson@google.com | d0c1a06 | 2012-07-12 17:23:52 +0000 | [diff] [blame] | 43 | |
bsalomon@google.com | a469c28 | 2012-10-24 18:28:34 +0000 | [diff] [blame^] | 44 | typedef GrEffect INHERITED; |
tomhudson@google.com | d0c1a06 | 2012-07-12 17:23:52 +0000 | [diff] [blame] | 45 | }; |
| 46 | |
| 47 | #endif |