Do not use GrBicubic effect when downscaling. Also, don't use glTexStorage as it interferes with deleyed mipmap generation.
R=robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/105353002
git-svn-id: http://skia.googlecode.com/svn/trunk@12576 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 2555b41..f45572b 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1194,8 +1194,10 @@
tileFilterPad = 1;
textureFilterMode = GrTextureParams::kMipMap_FilterMode;
break;
- case SkPaint::kHigh_FilterLevel:
- if (flags & SkCanvas::kBleed_DrawBitmapRectFlag) {
+ case SkPaint::kHigh_FilterLevel: {
+ // Minification can look bad with the bicubic effect.
+ if (fContext->getMatrix().getMinStretch() >= SK_Scalar1 &&
+ (flags & SkCanvas::kBleed_DrawBitmapRectFlag)) {
// We will install an effect that does the filtering in the shader.
textureFilterMode = GrTextureParams::kNone_FilterMode;
tileFilterPad = GrBicubicEffect::kFilterTexelPad;
@@ -1207,6 +1209,7 @@
tileFilterPad = 1;
}
break;
+ }
default:
SkErrorInternals::SetError( kInvalidPaint_SkError,
"Sorry, I don't understand the filtering "
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 00d27b3..4b5221c 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -552,7 +552,12 @@
SkAutoSMalloc<128 * 128> tempStorage;
// paletted textures cannot be partially updated
- bool useTexStorage = isNewTexture &&
+ // We currently lazily create MIPMAPs when the we see a draw with
+ // GrTextureParams::kMipMap_FilterMode. Using texture storage requires that the
+ // MIP levels are all created when the texture is created. So for now we don't use
+ // texture storage.
+ bool useTexStorage = false &&
+ isNewTexture &&
desc.fConfig != kIndex_8_GrPixelConfig &&
this->glCaps().texStorageSupport();
@@ -638,8 +643,7 @@
desc.fWidth == width && desc.fHeight == height) {
CLEAR_ERROR_BEFORE_ALLOC(this->glInterface());
if (useTexStorage) {
- // We never resize or change formats of textures. We don't use
- // mipmaps currently.
+ // We never resize or change formats of textures.
GL_ALLOC_CALL(this->glInterface(),
TexStorage2D(GR_GL_TEXTURE_2D,
1, // levels