Chromium Code Reviews| Index: include/gpu/GrStagedProcessor.h |
| diff --git a/include/gpu/GrStagedProcessor.h b/include/gpu/GrStagedProcessor.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5121b7f8604b7b3b444588270622462b531ac07b |
| --- /dev/null |
| +++ b/include/gpu/GrStagedProcessor.h |
| @@ -0,0 +1,40 @@ |
| +/* |
| + * Copyright 2015 Google Inc. |
| + * |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| +#ifndef GrStagedProcessorStage_DEFINED |
| +#define GrStagedProcessorStage_DEFINED |
| + |
| +#include "GrFragmentProcessor.h" |
| +#include "SkRefCnt.h" |
| + |
| +/** |
|
robertphillips
2015/07/13 19:12:29
Update comment ?
// templatized based on which con
|
| + * Wraps a GrFragmentProcessor, basically a copyable SkAutoTUnref |
| + */ |
| +template<template<typename> class T> |
| +class GrStagedProcessor { |
| +public: |
| + explicit GrStagedProcessor(const GrFragmentProcessor* proc) : fProc(SkRef(proc)) {} |
| + |
| + GrStagedProcessor(const GrStagedProcessor& other) { fProc.reset(SkRef(other.fProc.get())); } |
| + |
| + const GrFragmentProcessor* processor() const { return fProc.get(); } |
| + |
| + bool operator==(const GrStagedProcessor& that) const { |
| + return this->processor() == that.processor(); |
| + } |
| + |
| + bool operator!=(const GrStagedProcessor& that) const { return !(*this == that); } |
| + |
| + const char* name() const { return fProc->name(); } |
| + |
| +protected: |
| + T<const GrFragmentProcessor> fProc; |
| +}; |
| + |
|
robertphillips
2015/07/13 19:12:29
Can we not do:
typedef GrStagedProcessor<GrPending
|
| +typedef GrStagedProcessor<SkAutoTUnref> GrFragmentStage; |
| + |
| +#endif |