mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 709103 - Optimize creating and saving thumbnail bitmaps (OOM fix) r=kats a=java-only
This commit is contained in:
parent
961a907049
commit
f960360d53
@ -142,10 +142,15 @@ public class Tab {
|
||||
sMinDim = Math.min(metrics.widthPixels, metrics.heightPixels);
|
||||
}
|
||||
if (b != null) {
|
||||
Bitmap cropped = Bitmap.createBitmap(b, 0, 0, sMinDim, sMinDim);
|
||||
Bitmap bitmap = Bitmap.createScaledBitmap(cropped, kThumbnailSize, kThumbnailSize, false);
|
||||
mThumbnail = new BitmapDrawable(bitmap);
|
||||
saveThumbnailToDB((BitmapDrawable) mThumbnail);
|
||||
try {
|
||||
Bitmap cropped = Bitmap.createBitmap(b, 0, 0, sMinDim, sMinDim);
|
||||
Bitmap bitmap = Bitmap.createScaledBitmap(cropped, kThumbnailSize, kThumbnailSize, false);
|
||||
mThumbnail = new BitmapDrawable(bitmap);
|
||||
saveThumbnailToDB((BitmapDrawable) mThumbnail);
|
||||
} catch (OutOfMemoryError oom) {
|
||||
Log.e(LOGTAG, "Unable to create/scale bitmap", oom);
|
||||
mThumbnail = null;
|
||||
}
|
||||
} else {
|
||||
mThumbnail = null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user