Add GrFragmentProcessor::clone(), implementation for ColorTableEffect, and unit test.
We occasionally make copies of GrPaints. clone() fill facilitate this case when GrFragmentProcessors are non-shareable..
Change-Id: I004e34f6ce8c293f9e0664d26532e44bd6b9fdff
Reviewed-on: https://skia-review.googlesource.com/26360
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrFragmentProcessor.h b/src/gpu/GrFragmentProcessor.h
index a4b28c2..e86d798 100644
--- a/src/gpu/GrFragmentProcessor.h
+++ b/src/gpu/GrFragmentProcessor.h
@@ -86,6 +86,14 @@
~GrFragmentProcessor() override;
+ /**
+ * Makes a copy of this fragment processor that draws equivalently to the original.
+ * If the processor has child processors they are cloned as well. Currently this
+ * has a default implementation that fails. This is temporary until it can be implemented
+ * for all fragemnt processor leaf classes.
+ */
+ virtual sk_sp<GrFragmentProcessor> clone() { return nullptr; }
+
GrGLSLFragmentProcessor* createGLSLInstance() const;
void getGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const {