blob: 872d57de2dcf7344ac4f4af709e92ff5ccd8b5ce [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:
bsalomon@google.com1ce49fc2012-09-18 14:14:49 +000023 /** Uses default texture params (no filter, clamp) */
24 GrTextureDomainEffect(GrTexture*, const GrRect& domain);
tomhudson@google.com2f68e762012-07-17 18:43:21 +000025
bsalomon@google.com1ce49fc2012-09-18 14:14:49 +000026 GrTextureDomainEffect(GrTexture*, const GrRect& domain, const GrTextureParams& params);
27
tomhudson@google.com2f68e762012-07-17 18:43:21 +000028 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
39protected:
40
41 GrRect fTextureDomain;
42
43private:
bsalomon@google.com0a7672f2012-08-03 18:12:20 +000044 GR_DECLARE_CUSTOM_STAGE_TEST;
tomhudson@google.com2f68e762012-07-17 18:43:21 +000045
46 typedef GrSingleTextureEffect INHERITED;
47};
48
49#endif