aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/GrFragmentStage.h
blob: ca3be8a0f7f56c9a732f02753954166f3ccc01cf (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
/*
 * Copyright 2010 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef GrFragmentStage_DEFINED
#define GrFragmentStage_DEFINED

#include "GrFragmentProcessor.h"

/**
 * Wraps a GrFragmentProcessor, basically a copyable SkAutoTUnref
 */
class GrFragmentStage {
public:
    explicit GrFragmentStage(const GrFragmentProcessor* proc) : fProc(SkRef(proc)) {}

    GrFragmentStage(const GrFragmentStage& other) { fProc.reset(SkRef(other.fProc.get())); }

    const GrFragmentProcessor* processor() const { return fProc.get(); }

    bool operator==(const GrFragmentStage& that) const {
        return this->processor() == that.processor();
    }

    bool operator!=(const GrFragmentStage& that) const { return !(*this == that); }

protected:
    SkAutoTUnref<const GrFragmentProcessor> fProc;
};

#endif