Bug 1254663 - Approach 2: scale all favicons to the same size before caching r?sebastian
This is equivalent to the previous 2 commits: instead of scaling favicons later,
we can enlarge smaller icons here, resulting in all favicons being displayed at
the same size in the rest of the UI. When retrieving favicons we always push them
into the cache, and then fetch them from the cache to display them, hence this
works for now (but this is also liable to break if we ever change to only fetch
from the cache on later loads, and use the fetched icon directly on first load).
MozReview-Commit-ID: AN5wEOMjRYV
--- a/mobile/android/base/java/org/mozilla/gecko/favicons/cache/FaviconCache.java
+++ b/mobile/android/base/java/org/mozilla/gecko/favicons/cache/FaviconCache.java
@@ -431,17 +431,17 @@ public class FaviconCache {
// Never cache the default Favicon, or the null Favicon.
if (favicon == Favicons.defaultFavicon || favicon == null) {
return null;
}
// Some sites serve up insanely huge Favicons (Seen 512x512 ones...)
// While we want to cache nice big icons, we apply a limit based on screen density for the
// sake of space.
- if (favicon.getWidth() > maxCachedWidth) {
+ if (favicon.getWidth() != maxCachedWidth) {
return Bitmap.createScaledBitmap(favicon, maxCachedWidth, maxCachedWidth, true);
}
return favicon;
}
/**
* Set an existing element as the most recently used element. Intended for use from read transactions. While