Index: src/core/SkMipMap.cpp |
diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipMap.cpp |
index 7266dc6b21192c16019c0277ea4387244033d209..a3a51245eed5223cb1e1e4ef49fb9a466e2760cc 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); |
+ |
+#ifdef SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAPS |
// Use the smallest scale to match the GPU impl. |
- const SkScalar scale = SkTMin(scaleSize.width(), scaleSize.height()); |
+ const SkScalar scale = (scaleSize.width() + scaleSize.height()) / 2; |
+#else |
+ // For an anisotropic scale S(scaleX, scaleY), the ideal mipmap scale M(k, k) |
+ // minimizes the distance d(S, M). This is equivalent to picking M as the |
+ // projection of S on the diagonal line. |
+ const SkScalar scale = (scaleSize.width() + scaleSize.height()) / 2; |
+#endif |
if (scale >= SK_Scalar1 || scale <= 0 || !SkScalarIsFinite(scale)) { |
f(malita)
2016/02/16 17:31:59
Q: what should we do when the average > 1? We're
|
return false; |