Chromium Code Reviews| Index: src/core/SkBitmapProcShader.cpp |
| diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp |
| index ded1b7200938bb97a9d6dbe94d0eccc50f213408..fcfcdbf035875dbe1bfb11762df8a9472c8e6ec3 100644 |
| --- a/src/core/SkBitmapProcShader.cpp |
| +++ b/src/core/SkBitmapProcShader.cpp |
| @@ -358,13 +358,12 @@ GrEffectRef* SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& |
| SkMatrix matrix; |
| matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height()); |
|
robertphillips
2013/12/04 23:31:55
Why remove this stuff?
bsalomon
2013/12/09 18:44:31
It's from when SkShader lazily allocated and store
|
| - if (this->hasLocalMatrix()) { |
| - SkMatrix inverse; |
| - if (!this->getLocalMatrix().invert(&inverse)) { |
| - return NULL; |
| - } |
| - matrix.preConcat(inverse); |
| + SkMatrix inverse; |
| + if (!this->getLocalMatrix().invert(&inverse)) { |
| + return NULL; |
| } |
| + matrix.preConcat(inverse); |
| + |
| SkShader::TileMode tm[] = { |
| (TileMode)fState.fTileModeX, |
| (TileMode)fState.fTileModeY, |
| @@ -384,9 +383,21 @@ GrEffectRef* SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& |
| textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
| break; |
| case SkPaint::kHigh_FilterLevel: |
| - // fall back to no filtering here; we will install another |
| - // shader that will do the HQ filtering. |
| - textureFilterMode = GrTextureParams::kNone_FilterMode; |
| + // Minification can look bad with the bicubic effect. This is an overly aggressive |
| + // check for MIP fallbacks. It doesn't consider the fact that minification in the local |
| + // matrix could be offset by the view matrix and vice versa. We also don't know whether |
| + // the draw has explicit local coords (e.g. drawVertices) where the scale factor is |
| + // unknown and varies. |
| + if (context->getMatrix().getMinStretch() >= SK_Scalar1 && |
| + this->getLocalMatrix().getMaxStretch() <= 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; |
| + } |
| break; |
| default: |
| SkErrorInternals::SetError( kInvalidPaint_SkError, |