fix(images): it seems that memory leak of images has been fixed

closes #323
This commit is contained in:
hyb1996 2018-03-30 12:48:09 +08:00
parent 61ba5dbed5
commit 47faa1f69e

View File

@ -76,7 +76,7 @@ public class ImageWrapper {
int rowPadding = plane.getRowStride() - pixelStride * image.getWidth();
Bitmap bitmap = Bitmap.createBitmap(image.getWidth() + rowPadding / pixelStride, image.getHeight(), Bitmap.Config.ARGB_8888);
bitmap.copyPixelsFromBuffer(buffer);
if(rowPadding == 0){
if (rowPadding == 0) {
return bitmap;
}
return Bitmap.createBitmap(bitmap, 0, 0, image.getWidth(), image.getHeight());
@ -133,4 +133,13 @@ public class ImageWrapper {
}
}
@Override
protected void finalize() throws Throwable {
try {
recycle();
} finally {
super.finalize();
}
}
}