| Index: src/core/SkBitmapProcShader.cpp
|
| diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
|
| index 3ac26f0a1986a0c523e32c2de1c28f197d3a2c73..8e25530cee5dabe85cbfde36638fc0fe84533096 100644
|
| --- a/src/core/SkBitmapProcShader.cpp
|
| +++ b/src/core/SkBitmapProcShader.cpp
|
| @@ -382,17 +382,6 @@ void SkBitmapProcShader::toString(SkString* str) const {
|
| #include "effects/GrSimpleTextureEffect.h"
|
| #include "SkGr.h"
|
|
|
| -// Note that this will return -1 if either matrix is perspective.
|
| -static SkScalar get_combined_min_stretch(const SkMatrix& viewMatrix, const SkMatrix& localMatrix) {
|
| - if (localMatrix.isIdentity()) {
|
| - return viewMatrix.getMinScale();
|
| - } else {
|
| - SkMatrix combined;
|
| - combined.setConcat(viewMatrix, localMatrix);
|
| - return combined.getMinScale();
|
| - }
|
| -}
|
| -
|
| GrEffectRef* SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& paint,
|
| const SkMatrix* localMatrix) const {
|
| SkMatrix matrix;
|
| @@ -420,37 +409,32 @@ GrEffectRef* SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint&
|
| // we check the matrix scale factors to determine how to interpret the filter quality setting.
|
| // This completely ignores the complexity of the drawVertices case where explicit local coords
|
| // are provided by the caller.
|
| - SkPaint::FilterLevel paintFilterLevel = paint.getFilterLevel();
|
| + bool useBicubic = false;
|
| GrTextureParams::FilterMode textureFilterMode;
|
| - switch(paintFilterLevel) {
|
| + switch(paint.getFilterLevel()) {
|
| case SkPaint::kNone_FilterLevel:
|
| textureFilterMode = GrTextureParams::kNone_FilterMode;
|
| break;
|
| case SkPaint::kLow_FilterLevel:
|
| textureFilterMode = GrTextureParams::kBilerp_FilterMode;
|
| break;
|
| - case SkPaint::kMedium_FilterLevel:
|
| - if (get_combined_min_stretch(context->getMatrix(), this->getLocalMatrix()) <
|
| - SK_Scalar1) {
|
| + case SkPaint::kMedium_FilterLevel: {
|
| + SkMatrix matrix;
|
| + matrix.setConcat(context->getMatrix(), this->getLocalMatrix());
|
| + if (matrix.getMinScale() < SK_Scalar1) {
|
| textureFilterMode = GrTextureParams::kMipMap_FilterMode;
|
| } else {
|
| // Don't trigger MIP level generation unnecessarily.
|
| textureFilterMode = GrTextureParams::kBilerp_FilterMode;
|
| }
|
| break;
|
| - case SkPaint::kHigh_FilterLevel:
|
| - // Minification can look bad with bicubic filtering.
|
| - if (get_combined_min_stretch(context->getMatrix(), this->getLocalMatrix()) >=
|
| - SK_Scalar1) {
|
| - // fall back to no filtering here; we will install another shader that will do the
|
| - // HQ filtering.
|
| - textureFilterMode = GrTextureParams::kNone_FilterMode;
|
| - } else {
|
| - // Fall back to MIP-mapping.
|
| - paintFilterLevel = SkPaint::kMedium_FilterLevel;
|
| - textureFilterMode = GrTextureParams::kMipMap_FilterMode;
|
| - }
|
| + }
|
| + case SkPaint::kHigh_FilterLevel: {
|
| + SkMatrix matrix;
|
| + matrix.setConcat(context->getMatrix(), this->getLocalMatrix());
|
| + useBicubic = GrBicubicEffect::ShouldUseBicubic(matrix, &textureFilterMode);
|
| break;
|
| + }
|
| default:
|
| SkErrorInternals::SetError( kInvalidPaint_SkError,
|
| "Sorry, I don't understand the filtering "
|
| @@ -470,7 +454,7 @@ GrEffectRef* SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint&
|
| }
|
|
|
| GrEffectRef* effect = NULL;
|
| - if (paintFilterLevel == SkPaint::kHigh_FilterLevel) {
|
| + if (useBicubic) {
|
| effect = GrBicubicEffect::Create(texture, matrix, tm);
|
| } else {
|
| effect = GrSimpleTextureEffect::Create(texture, matrix, params);
|
|
|