Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Unified Diff: include/gpu/GrStagedProcessor.h

Issue 1306803003: Revert of Remove GrStagedProcessor, remove the word Stage as it applies to FPs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/gpu/GrPaint.h ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrStagedProcessor.h
diff --git a/include/gpu/GrStagedProcessor.h b/include/gpu/GrStagedProcessor.h
new file mode 100644
index 0000000000000000000000000000000000000000..fe3afcccb0974994d70bfba681d94fa0fed8fc2e
--- /dev/null
+++ b/include/gpu/GrStagedProcessor.h
@@ -0,0 +1,44 @@
+/*
+ * 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 "SkRefCnt.h"
+
+class GrFragmentProcessor;
+
+/**
+ * Wraps a GrFragmentProcessor, basically a copyable SkAutoTUnref
+ * Templatized based on the ref type so backends can use the same wrapper
+ */
+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()->isEqual(*that.processor());
+ }
+
+ bool operator!=(const GrStagedProcessor& that) const { return !(*this == that); }
+
+ const char* name() const { return fProc->name(); }
+
+protected:
+ GrStagedProcessor() {}
+
+ T<const GrFragmentProcessor> fProc;
+};
+
+typedef GrStagedProcessor<SkAutoTUnref> GrFragmentStage;
+
+#endif
« no previous file with comments | « include/gpu/GrPaint.h ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698