From e420861151fb79bf718e56d9f06a9e4f9acf2cbd Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Fri, 5 Jun 2015 10:38:54 -0700 Subject: [PATCH] decode bitmaps as RGB565 cuts decoding memory in half Closes #3350 // FREEBIE --- src/org/thoughtcrime/securesms/util/BitmapUtil.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/org/thoughtcrime/securesms/util/BitmapUtil.java b/src/org/thoughtcrime/securesms/util/BitmapUtil.java index 9a9221958e..74c9f5f797 100644 --- a/src/org/thoughtcrime/securesms/util/BitmapUtil.java +++ b/src/org/thoughtcrime/securesms/util/BitmapUtil.java @@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.util; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; +import android.graphics.Bitmap.Config; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; @@ -135,6 +136,7 @@ public class BitmapUtil { options.inSampleSize = getScaleFactor(imageWidth, imageHeight, maxWidth, maxHeight, constrainedMemory); options.inJustDecodeBounds = false; + options.inPreferredConfig = constrainedMemory ? Config.RGB_565 : Config.ARGB_8888; InputStream is = new BufferedInputStream(data); Bitmap roughThumbnail = BitmapFactory.decodeStream(is, null, options);