Reland "Base Gradient FP Refactor"
This reverts commit 1ea5656a285bcfef445d6f69eaab477e68595b54.
Reason for revert: Fixed google3 build failure
Original change's description:
> Revert "Base Gradient FP Refactor"
>
> This reverts commit 10f7a1e07554a362aef979d32ba288a009bdff90.
>
> Reason for revert: broke google3 roll
> Original change's description:
> > Base Gradient FP Refactor
> >
> > --
> >
> > Redefines how gradients will be written in the GPU back-end:
> >
> > They are split into three fragment processor components: master, layout, and colorizer.
> > The layout FP is responsible for converting the fragment position into an interpolant value, t.
> > Each high-level gradient--such as linear, radial, etc.--are implemented solely in a layout FP.
> > The colorizer FP is responsible for converting t into a color.
> > The master FP invokes the layout, clamps t into the proper domain, and then invokes the colorizer.
> > GrGradientShader provides factory functions to create FP graphs from SkGradientShader instances.
> > This pattern is documented in gpu/gradients/README.md.
> >
> > Goals for current CL
> > ====================
> >
> > Outline the FP components by providing .fp implementations for the simplest gradients.
> > Defines a two-color single interval colorizer and a linear gradient layout, and the master effect.
> > A MakeLinear() factory function is provided that can convert SkGradientShaders that fit these constraints.
> > SkLinearGradient first attempts to use the new system, falling back to the original GrGradientEffect.
> >
> > Future CLs
> > ==========
> >
> > To keep the CL reviews manageable, additional dependent CLs will be added that gradually replace past functionality.
> > A CL for each layout will be defined.
> > CLs for the different analytic colorizer cases and the textured gradient case will be defined.
> > Once the new system supports all current layouts and colorizer capabilities, all old GPU gradient code will be removed.
> > After this clean-up, analytic colorization can hopefully be expanded to reduce the usage of textured gradients.
> >
> > Bug: skia:
> > Change-Id: Iafe7b8b4071491a71c473babcd7bedda659150c1
> > Reviewed-on: https://skia-review.googlesource.com/148120
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,michaelludwig@google.com
>
> Change-Id: Ib735e323795ac8874cb00b007a915786b50517a6
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:
> Reviewed-on: https://skia-review.googlesource.com/153600
> Reviewed-by: Cary Clark <caryclark@google.com>
> Commit-Queue: Cary Clark <caryclark@google.com>
TBR=bsalomon@google.com,caryclark@google.com,michaelludwig@google.com
Change-Id: Ibf6ffbcb1af0dfbdac7317151aeb08f18f84c7fd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/153887
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
diff --git a/src/gpu/gradients/GrTiledGradientEffect.h b/src/gpu/gradients/GrTiledGradientEffect.h
new file mode 100644
index 0000000..8216742
--- /dev/null
+++ b/src/gpu/gradients/GrTiledGradientEffect.h
@@ -0,0 +1,43 @@
+/*
+ * 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 GrTiledGradientEffect.fp; do not modify.
+ **************************************************************************************************/
+#ifndef GrTiledGradientEffect_DEFINED
+#define GrTiledGradientEffect_DEFINED
+#include "SkTypes.h"
+#include "GrFragmentProcessor.h"
+#include "GrCoordTransform.h"
+class GrTiledGradientEffect : public GrFragmentProcessor {
+public:
+ bool mirror() const { return fMirror; }
+ static std::unique_ptr<GrFragmentProcessor> Make(
+ std::unique_ptr<GrFragmentProcessor> colorizer,
+ std::unique_ptr<GrFragmentProcessor> gradLayout, bool mirror) {
+ return std::unique_ptr<GrFragmentProcessor>(
+ new GrTiledGradientEffect(std::move(colorizer), std::move(gradLayout), mirror));
+ }
+ GrTiledGradientEffect(const GrTiledGradientEffect& src);
+ std::unique_ptr<GrFragmentProcessor> clone() const override;
+ const char* name() const override { return "TiledGradientEffect"; }
+
+private:
+ GrTiledGradientEffect(std::unique_ptr<GrFragmentProcessor> colorizer,
+ std::unique_ptr<GrFragmentProcessor> gradLayout, bool mirror)
+ : INHERITED(kGrTiledGradientEffect_ClassID, kNone_OptimizationFlags), fMirror(mirror) {
+ this->registerChildProcessor(std::move(colorizer));
+ this->registerChildProcessor(std::move(gradLayout));
+ }
+ GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
+ void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
+ bool onIsEqual(const GrFragmentProcessor&) const override;
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST
+ bool fMirror;
+ typedef GrFragmentProcessor INHERITED;
+};
+#endif