Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2015 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 GrStagedProcessorStage_DEFINED | |
| 9 #define GrStagedProcessorStage_DEFINED | |
| 10 | |
| 11 #include "GrFragmentProcessor.h" | |
| 12 #include "SkRefCnt.h" | |
| 13 | |
| 14 /** | |
|
robertphillips
2015/07/13 19:12:29
Update comment ?
// templatized based on which con
| |
| 15 * Wraps a GrFragmentProcessor, basically a copyable SkAutoTUnref | |
| 16 */ | |
| 17 template<template<typename> class T> | |
| 18 class GrStagedProcessor { | |
| 19 public: | |
| 20 explicit GrStagedProcessor(const GrFragmentProcessor* proc) : fProc(SkRef(pr oc)) {} | |
| 21 | |
| 22 GrStagedProcessor(const GrStagedProcessor& other) { fProc.reset(SkRef(other. fProc.get())); } | |
| 23 | |
| 24 const GrFragmentProcessor* processor() const { return fProc.get(); } | |
| 25 | |
| 26 bool operator==(const GrStagedProcessor& that) const { | |
| 27 return this->processor() == that.processor(); | |
| 28 } | |
| 29 | |
| 30 bool operator!=(const GrStagedProcessor& that) const { return !(*this == tha t); } | |
| 31 | |
| 32 const char* name() const { return fProc->name(); } | |
| 33 | |
| 34 protected: | |
| 35 T<const GrFragmentProcessor> fProc; | |
| 36 }; | |
| 37 | |
|
robertphillips
2015/07/13 19:12:29
Can we not do:
typedef GrStagedProcessor<GrPending
| |
| 38 typedef GrStagedProcessor<SkAutoTUnref> GrFragmentStage; | |
| 39 | |
| 40 #endif | |
| OLD | NEW |