Remove GrTextureGradientColorizer and use GrTextureEffect instead.

Gradient colorizers are now sampled via explicit coordinates instead of
by passing coordinate data in a color channel. This change caused the
GrTextureGradientColorizer to become a no-op/passthrough effect.

Change-Id: I5233c93914716cac186b0ea8f5a3698746a89742
Bug: skia:10548
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307298
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
diff --git a/gn/gpu.gni b/gn/gpu.gni
index de30cbe..6047c2a 100644
--- a/gn/gpu.gni
+++ b/gn/gpu.gni
@@ -433,8 +433,6 @@
   "$_src/gpu/gradients/generated/GrSingleIntervalGradientColorizer.h",
   "$_src/gpu/gradients/generated/GrSweepGradientLayout.cpp",
   "$_src/gpu/gradients/generated/GrSweepGradientLayout.h",
-  "$_src/gpu/gradients/generated/GrTextureGradientColorizer.cpp",
-  "$_src/gpu/gradients/generated/GrTextureGradientColorizer.h",
   "$_src/gpu/gradients/generated/GrTiledGradientEffect.cpp",
   "$_src/gpu/gradients/generated/GrTiledGradientEffect.h",
   "$_src/gpu/gradients/generated/GrTwoPointConicalGradientLayout.cpp",
diff --git a/gn/sksl.gni b/gn/sksl.gni
index 537997a..dc54608 100644
--- a/gn/sksl.gni
+++ b/gn/sksl.gni
@@ -108,7 +108,6 @@
   "$_src/gpu/gradients/GrRadialGradientLayout.fp",
   "$_src/gpu/gradients/GrSingleIntervalGradientColorizer.fp",
   "$_src/gpu/gradients/GrSweepGradientLayout.fp",
-  "$_src/gpu/gradients/GrTextureGradientColorizer.fp",
   "$_src/gpu/gradients/GrTiledGradientEffect.fp",
   "$_src/gpu/gradients/GrTwoPointConicalGradientLayout.fp",
   "$_src/gpu/gradients/GrUnrolledBinaryGradientColorizer.fp",
diff --git a/src/gpu/GrProcessor.h b/src/gpu/GrProcessor.h
index e09dd6f..93e2c60 100644
--- a/src/gpu/GrProcessor.h
+++ b/src/gpu/GrProcessor.h
@@ -140,7 +140,6 @@
         kGrSampleMaskProcessor_ClassID,
         kGrSweepGradientLayout_ClassID,
         kGrTextureEffect_ClassID,
-        kGrTextureGradientColorizer_ClassID,
         kGrTiledGradientEffect_ClassID,
         kGrTwoPointConicalGradientLayout_ClassID,
         kGrUnrolledBinaryGradientColorizer_ClassID,
diff --git a/src/gpu/gradients/GrGradientShader.cpp b/src/gpu/gradients/GrGradientShader.cpp
index 45c2ec4..f6e15a5 100644
--- a/src/gpu/gradients/GrGradientShader.cpp
+++ b/src/gpu/gradients/GrGradientShader.cpp
@@ -18,7 +18,6 @@
 #include "src/gpu/gradients/GrGradientBitmapCache.h"
 #include "src/gpu/gradients/generated/GrDualIntervalGradientColorizer.h"
 #include "src/gpu/gradients/generated/GrSingleIntervalGradientColorizer.h"
-#include "src/gpu/gradients/generated/GrTextureGradientColorizer.h"
 #include "src/gpu/gradients/generated/GrUnrolledBinaryGradientColorizer.h"
 
 #include "include/gpu/GrRecordingContext.h"
@@ -65,11 +64,9 @@
         SkDebugf("Gradient won't draw. Could not create texture.");
         return nullptr;
     }
-    // TODO(skbug.com/10548): When we start sampling colorizers with explicit coords rather than
-    // using sk_InColor, the GrTextureEffect can simply be the colorizer.
+
     auto m = SkMatrix::Scale(view.width(), 1.f);
-    auto te = GrTextureEffect::Make(std::move(view), alphaType, m, GrSamplerState::Filter::kLinear);
-    return GrTextureGradientColorizer::Make(std::move(te));
+    return GrTextureEffect::Make(std::move(view), alphaType, m, GrSamplerState::Filter::kLinear);
 }
 
 // Analyze the shader's color stops and positions and chooses an appropriate colorizer to represent
