Tweaks in how to apply bitmap filter levels in GPU.
Fix fallback to MIP from bicubic for bitmap shaders
Skip MIP level generation on GPU when not minifying
Add medium quality and mixed up/down matrix test cases to filterbitmap tests
R=robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/103913012
git-svn-id: http://skia.googlecode.com/svn/trunk@12697 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index a0692d0..71d0ebf 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1204,9 +1204,14 @@
break;
case SkPaint::kMedium_FilterLevel:
tileFilterPad = 1;
- textureFilterMode = GrTextureParams::kMipMap_FilterMode;
+ if (fContext->getMatrix().getMinStretch() < SK_Scalar1) {
+ textureFilterMode = GrTextureParams::kMipMap_FilterMode;
+ } else {
+ // Don't trigger MIP level generation unnecessarily.
+ textureFilterMode = GrTextureParams::kBilerp_FilterMode;
+ }
break;
- case SkPaint::kHigh_FilterLevel: {
+ case SkPaint::kHigh_FilterLevel:
// Minification can look bad with the bicubic effect.
if (fContext->getMatrix().getMinStretch() >= SK_Scalar1) {
// We will install an effect that does the filtering in the shader.
@@ -1214,13 +1219,10 @@
tileFilterPad = GrBicubicEffect::kFilterTexelPad;
doBicubic = true;
} else {
- // We don't yet support doing bicubic filtering with an interior clamp. Fall back
- // to MIPs
textureFilterMode = GrTextureParams::kMipMap_FilterMode;
tileFilterPad = 1;
}
break;
- }
default:
SkErrorInternals::SetError( kInvalidPaint_SkError,
"Sorry, I don't understand the filtering "