decode bitmaps as RGB565

cuts decoding memory in half

Closes #3350
// FREEBIE
This commit is contained in:
Jake McGinty 2015-06-05 10:38:54 -07:00 committed by Moxie Marlinspike
parent 155cbf686d
commit e420861151

View File

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