Index: src/core/SkMipMap.cpp |
diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipMap.cpp |
index 14e87a33a3ba996e362dc1ed3cba6c164d08b5cf..c037865fd49b3f25c555a1eb19d5aa217cd8c6bb 100644 |
--- a/src/core/SkMipMap.cpp |
+++ b/src/core/SkMipMap.cpp |
@@ -297,7 +297,13 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact) { |
rowBytes = SkToU32(SkColorTypeMinRowBytes(ct, width)); |
levels[i].fPixmap = SkPixmap(SkImageInfo::Make(width, height, ct, at), addr, rowBytes); |
- levels[i].fScale = (float)width / src.width(); |
+#ifdef SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAPS |
+ levels[i].fScale = SkSize::Make(SkIntToScalar(width) / src.width(), |
+ SkIntToScalar(width) / src.width()); |
+#else |
+ levels[i].fScale = SkSize::Make(SkIntToScalar(width) / src.width(), |
+ SkIntToScalar(height) / src.height()); |
+#endif |
const SkPixmap& dstPM = levels[i].fPixmap; |
const void* srcBasePtr = srcPM.addr(); |