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

Unified Diff: src/core/SkMipMap.cpp

Issue 1686563002: Relocate anisotropic mipmap logic to SkMipMap::extractLevel() (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months 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 | « src/core/SkMipMap.h ('k') | tests/MipMapTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMipMap.cpp
diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipMap.cpp
index 08602b7e00728b100d78862f76288a6afd4770f1..7266dc6b21192c16019c0277ea4387244033d209 100644
--- a/src/core/SkMipMap.cpp
+++ b/src/core/SkMipMap.cpp
@@ -320,11 +320,15 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact) {
///////////////////////////////////////////////////////////////////////////////
-bool SkMipMap::extractLevel(SkScalar scale, Level* levelPtr) const {
+bool SkMipMap::extractLevel(const SkSize& scaleSize, Level* levelPtr) const {
if (nullptr == fLevels) {
return false;
}
+ SkASSERT(scaleSize.width() >= 0 && scaleSize.height() >= 0);
+ // Use the smallest scale to match the GPU impl.
+ const SkScalar scale = SkTMin(scaleSize.width(), scaleSize.height());
+
if (scale >= SK_Scalar1 || scale <= 0 || !SkScalarIsFinite(scale)) {
return false;
}
« no previous file with comments | « src/core/SkMipMap.h ('k') | tests/MipMapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698