Chromium Code Reviews| Index: src/gpu/effects/GrBicubicEffect.cpp |
| diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp |
| index 89124ff66765f59547dc20899a32e161b182daac..437aba671e2a366aa6394dee87fd791c21ce6095 100644 |
| --- a/src/gpu/effects/GrBicubicEffect.cpp |
| +++ b/src/gpu/effects/GrBicubicEffect.cpp |
| @@ -177,3 +177,30 @@ GrEffectRef* GrBicubicEffect::TestCreate(SkRandom* random, |
| } |
| return GrBicubicEffect::Create(textures[texIdx], coefficients); |
| } |
| + |
| +////////////////////////////////////////////////////////////////////////////// |
| + |
| +bool GrBicubicEffect::ShouldUseBicubic(const SkMatrix& matrix, |
| + GrTextureParams::FilterMode* filterMode) { |
| + if (matrix.isIdentity()) { |
| + *filterMode = GrTextureParams::kNone_FilterMode; |
| + return false; |
| + } |
| + |
| + SkScalar scales[2]; |
| + if (!matrix.getScaleFactors(scales) || scales[0] < SK_Scalar1) { |
|
robertphillips
2014/05/20 15:34:50
// b.c. the min scale factor is causing we will us
bsalomon
2014/05/20 16:13:06
Done.
|
| + *filterMode = GrTextureParams::kMipMap_FilterMode; |
| + return false; |
| + } |
|
robertphillips
2014/05/20 15:34:50
scales ?
bsalomon
2014/05/20 16:13:06
Done.
|
| + // At this point if sacles[1] == SK_Scalar1 then the matrix doesn't do any scaling. |
| + if (scales[1] == SK_Scalar1) { |
| + if (matrix.rectStaysRect() && SkScalarIsInt(matrix.getTranslateX()) && |
| + SkScalarIsInt(matrix.getTranslateY())) { |
| + *filterMode = GrTextureParams::kNone_FilterMode; |
| + } else { |
| + *filterMode = GrTextureParams::kBilerp_FilterMode; |
|
robertphillips
2014/05/20 15:34:50
// need bilerp in this case to handle the fraction
bsalomon
2014/05/20 16:13:06
Done.
|
| + } |
| + return false; |
| + } |
| + return true; |
| +} |