Never resize a Bitmap down to 0 at load time
Bug #8313929 Change-Id: Ic9b691319f162228c72ad1afed4dfe0b4181c422
This commit is contained in:
@@ -566,8 +566,9 @@ public class BitmapFactory {
|
||||
float scale = targetDensity / (float) density;
|
||||
if (scale != 1.0f) {
|
||||
final Bitmap oldBitmap = bm;
|
||||
bm = Bitmap.createScaledBitmap(oldBitmap, (int) (bm.getWidth() * scale + 0.5f),
|
||||
(int) (bm.getHeight() * scale + 0.5f), true);
|
||||
bm = Bitmap.createScaledBitmap(oldBitmap,
|
||||
Math.max(1, (int) (bm.getWidth() * scale + 0.5f)),
|
||||
Math.max(1, (int) (bm.getHeight() * scale + 0.5f)), true);
|
||||
if (bm != oldBitmap) oldBitmap.recycle();
|
||||
|
||||
if (isNinePatch) {
|
||||
|
||||
Reference in New Issue
Block a user