Plumb filter quality into SkShader::appendStages().

We of course need this to know whether or not to bilerp.

TBR=herb@google.com

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4932

Change-Id: I5fe6d93c1d36d0d53f566f722960fcafb0d8bc3c
Reviewed-on: https://skia-review.googlesource.com/4932
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Mike Klein <mtklein@chromium.org>
diff --git a/include/core/SkShader.h b/include/core/SkShader.h
index 45302cc..0dcd111 100644
--- a/include/core/SkShader.h
+++ b/include/core/SkShader.h
@@ -9,6 +9,7 @@
 #define SkShader_DEFINED
 
 #include "SkBitmap.h"
+#include "SkFilterQuality.h"
 #include "SkFlattenable.h"
 #include "SkImageInfo.h"
 #include "SkMask.h"
@@ -476,7 +477,7 @@
     SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
 
     bool appendStages(SkRasterPipeline*, SkColorSpace*, SkFallbackAlloc*,
-                      const SkMatrix& ctm) const;
+                      const SkMatrix& ctm, SkFilterQuality) const;
 
 protected:
     void flatten(SkWriteBuffer&) const override;
@@ -510,7 +511,7 @@
     }
 
     virtual bool onAppendStages(SkRasterPipeline*, SkColorSpace*, SkFallbackAlloc*,
-                                const SkMatrix&) const {
+                                const SkMatrix&, SkFilterQuality) const {
         return false;
     }
 
diff --git a/src/core/SkColorShader.cpp b/src/core/SkColorShader.cpp
index 072e2a9..a090621 100644
--- a/src/core/SkColorShader.cpp
+++ b/src/core/SkColorShader.cpp
@@ -312,7 +312,8 @@
 bool SkColorShader::onAppendStages(SkRasterPipeline* p,
                                    SkColorSpace* dst,
                                    SkFallbackAlloc* scratch,
-                                   const SkMatrix& ctm) const {
+                                   const SkMatrix& ctm,
+                                   SkFilterQuality) const {
     auto color = scratch->make<SkPM4f>(SkPM4f_from_SkColor(fColor, dst));
     p->append(SkRasterPipeline::constant_color, color);
     return append_gamut_transform(p, scratch,
@@ -322,7 +323,8 @@
 bool SkColor4Shader::onAppendStages(SkRasterPipeline* p,
                                     SkColorSpace* dst,
                                     SkFallbackAlloc* scratch,
-                                    const SkMatrix& ctm) const {
+                                    const SkMatrix& ctm,
+                                    SkFilterQuality) const {
     auto color = scratch->make<SkPM4f>(fColor4.premul());
     p->append(SkRasterPipeline::constant_color, color);
     return append_gamut_transform(p, scratch, fColorSpace.get(), dst);
diff --git a/src/core/SkColorShader.h b/src/core/SkColorShader.h
index 1ca4752..3101fa3 100644
--- a/src/core/SkColorShader.h
+++ b/src/core/SkColorShader.h
@@ -66,7 +66,7 @@
         return true;
     }
     bool onAppendStages(SkRasterPipeline*, SkColorSpace*, SkFallbackAlloc*,
-                        const SkMatrix& ctm) const override;
+                        const SkMatrix& ctm, SkFilterQuality) const override;
 
 private:
     SkColor fColor;
@@ -122,7 +122,7 @@
         return true;
     }
     bool onAppendStages(SkRasterPipeline*, SkColorSpace*, SkFallbackAlloc*,
-                        const SkMatrix& ctm) const override;
+                        const SkMatrix& ctm, SkFilterQuality) const override;
 
 private:
     sk_sp<SkColorSpace> fColorSpace;
diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp
index 0adf33a..334f737 100644
--- a/src/core/SkRasterPipelineBlitter.cpp
+++ b/src/core/SkRasterPipelineBlitter.cpp
@@ -120,7 +120,8 @@
         // Shaders start with the paint color in (r,g,b,a) and dst-space (x,y) in (dr,dg).
         // Before the shader runs, move the paint color to (dr,dg,db,da), and put (x,y) in (r,g).
         pipeline->append(SkRasterPipeline::swap_src_dst);
-        if (!shader->appendStages(pipeline, dst.colorSpace(), &blitter->fScratchFallback, ctm)) {
+        if (!shader->appendStages(pipeline, dst.colorSpace(), &blitter->fScratchFallback,
+                                  ctm, paint.getFilterQuality())) {
             return earlyOut();
         }
         // srcin, s' = s * da, i.e. modulate the output of the shader by the paint alpha.
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp
index 057365b..ca0eac4 100644
--- a/src/core/SkShader.cpp
+++ b/src/core/SkShader.cpp
@@ -260,8 +260,9 @@
 bool SkShader::appendStages(SkRasterPipeline* pipeline,
                             SkColorSpace* dst,
                             SkFallbackAlloc* scratch,
-                            const SkMatrix& ctm) const {
-    return this->onAppendStages(pipeline, dst, scratch, ctm);
+                            const SkMatrix& ctm,
+                            SkFilterQuality quality) const {
+    return this->onAppendStages(pipeline, dst, scratch, ctm, quality);
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////