Implement sweep gradient layout
Add an FP that implements the sweep gradient effect and updates
SkSweepGradient to use the new system if possible.
Bug: skia:
Change-Id: I3f65da01afafae54c45848a6a78fd758f65eb4a6
Reviewed-on: https://skia-review.googlesource.com/148806
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/gradients/GrSweepGradientLayout.h b/src/gpu/gradients/GrSweepGradientLayout.h
new file mode 100644
index 0000000..ff4e143
--- /dev/null
+++ b/src/gpu/gradients/GrSweepGradientLayout.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**************************************************************************************************
+ *** This file was autogenerated from GrSweepGradientLayout.fp; do not modify.
+ **************************************************************************************************/
+#ifndef GrSweepGradientLayout_DEFINED
+#define GrSweepGradientLayout_DEFINED
+#include "SkTypes.h"
+
+#include "SkSweepGradient.h"
+#include "GrFragmentProcessor.h"
+#include "GrCoordTransform.h"
+class GrSweepGradientLayout : public GrFragmentProcessor {
+public:
+ const SkMatrix44& gradientMatrix() const { return fGradientMatrix; }
+ float bias() const { return fBias; }
+ float scale() const { return fScale; }
+
+ static std::unique_ptr<GrFragmentProcessor> Make(const SkSweepGradient& gradient,
+ const GrFPArgs& args);
+ GrSweepGradientLayout(const GrSweepGradientLayout& src);
+ std::unique_ptr<GrFragmentProcessor> clone() const override;
+ const char* name() const override { return "SweepGradientLayout"; }
+
+private:
+ GrSweepGradientLayout(SkMatrix44 gradientMatrix, float bias, float scale)
+ : INHERITED(kGrSweepGradientLayout_ClassID, kNone_OptimizationFlags)
+ , fGradientMatrix(gradientMatrix)
+ , fBias(bias)
+ , fScale(scale)
+ , fCoordTransform0(gradientMatrix) {
+ this->addCoordTransform(&fCoordTransform0);
+ }
+ GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
+ void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
+ bool onIsEqual(const GrFragmentProcessor&) const override;
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST
+ SkMatrix44 fGradientMatrix;
+ float fBias;
+ float fScale;
+ GrCoordTransform fCoordTransform0;
+ typedef GrFragmentProcessor INHERITED;
+};
+#endif