Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Unified Diff: src/core/SkBitmapProcShader.cpp

Issue 105353002: Do not use GrBicubic effect when downscaling. Also, don't use glTexStorage as it interferes with de… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address comments Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkMatrix.h ('k') | src/core/SkMatrix.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
- 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,
« no previous file with comments | « include/core/SkMatrix.h ('k') | src/core/SkMatrix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698