diff options
author | fmalita <fmalita@chromium.org> | 2016-02-17 06:17:12 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-17 06:17:12 -0800 |
commit | d10f5b3ac90322071b40e62fb585644ddd767223 (patch) | |
tree | 7146a497dba94df4d0aa008daead298c92a6e046 /src | |
parent | 879adccf60eade3b4023c95930d21c67f8f79e97 (diff) |
Use geometric mean when selecting a mipmap scale
Workaround for anisotropic mipmap quality issues.
R=reed@google.com,robertphillips@google.com
BUG=skia:4863,chromium:586894
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1697423002
Review URL: https://codereview.chromium.org/1697423002
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkMipMap.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipMap.cpp index 7266dc6b21..1f69c2411b 100644 --- a/src/core/SkMipMap.cpp +++ b/src/core/SkMipMap.cpp @@ -326,8 +326,16 @@ bool SkMipMap::extractLevel(const SkSize& scaleSize, Level* levelPtr) const { } SkASSERT(scaleSize.width() >= 0 && scaleSize.height() >= 0); + +#ifndef SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAP_SCALE // Use the smallest scale to match the GPU impl. const SkScalar scale = SkTMin(scaleSize.width(), scaleSize.height()); +#else + // Ideally we'd pick the smaller scale, to match Ganesh. But ignoring one of the + // scales can produce some atrocious results, so for now we use the geometric mean. + // (https://bugs.chromium.org/p/skia/issues/detail?id=4863) + const SkScalar scale = SkScalarSqrt(scaleSize.width() * scaleSize.height()); +#endif if (scale >= SK_Scalar1 || scale <= 0 || !SkScalarIsFinite(scale)) { return false; |