blob: 559398eca9092ecb7dce6ff07c7878627498a5d2 [file] [log] [blame]
tomhudson@google.com2f68e762012-07-17 18:43:21 +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 GrTextureDomainEffect_DEFINED
9#define GrTextureDomainEffect_DEFINED
10
11//#include "GrCustomStage.h"
12#include "GrSingleTextureEffect.h"
13#include "GrRect.h"
14
15class GrGLTextureDomainEffect;
16
17/**
18 * Limits a texture's lookup coordinates to a domain.
19 */
20class GrTextureDomainEffect : public GrSingleTextureEffect {
21
22public:
23
24 GrTextureDomainEffect(GrTexture*, GrRect domain);
25 virtual ~GrTextureDomainEffect();
26
27 static const char* Name() { return "TextureDomain"; }
28
29 typedef GrGLTextureDomainEffect GLProgramStage;
30
31 virtual const GrProgramStageFactory& getFactory() const SK_OVERRIDE;
32 virtual bool isEqual(const GrCustomStage&) const SK_OVERRIDE;
33
34 const GrRect& domain() const { return fTextureDomain; }
35
36protected:
37
38 GrRect fTextureDomain;
39
40private:
bsalomon@google.com0a7672f2012-08-03 18:12:20 +000041 GR_DECLARE_CUSTOM_STAGE_TEST;
tomhudson@google.com2f68e762012-07-17 18:43:21 +000042
43 typedef GrSingleTextureEffect INHERITED;
44};
45
46#endif