Drop WebCoreInterpolationQualityToSkFilterQuality

Except for GraphicsContextState, this function is only used in one
location - SVGPaintContext. In that one instance it's hard-wired to 'low',
so make that even more obvious.
Move the function from SkiaUtils.h to GraphicsContextState.cpp and rename.

Review URL: https://codereview.chromium.org/1236363003

git-svn-id: svn://svn.chromium.org/blink/trunk@199092 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp b/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp
index b3a55a89..5ef11891 100644
--- a/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp
+++ b/third_party/WebKit/Source/core/paint/SVGPaintContext.cpp
@@ -214,7 +214,10 @@
     float paintAlpha = resourceMode == ApplyToFillMode ? svgStyle.fillOpacity() : svgStyle.strokeOpacity();
     paintServer.applyToSkPaint(paint, paintAlpha);
 
-    paint.setFilterQuality(WebCoreInterpolationQualityToSkFilterQuality(InterpolationDefault));
+    // We always set filter quality to 'low' here. This value will only have an
+    // effect for patterns, which are SkPictures, so using high-order filter
+    // should have little effect on the overall quality.
+    paint.setFilterQuality(kLow_SkFilterQuality);
 
     // TODO(fs): The color filter can set when generating a picture for a mask -
     // due to color-interpolation. We could also just apply the
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsContextState.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsContextState.cpp
index 0cc57a61..e23ba5a 100644
--- a/third_party/WebKit/Source/platform/graphics/GraphicsContextState.cpp
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsContextState.cpp
@@ -7,6 +7,15 @@
 
 namespace blink {
 
+static inline SkFilterQuality filterQualityForPaint(InterpolationQuality quality)
+{
+    // The filter quality "selected" here will primarily be used when painting a
+    // primitive using one of the SkPaints below. For the most part this will
+    // not affect things that are part of the Image class hierarchy (which use
+    // the unmodified m_interpolationQuality.)
+    return quality != InterpolationNone ? kLow_SkFilterQuality : kNone_SkFilterQuality;
+}
+
 GraphicsContextState::GraphicsContextState()
     : m_strokeColor(Color::black)
     , m_fillColor(Color::black)
@@ -21,10 +30,10 @@
     m_strokePaint.setStrokeCap(SkPaint::kDefault_Cap);
     m_strokePaint.setStrokeJoin(SkPaint::kDefault_Join);
     m_strokePaint.setStrokeMiter(SkFloatToScalar(m_strokeData.miterLimit()));
-    m_strokePaint.setFilterQuality(WebCoreInterpolationQualityToSkFilterQuality(m_interpolationQuality));
+    m_strokePaint.setFilterQuality(filterQualityForPaint(m_interpolationQuality));
     m_strokePaint.setAntiAlias(m_shouldAntialias);
     m_fillPaint.setColor(m_fillColor.rgb());
-    m_fillPaint.setFilterQuality(WebCoreInterpolationQualityToSkFilterQuality(m_interpolationQuality));
+    m_fillPaint.setFilterQuality(filterQualityForPaint(m_interpolationQuality));
     m_fillPaint.setAntiAlias(m_shouldAntialias);
 }
 
@@ -155,8 +164,8 @@
 void GraphicsContextState::setInterpolationQuality(InterpolationQuality quality)
 {
     m_interpolationQuality = quality;
-    m_strokePaint.setFilterQuality(WebCoreInterpolationQualityToSkFilterQuality(quality));
-    m_fillPaint.setFilterQuality(WebCoreInterpolationQualityToSkFilterQuality(quality));
+    m_strokePaint.setFilterQuality(filterQualityForPaint(quality));
+    m_fillPaint.setFilterQuality(filterQualityForPaint(quality));
 }
 
 void GraphicsContextState::setShouldAntialias(bool shouldAntialias)
diff --git a/third_party/WebKit/Source/platform/graphics/skia/SkiaUtils.h b/third_party/WebKit/Source/platform/graphics/skia/SkiaUtils.h
index 209e4d49..e2d1977 100644
--- a/third_party/WebKit/Source/platform/graphics/skia/SkiaUtils.h
+++ b/third_party/WebKit/Source/platform/graphics/skia/SkiaUtils.h
@@ -61,13 +61,6 @@
 // alpha is in the range [0, 256].
 SkColor PLATFORM_EXPORT scaleAlpha(SkColor, int);
 
-inline SkFilterQuality WebCoreInterpolationQualityToSkFilterQuality(InterpolationQuality quality)
-{
-    // FIXME: this reflects existing client mappings, but should probably
-    // be expanded to map higher level interpolations more accurately.
-    return quality != InterpolationNone ? kLow_SkFilterQuality : kNone_SkFilterQuality;
-}
-
 // Skia has problems when passed infinite, etc floats, filter them to 0.
 inline SkScalar WebCoreFloatToSkScalar(float f)
 {