aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrTextureDomainEffect.h
blob: e045ab15569620f848699f5fa7a1f1e304f64fcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * Copyright 2012 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef GrTextureDomainEffect_DEFINED
#define GrTextureDomainEffect_DEFINED

#include "GrSingleTextureEffect.h"
#include "GrRect.h"

class GrGLTextureDomainEffect;

/**
 * Limits a texture's lookup coordinates to a domain.
 */
class GrTextureDomainEffect : public GrSingleTextureEffect {

public:
    /** Uses default texture params (no filter, clamp) */
    GrTextureDomainEffect(GrTexture*, const GrRect& domain);

    GrTextureDomainEffect(GrTexture*, const GrRect& domain, const GrTextureParams& params);

    virtual ~GrTextureDomainEffect();

    static const char* Name() { return "TextureDomain"; }

    typedef GrGLTextureDomainEffect GLProgramStage;

    virtual const GrProgramStageFactory& getFactory() const SK_OVERRIDE;
    virtual bool isEqual(const GrEffect&) const SK_OVERRIDE;

    const GrRect& domain() const { return fTextureDomain; }

protected:

    GrRect fTextureDomain;

private:
    GR_DECLARE_EFFECT_TEST;

    typedef GrSingleTextureEffect INHERITED;
};

#endif