Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -325,18 +325,6 @@ private Bitmap cropAndResize(
// Loading large bitmaps efficiently:
// http://developer.android.com/training/displaying-bitmaps/load-bitmap.html

// Just decode the dimensions
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
InputStream inputStream = openBitmapInputStream();
try {
BitmapFactory.decodeStream(inputStream, null, options);
} finally {
if (inputStream != null) {
inputStream.close();
}
}

// This uses scaling mode COVER

// Where would the crop rect end up within the scaled bitmap?
Expand All @@ -362,8 +350,7 @@ private Bitmap cropAndResize(
// Decode the bitmap. We have to open the stream again, like in the example linked above.
// Is there a way to just continue reading from the stream?
outOptions.inSampleSize = getDecodeSampleSize(mWidth, mHeight, targetWidth, targetHeight);
options.inJustDecodeBounds = false;
inputStream = openBitmapInputStream();
InputStream inputStream = openBitmapInputStream();

Bitmap bitmap;
try {
Expand Down