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

Unified Diff: src/core/SkMipMap.cpp

Issue 856783004: Revert of use log2(scale) to compute mip level (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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 | « include/core/SkScalar.h ('k') | no next file » | 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 2dad6d9c579515be374a03966c433f9d59522ff8..83164b15267e0169754ddfd5d7848093ba078e6b 100644
--- a/src/core/SkMipMap.cpp
+++ b/src/core/SkMipMap.cpp
@@ -225,7 +225,8 @@
///////////////////////////////////////////////////////////////////////////////
-#ifdef SK_SUPPORT_LEGACY_MIPLEVELCHOICE
+//static int gCounter;
+
static SkFixed compute_level(SkScalar scale) {
SkScalar inv = SkScalarAbs(SkScalarInvert(scale));
if (inv > 32767) { // Watch out for SkFixed overflow.
@@ -240,29 +241,17 @@
SkASSERT(clz >= 1 && clz <= 15);
return SkIntToFixed(15 - clz) + ((unsigned)(s << (clz + 1)) >> 16);
}
-#endif
bool SkMipMap::extractLevel(SkScalar scale, Level* levelPtr) const {
if (NULL == fLevels) {
return false;
}
- if (scale >= SK_Scalar1 || scale <= 0 || !SkScalarIsFinite(scale)) {
+ if (scale >= SK_Scalar1) {
return false;
}
-#ifdef SK_SUPPORT_LEGACY_MIPLEVELCHOICE
int level = compute_level(scale) >> 16;
-#else
- SkScalar L = -SkScalarLog2(scale);
- if (!SkScalarIsFinite(L)) {
- return false;
- }
- SkASSERT(L >= 0);
- int level = SkScalarRoundToInt(L);
-// SkDebugf("mipmap scale=%g L=%g level=%d\n", scale, L, level);
-#endif
-
SkASSERT(level >= 0);
if (level <= 0) {
return false;
« no previous file with comments | « include/core/SkScalar.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698