blob: 322f8d05cff66f9088cd90a9789615263ab43942 [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
tomhudson@google.com2f68e762012-07-17 18:43:21 +000011#include "GrSingleTextureEffect.h"
12#include "GrRect.h"
13
14class GrGLTextureDomainEffect;
15
16/**
17 * Limits a texture's lookup coordinates to a domain.
18 */
19class GrTextureDomainEffect : public GrSingleTextureEffect {
20
21public:
bsalomon@google.com1ce49fc2012-09-18 14:14:49 +000022 /** Uses default texture params (no filter, clamp) */
23 GrTextureDomainEffect(GrTexture*, const GrRect& domain);
tomhudson@google.com2f68e762012-07-17 18:43:21 +000024
bsalomon@google.com1ce49fc2012-09-18 14:14:49 +000025 GrTextureDomainEffect(GrTexture*, const GrRect& domain, const GrTextureParams& params);
26
tomhudson@google.com2f68e762012-07-17 18:43:21 +000027 virtual ~GrTextureDomainEffect();
28
29 static const char* Name() { return "TextureDomain"; }
30
bsalomon@google.com422e81a2012-10-25 14:11:03 +000031 typedef GrGLTextureDomainEffect GLEffect;
tomhudson@google.com2f68e762012-07-17 18:43:21 +000032
bsalomon@google.com396e61f2012-10-25 19:00:29 +000033 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
bsalomon@google.coma469c282012-10-24 18:28:34 +000034 virtual bool isEqual(const GrEffect&) const SK_OVERRIDE;
tomhudson@google.com2f68e762012-07-17 18:43:21 +000035
36 const GrRect& domain() const { return fTextureDomain; }
37
38protected:
39
40 GrRect fTextureDomain;
41
42private:
bsalomon@google.comf271cc72012-10-24 19:35:13 +000043 GR_DECLARE_EFFECT_TEST;
tomhudson@google.com2f68e762012-07-17 18:43:21 +000044
45 typedef GrSingleTextureEffect INHERITED;
46};
47
48#endif