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
This commit is contained in:
Sebastian Kaspari 2016-08-18 15:52:20 +02:00
parent b05071f783
commit daaeb912aa

View File

@ -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();