Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe28ef84 authored by Romain Guy's avatar Romain Guy
Browse files

Never resize a Bitmap down to 0 at load time

Bug #8313929

Change-Id: Ic9b691319f162228c72ad1afed4dfe0b4181c422
parent 19d4dd85
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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) {