Make GrBicubicEffect take tile modes rather than GrTextureParams.

GrTextureParams allows the caller to override the filter mode. But no filtering other than nearest neighbor makes sense.

Also removes coord set from creation signature since it is unused.

R=robertphillips@google.com

Author: bsalomon@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk/src@12591 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/core/SkBitmapProcShader.cpp b/core/SkBitmapProcShader.cpp
index fcfcdbf..bb16119 100644
--- a/core/SkBitmapProcShader.cpp
+++ b/core/SkBitmapProcShader.cpp
@@ -419,7 +419,7 @@
 
     GrEffectRef* effect = NULL;
     if (paintFilterLevel == SkPaint::kHigh_FilterLevel) {
-        effect = GrBicubicEffect::Create(texture, matrix, params);
+        effect = GrBicubicEffect::Create(texture, matrix, tm);
     } else {
         effect = GrSimpleTextureEffect::Create(texture, matrix, params);
     }
diff --git a/gpu/SkGpuDevice.cpp b/gpu/SkGpuDevice.cpp
index f45572b..ce02f2c 100644
--- a/gpu/SkGpuDevice.cpp
+++ b/gpu/SkGpuDevice.cpp
@@ -1426,7 +1426,9 @@
                                                    GrTextureDomain::kClamp_Mode,
                                                    params.filterMode()));
     } else if (bicubic) {
-        effect.reset(GrBicubicEffect::Create(texture, SkMatrix::I(), params));
+        SkASSERT(GrTextureParams::kNone_FilterMode == params.filterMode());
+        SkShader::TileMode tileModes[2] = { params.getTileModeX(), params.getTileModeY() };
+        effect.reset(GrBicubicEffect::Create(texture, SkMatrix::I(), tileModes));
     } else {
         effect.reset(GrSimpleTextureEffect::Create(texture, SkMatrix::I(), params));
     }
diff --git a/gpu/effects/GrBicubicEffect.cpp b/gpu/effects/GrBicubicEffect.cpp
index cd013cb..a6e08f2 100644
--- a/gpu/effects/GrBicubicEffect.cpp
+++ b/gpu/effects/GrBicubicEffect.cpp
@@ -106,23 +106,10 @@
 }
 
 GrBicubicEffect::GrBicubicEffect(GrTexture* texture,
-                                 const SkScalar coefficients[16])
-  : INHERITED(texture, MakeDivByTextureWHMatrix(texture)) {
-    for (int y = 0; y < 4; y++) {
-        for (int x = 0; x < 4; x++) {
-            // Convert from row-major scalars to column-major floats.
-            fCoefficients[x * 4 + y] = SkScalarToFloat(coefficients[y * 4 + x]);
-        }
-    }
-    this->setWillNotUseInputColor();
-}
-
-GrBicubicEffect::GrBicubicEffect(GrTexture* texture,
                                  const SkScalar coefficients[16],
                                  const SkMatrix &matrix,
-                                 const GrTextureParams &params,
-                                 GrCoordSet coordSet)
-  : INHERITED(texture, matrix, params, coordSet) {
+                                 const SkShader::TileMode tileModes[2])
+  : INHERITED(texture, matrix, GrTextureParams(tileModes, GrTextureParams::kNone_FilterMode)) {
     for (int y = 0; y < 4; y++) {
         for (int x = 0; x < 4; x++) {
             // Convert from row-major scalars to column-major floats.
diff --git a/gpu/effects/GrBicubicEffect.h b/gpu/effects/GrBicubicEffect.h
index d8c431a..85bec77 100644
--- a/gpu/effects/GrBicubicEffect.h
+++ b/gpu/effects/GrBicubicEffect.h
@@ -31,34 +31,44 @@
     virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
     virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
 
-    static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16]) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients)));
-        return CreateEffectRef(effect);
-    }
-
-    static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16],
-                               const SkMatrix& matrix,
-                               const GrTextureParams& p,
-                               GrCoordSet coordSet = kLocal_GrCoordSet) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients, matrix, p, coordSet)));
-        return CreateEffectRef(effect);
-    }
-
+    /**
+     * Create a simple Mitchell filter effect.
+     */
     static GrEffectRef* Create(GrTexture* tex) {
         return Create(tex, gMitchellCoefficients);
     }
 
+    /**
+     * Create a simple filter effect with custom bicubic coefficients.
+     */
+    static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16]) {
+        const SkShader::TileMode tm[] = { SkShader::kClamp_TileMode, SkShader::kClamp_TileMode };
+        return Create(tex, coefficients, MakeDivByTextureWHMatrix(tex), tm);
+    }
+
+    /**
+     * Create a Mitchell filter effect with specified texture matrix and x/y tile modes.
+     */
     static GrEffectRef* Create(GrTexture* tex,
                                const SkMatrix& matrix,
-                               const GrTextureParams& p,
-                               GrCoordSet coordSet = kLocal_GrCoordSet) {
-        return Create(tex, gMitchellCoefficients, matrix, p, coordSet);
+                               SkShader::TileMode tileModes[2]) {
+        return Create(tex, gMitchellCoefficients, matrix, tileModes);
+    }
+
+    /**
+     * The most general Create method. This allows specification of the bicubic coefficients, the
+     * texture matrix, and the x/y tilemodes.
+     */
+    static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16],
+                               const SkMatrix& matrix,
+                               const SkShader::TileMode tileModes[2]) {
+        AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients, matrix, tileModes)));
+        return CreateEffectRef(effect);
     }
 
 private:
-    GrBicubicEffect(GrTexture*, const SkScalar coefficients[16]);
     GrBicubicEffect(GrTexture*, const SkScalar coefficients[16],
-                    const SkMatrix &matrix, const GrTextureParams &p, GrCoordSet coordSet);
+                    const SkMatrix &matrix, const SkShader::TileMode tileModes[2]);
     virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE;
     float    fCoefficients[16];