aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-07-14 11:02:45 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-14 11:02:46 -0700
commit3df1e2163f9d7afc997dc14c440fab31277bff5c (patch)
treeb75637ba66e89f6ea9bb6ec44f58502a55bab830 /include
parentab51cbd9b6b98b9e6721863694cc447ad403cd18 (diff)
Another trivial cleanup
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrFragmentStage.h34
-rw-r--r--include/gpu/GrPaint.h2
-rw-r--r--include/gpu/GrStagedProcessor.h43
3 files changed, 44 insertions, 35 deletions
diff --git a/include/gpu/GrFragmentStage.h b/include/gpu/GrFragmentStage.h
deleted file mode 100644
index ca3be8a0f7..0000000000
--- a/include/gpu/GrFragmentStage.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index 22951f94a2..efb3010286 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -11,7 +11,7 @@
#define GrPaint_DEFINED
#include "GrColor.h"
-#include "GrFragmentStage.h"
+#include "GrStagedProcessor.h"
#include "GrProcessorDataManager.h"
#include "GrXferProcessor.h"
#include "effects/GrPorterDuffXferProcessor.h"
diff --git a/include/gpu/GrStagedProcessor.h b/include/gpu/GrStagedProcessor.h
new file mode 100644
index 0000000000..170283102c
--- /dev/null
+++ b/include/gpu/GrStagedProcessor.h
@@ -0,0 +1,43 @@
+/*
+ * 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"
+
+/**
+ * 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() == 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