From daaeb912aa17e458fed4db16f951b2608ec692ad Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Thu, 18 Aug 2016 15:52:20 +0200 Subject: [PATCH] Bug 1290014 - ResizingProcessor: Do not resize icons loaded from memory. r=ahunt,Grisha Icons loaded from memory have already gone through the resizing process and have either the requested size or are resized up to a limit. Without this check a small icon could be resized multiple times until it matches the target size; even though the icon is too small. In addition to that we would recycle a bitmap that might still be in use. MozReview-Commit-ID: K51aBhBcAnj --HG-- extra : rebase_source : 771c0a88b69e5d3688293ddf27955e01717c8931 --- .../mozilla/gecko/icons/processing/ResizingProcessor.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mobile/android/base/java/org/mozilla/gecko/icons/processing/ResizingProcessor.java b/mobile/android/base/java/org/mozilla/gecko/icons/processing/ResizingProcessor.java index ba1e9247d788..63b4790219a0 100644 --- a/mobile/android/base/java/org/mozilla/gecko/icons/processing/ResizingProcessor.java +++ b/mobile/android/base/java/org/mozilla/gecko/icons/processing/ResizingProcessor.java @@ -17,6 +17,12 @@ import org.mozilla.gecko.icons.IconResponse; public class ResizingProcessor implements Processor { @Override public void process(IconRequest request, IconResponse response) { + if (response.isFromMemory()) { + // This bitmap has been loaded from memory, so it has already gone through the resizing + // process. We do not want to resize the image every time we hit the memory cache. + return; + } + final Bitmap originalBitmap = response.getBitmap(); final int size = originalBitmap.getWidth();