remove shadeSpan4f()

This shouldn't cause any diffs, provided I've implemented the no-stages
shadeSpan() fallback correctly.  (I'm not sure which shaders don't have
stages at this point.)

Bug: skia:8730
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Change-Id: Ia0d777b526e05b7262ff77daec5ef4d8b0afdb9b
Reviewed-on: https://skia-review.googlesource.com/c/188031
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
diff --git a/src/shaders/gradients/Sk4fLinearGradient.cpp b/src/shaders/gradients/Sk4fLinearGradient.cpp
index a81f960..29dfab6 100644
--- a/src/shaders/gradients/Sk4fLinearGradient.cpp
+++ b/src/shaders/gradients/Sk4fLinearGradient.cpp
@@ -13,21 +13,21 @@
 
 namespace {
 
-template<typename dstType, ApplyPremul premul>
-void ramp(const Sk4f& c, const Sk4f& dc, dstType dst[], int n,
+template<ApplyPremul premul>
+void ramp(const Sk4f& c, const Sk4f& dc, SkPMColor dst[], int n,
           const Sk4f& bias0, const Sk4f& bias1) {
     SkASSERT(n > 0);
 
     const Sk4f dc2 = dc + dc,
                dc4 = dc2 + dc2;
 
-    Sk4f c0 =  c +      DstTraits<dstType, premul>::pre_lerp_bias(bias0),
-         c1 =  c + dc + DstTraits<dstType, premul>::pre_lerp_bias(bias1),
+    Sk4f c0 =  c +      DstTraits<premul>::pre_lerp_bias(bias0),
+         c1 =  c + dc + DstTraits<premul>::pre_lerp_bias(bias1),
          c2 = c0 + dc2,
          c3 = c1 + dc2;
 
     while (n >= 4) {
-        DstTraits<dstType, premul>::store4x(c0, c1, c2, c3, dst, bias0, bias1);
+        DstTraits<premul>::store4x(c0, c1, c2, c3, dst, bias0, bias1);
         dst += 4;
 
         c0 = c0 + dc4;
@@ -37,12 +37,12 @@
         n -= 4;
     }
     if (n & 2) {
-        DstTraits<dstType, premul>::store(c0, dst++, bias0);
-        DstTraits<dstType, premul>::store(c1, dst++, bias1);
+        DstTraits<premul>::store(c0, dst++, bias0);
+        DstTraits<premul>::store(c1, dst++, bias1);
         c0 = c0 + dc2;
     }
     if (n & 1) {
-        DstTraits<dstType, premul>::store(c0, dst, bias0);
+        DstTraits<premul>::store(c0, dst, bias0);
     }
 }
 
@@ -173,33 +173,19 @@
         bias0 += 0.5f;
         bias1 += 0.5f;
 
-        this->shadePremulSpan<SkPMColor, ApplyPremul::False>(x, y, dst, count, bias0, bias1);
+        this->shadePremulSpan<ApplyPremul::False>(x, y, dst, count, bias0, bias1);
     } else {
         // In unpremul interpolation mode, Components are not pre-scaled.
         bias0 *= 1/255.0f;
         bias1 *= 1/255.0f;
 
-        this->shadePremulSpan<SkPMColor, ApplyPremul::True >(x, y, dst, count, bias0, bias1);
+        this->shadePremulSpan<ApplyPremul::True >(x, y, dst, count, bias0, bias1);
     }
 }
 
+template<ApplyPremul premul>
 void SkLinearGradient::
