tomhudson@google.com | 2f68e76 | 2012-07-17 18:43:21 +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 GrTextureDomainEffect_DEFINED |
| 9 | #define GrTextureDomainEffect_DEFINED |
| 10 | |
| 11 | //#include "GrCustomStage.h" |
| 12 | #include "GrSingleTextureEffect.h" |
| 13 | #include "GrRect.h" |
| 14 | |
| 15 | class GrGLTextureDomainEffect; |
| 16 | |
| 17 | /** |
| 18 | * Limits a texture's lookup coordinates to a domain. |
| 19 | */ |
| 20 | class GrTextureDomainEffect : public GrSingleTextureEffect { |
| 21 | |
| 22 | public: |
bsalomon@google.com | 1ce49fc | 2012-09-18 14:14:49 +0000 | [diff] [blame^] | 23 | /** Uses default texture params (no filter, clamp) */ |
| 24 | GrTextureDomainEffect(GrTexture*, const GrRect& domain); |
tomhudson@google.com | 2f68e76 | 2012-07-17 18:43:21 +0000 | [diff] [blame] | 25 | |
bsalomon@google.com | 1ce49fc | 2012-09-18 14:14:49 +0000 | [diff] [blame^] | 26 | GrTextureDomainEffect(GrTexture*, const GrRect& domain, const GrTextureParams& params); |
| 27 | |
tomhudson@google.com | 2f68e76 | 2012-07-17 18:43:21 +0000 | [diff] [blame] | 28 | virtual ~GrTextureDomainEffect(); |
| 29 | |
| 30 | static const char* Name() { return "TextureDomain"; } |
| 31 | |
| 32 | typedef GrGLTextureDomainEffect GLProgramStage; |
| 33 | |
| 34 | virtual const GrProgramStageFactory& getFactory() const SK_OVERRIDE; |
| 35 | virtual bool isEqual(const GrCustomStage&) const SK_OVERRIDE; |
| 36 | |
| 37 | const GrRect& domain() const { return fTextureDomain; } |
| 38 | |
| 39 | protected: |
| 40 | |
| 41 | GrRect fTextureDomain; |
| 42 | |
| 43 | private: |
bsalomon@google.com | 0a7672f | 2012-08-03 18:12:20 +0000 | [diff] [blame] | 44 | GR_DECLARE_CUSTOM_STAGE_TEST; |
tomhudson@google.com | 2f68e76 | 2012-07-17 18:43:21 +0000 | [diff] [blame] | 45 | |
| 46 | typedef GrSingleTextureEffect INHERITED; |
| 47 | }; |
| 48 | |
| 49 | #endif |