Index: src/core/SkBitmapProcShader.cpp |
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp |
index 3ac26f0a1986a0c523e32c2de1c28f197d3a2c73..cf0da5bfba058f4bd9c4cec6bd71733a651883bc 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; |
@@ -429,28 +418,30 @@ GrEffectRef* SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& |
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; |
robertphillips
2014/05/20 15:34:50
Indent on this '}'?
bsalomon
2014/05/20 16:13:06
Done.
|
- 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. |
+ } |
+ case SkPaint::kHigh_FilterLevel: { |
+ SkMatrix matrix; |
+ matrix.setConcat(context->getMatrix(), this->getLocalMatrix()); |
+ GrBicubicEffect::ShouldUseBicubic(matrix, &textureFilterMode); |
+ if (GrTextureParams::kNone_FilterMode == textureFilterMode) { |
robertphillips
2014/05/20 15:34:50
Why not textureFilterMode ?
bsalomon
2014/05/20 16:13:06
It is now always set by ShouldUseBicubic.
|
+ paintFilterLevel = SkPaint::kNone_FilterLevel; |
+ } else if (GrTextureParams::kBilerp_FilterMode == textureFilterMode) { |
+ paintFilterLevel = SkPaint::kLow_FilterLevel; |
+ } else if (GrTextureParams::kMipMap_FilterMode == textureFilterMode) { |
paintFilterLevel = SkPaint::kMedium_FilterLevel; |
- textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
} |
break; |
+ } |
default: |
SkErrorInternals::SetError( kInvalidPaint_SkError, |
"Sorry, I don't understand the filtering " |