diff --git a/src/gpu/gradients/GrTextureGradientColorizer.fp b/src/gpu/gradients/GrTextureGradientColorizer.fp
deleted file mode 100644
index 2a7c2ca..0000000
--- a/src/gpu/gradients/GrTextureGradientColorizer.fp
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright 2018 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-// Should have height = 1px, horizontal axis represents t = 0 to 1
-in fragmentProcessor textureFP;
-
-void main(float2 coord) {
-    sk_OutColor = sample(textureFP);
-}
diff --git a/src/gpu/gradients/generated/GrTextureGradientColorizer.cpp b/src/gpu/gradients/generated/GrTextureGradientColorizer.cpp
deleted file mode 100644
index 131e981..0000000
--- a/src/gpu/gradients/generated/GrTextureGradientColorizer.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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 GrTextureGradientColorizer.fp; do not modify.
- **************************************************************************************************/
-#include "GrTextureGradientColorizer.h"
-
-#include "src/core/SkUtils.h"
-#include "src/gpu/GrTexture.h"
-#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
-#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
-#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
-#include "src/sksl/SkSLCPP.h"
-#include "src/sksl/SkSLUtil.h"
-class GrGLSLTextureGradientColorizer : public GrGLSLFragmentProcessor {
-public:
-    GrGLSLTextureGradientColorizer() {}
-    void emitCode(EmitArgs& args) override {
-        GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
-        const GrTextureGradientColorizer& _outer = args.fFp.cast<GrTextureGradientColorizer>();
-        (void)_outer;
-        SkString _sample295 = this->invokeChild(0, args);
-        fragBuilder->codeAppendf(
-                R"SkSL(%s = %s;
-)SkSL",
-                args.fOutputColor, _sample295.c_str());
-    }
-
-private:
-    void onSetData(const GrGLSLProgramDataManager& pdman,
-                   const GrFragmentProcessor& _proc) override {}
-};
-GrGLSLFragmentProcessor* GrTextureGradientColorizer::onCreateGLSLInstance() const {
-    return new GrGLSLTextureGradientColorizer();
-}
-void GrTextureGradientColorizer::onGetGLSLProcessorKey(const GrShaderCaps& caps,
-                                                       GrProcessorKeyBuilder* b) const {}
-bool GrTextureGradientColorizer::onIsEqual(const GrFragmentProcessor& other) const {
-    const GrTextureGradientColorizer& that = other.cast<GrTextureGradientColorizer>();
-    (void)that;
-    return true;
-}
-GrTextureGradientColorizer::GrTextureGradientColorizer(const GrTextureGradientColorizer& src)
-        : INHERITED(kGrTextureGradientColorizer_ClassID, src.optimizationFlags()) {
-    this->cloneAndRegisterAllChildProcessors(src);
-}
-std::unique_ptr<GrFragmentProcessor> GrTextureGradientColorizer::clone() const {
-    return std::unique_ptr<GrFragmentProcessor>(new GrTextureGradientColorizer(*this));
-}
diff --git a/src/gpu/gradients/generated/GrTextureGradientColorizer.h b/src/gpu/gradients/generated/GrTextureGradientColorizer.h
deleted file mode 100644
index 53369f6..0000000
--- a/src/gpu/gradients/generated/GrTextureGradientColorizer.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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 GrTextureGradientColorizer.fp; do not modify.
- **************************************************************************************************/
-#ifndef GrTextureGradientColorizer_DEFINED
-#define GrTextureGradientColorizer_DEFINED
-
-#include "include/core/SkM44.h"
-#include "include/core/SkTypes.h"
-
-#include "src/gpu/GrFragmentProcessor.h"
-
-class GrTextureGradientColorizer : public GrFragmentProcessor {
-public:
-    static std::unique_ptr<GrFragmentProcessor> Make(
-            std::unique_ptr<GrFragmentProcessor> textureFP) {
-        return std::unique_ptr<GrFragmentProcessor>(
-                new GrTextureGradientColorizer(std::move(textureFP)));
-    }
-    GrTextureGradientColorizer(const GrTextureGradientColorizer& src);
-    std::unique_ptr<GrFragmentProcessor> clone() const override;
-    const char* name() const override { return "TextureGradientColorizer"; }
-
-private:
-    GrTextureGradientColorizer(std::unique_ptr<GrFragmentProcessor> textureFP)
-            : INHERITED(kGrTextureGradientColorizer_ClassID, kNone_OptimizationFlags) {
-        SkASSERT(textureFP);
-        this->registerChild(std::move(textureFP), SkSL::SampleUsage::PassThrough());
-    }
-    GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
-    void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
-    bool onIsEqual(const GrFragmentProcessor&) const override;
-    GR_DECLARE_FRAGMENT_PROCESSOR_TEST
-    typedef GrFragmentProcessor INHERITED;
-};
-#endif