-LinearGradient4fContext::shadeSpan4f(int x, int y, SkPMColor4f dst[], int count) {
-    SkASSERT(count > 0);
-
-    // 4f dests are dithered at a later stage, if needed.
-    static constexpr float bias0 = 0,
-                           bias1 = 0;
-    if (fColorsArePremul) {
-        this->shadePremulSpan<SkPMColor4f, ApplyPremul::False>(x, y, dst, count, bias0, bias1);
-    } else {
-        this->shadePremulSpan<SkPMColor4f, ApplyPremul::True >(x, y, dst, count, bias0, bias1);
-    }
-}
-
-template<typename dstType, ApplyPremul premul>
-void SkLinearGradient::
-LinearGradient4fContext::shadePremulSpan(int x, int y, dstType dst[], int count,
+LinearGradient4fContext::shadePremulSpan(int x, int y, SkPMColor dst[], int count,
                                          float bias0, float bias1) const {
     const SkLinearGradient& shader = static_cast<const SkLinearGradient&>(fShader);
     switch (shader.fTileMode) {
@@ -207,20 +193,20 @@
         SkASSERT(false);    // decal only supported via stages
         // fall-through
     case kClamp_TileMode:
-        this->shadeSpanInternal<dstType, premul, kClamp_TileMode >(x, y, dst, count, bias0, bias1);
+        this->shadeSpanInternal<premul, kClamp_TileMode >(x, y, dst, count, bias0, bias1);
         break;
     case kRepeat_TileMode:
-        this->shadeSpanInternal<dstType, premul, kRepeat_TileMode>(x, y, dst, count, bias0, bias1);
+        this->shadeSpanInternal<premul, kRepeat_TileMode>(x, y, dst, count, bias0, bias1);
         break;
     case kMirror_TileMode:
-        this->shadeSpanInternal<dstType, premul, kMirror_TileMode>(x, y, dst, count, bias0, bias1);
+        this->shadeSpanInternal<premul, kMirror_TileMode>(x, y, dst, count, bias0, bias1);
         break;
     }
 }
 
-template<typename dstType, ApplyPremul premul, SkShader::TileMode tileMode>
+template<ApplyPremul premul, SkShader::TileMode tileMode>
 void SkLinearGradient::
-LinearGradient4fContext::shadeSpanInternal(int x, int y, dstType dst[], int count,
+LinearGradient4fContext::shadeSpanInternal(int x, int y, SkPMColor dst[], int count,
                                            float bias0, float bias1) const {
     SkPoint pt;
     fDstToPosProc(fDstToPos,
@@ -229,12 +215,12 @@
                   &pt);
     const SkScalar fx = pinFx<tileMode>(pt.x());
     const SkScalar dx = fDstToPos.getScaleX();
-    LinearIntervalProcessor<dstType, premul, tileMode> proc(fIntervals->begin(),
-                                                            fIntervals->end() - 1,
-                                                            this->findInterval(fx),
-                                                            fx,
-                                                            dx,
-                                                            SkScalarNearlyZero(dx * count));
+    LinearIntervalProcessor<premul, tileMode> proc(fIntervals->begin(),
+                                                   fIntervals->end() - 1,
+                                                   this->findInterval(fx),
+                                                   fx,
+                                                   dx,
+                                                   SkScalarNearlyZero(dx * count));
     Sk4f bias4f0(bias0),
          bias4f1(bias1);
 
@@ -251,10 +237,10 @@
             || (n == count && proc.currentRampIsZero()));
 
         if (proc.currentRampIsZero()) {
-            DstTraits<dstType, premul>::store(proc.currentColor(), dst, n);
+            DstTraits<premul>::store(proc.currentColor(), dst, n);
         } else {
-            ramp<dstType, premul>(proc.currentColor(), proc.currentColorGrad(), dst, n,
-                                  bias4f0, bias4f1);
+            ramp<premul>(proc.currentColor(), proc.currentColorGrad(), dst, n,
+                         bias4f0, bias4f1);
         }
 
         proc.advance(SkIntToScalar(n));
@@ -268,7 +254,7 @@
     }
 }
 
-template<typename dstType, ApplyPremul premul, SkShader::TileMode tileMode>
+template<ApplyPremul premul, SkShader::TileMode tileMode>
 class SkLinearGradient::
 LinearGradient4fContext::LinearIntervalProcessor {
 public:
@@ -333,8 +319,8 @@
     void compute_interval_props(SkScalar t) {
         SkASSERT(in_range(t, fInterval->fT0, fInterval->fT1));
 
-        const Sk4f dc = DstTraits<dstType, premul>::load(fInterval->fCg);
-                  fCc = DstTraits<dstType, premul>::load(fInterval->fCb) + dc * Sk4f(t);
+        const Sk4f dc = DstTraits<premul>::load(fInterval->fCg);
+                  fCc = DstTraits<premul>::load(fInterval->fCb) + dc * Sk4f(t);
                 fDcDx = dc * fDx;
             fZeroRamp = fIsVertical || (dc == 0).allTrue();
     }
@@ -353,8 +339,8 @@
             //
             //   Avg += C * (t1 - t0)
             //
-            const auto c = DstTraits<dstType, premul>::load(i->fCb)
-                         + DstTraits<dstType, premul>::load(i->fCg) * (i->fT0 + i->fT1) * 0.5f;
+            const auto c = DstTraits<premul>::load(i->fCb)
+                         + DstTraits<premul>::load(i->fCg) * (i->fT0 + i->fT1) * 0.5f;
             fCc = fCc + c * (i->fT1 - i->fT0);
         }
     }