Loading media/java/android/media/videoeditor/MediaImageItem.java +18 −9 Original line number Diff line number Diff line Loading @@ -154,7 +154,7 @@ public class MediaImageItem extends MediaItem { final Bitmap imageBitmap; if (mHeight > maxResolution.second) { if (mWidth > maxResolution.first || mHeight > maxResolution.second) { /** * We need to scale the image */ Loading Loading @@ -971,14 +971,13 @@ public class MediaImageItem extends MediaItem { /** * Create the bitmap from file */ if (nativeWidth / bitmapWidth > 1) { int sampleSize = (int) Math.ceil(Math.max( (float) nativeWidth / bitmapWidth, (float) nativeHeight / bitmapHeight)); sampleSize = nextPowerOf2(sampleSize); final BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = nativeWidth / (int)bitmapWidth; options.inSampleSize = sampleSize; srcBitmap = BitmapFactory.decodeFile(filename, options); } else { srcBitmap = BitmapFactory.decodeFile(filename); } } else { bitmapWidth = width; bitmapHeight = height; Loading Loading @@ -1009,4 +1008,14 @@ public class MediaImageItem extends MediaItem { srcBitmap.recycle(); return bitmap; } public static int nextPowerOf2(int n) { n -= 1; n |= n >>> 16; n |= n >>> 8; n |= n >>> 4; n |= n >>> 2; n |= n >>> 1; return n + 1; } } Loading
media/java/android/media/videoeditor/MediaImageItem.java +18 −9 Original line number Diff line number Diff line Loading @@ -154,7 +154,7 @@ public class MediaImageItem extends MediaItem { final Bitmap imageBitmap; if (mHeight > maxResolution.second) { if (mWidth > maxResolution.first || mHeight > maxResolution.second) { /** * We need to scale the image */ Loading Loading @@ -971,14 +971,13 @@ public class MediaImageItem extends MediaItem { /** * Create the bitmap from file */ if (nativeWidth / bitmapWidth > 1) { int sampleSize = (int) Math.ceil(Math.max( (float) nativeWidth / bitmapWidth, (float) nativeHeight / bitmapHeight)); sampleSize = nextPowerOf2(sampleSize); final BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = nativeWidth / (int)bitmapWidth; options.inSampleSize = sampleSize; srcBitmap = BitmapFactory.decodeFile(filename, options); } else { srcBitmap = BitmapFactory.decodeFile(filename); } } else { bitmapWidth = width; bitmapHeight = height; Loading Loading @@ -1009,4 +1008,14 @@ public class MediaImageItem extends MediaItem { srcBitmap.recycle(); return bitmap; } public static int nextPowerOf2(int n) { n -= 1; n |= n >>> 16; n |= n >>> 8; n |= n >>> 4; n |= n >>> 2; n |= n >>> 1; return n + 1; } }