1/*
2 * Copyright 2010 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 GrFragmentStage_DEFINED
9#define GrFragmentStage_DEFINED
10
11#include "GrFragmentProcessor.h"
12
13/**
14 * Wraps a GrFragmentProcessor, basically a copyable SkAutoTUnref
15 */
16class GrFragmentStage {
17public:
18    explicit GrFragmentStage(const GrFragmentProcessor* proc) : fProc(SkRef(proc)) {}
19
20    GrFragmentStage(const GrFragmentStage& other) { fProc.reset(SkRef(other.fProc.get())); }
21
22    const GrFragmentProcessor* processor() const { return fProc.get(); }
23
24    bool operator==(const GrFragmentStage& that) const {
25        return this->processor() == that.processor();
26    }
27
28    bool operator!=(const GrFragmentStage& that) const { return !(*this == that); }
29
30protected:
31    SkAutoTUnref<const GrFragmentProcessor> fProc;
32};
33
34#endif
35