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

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

Assume ARGB_8888 for unknown configs.

Bug #3327175

Change-Id: If712a255ec65014cd2e007de1e4c6a1d67c19250
parent f6a362a5
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -464,8 +464,24 @@ public final class Bitmap implements Parcelable {
        Rect srcR = new Rect(x, y, x + width, y + height);
        RectF dstR = new RectF(0, 0, width, height);

        final Config newConfig = source.getConfig() == Config.ARGB_8888 ||
                source.getConfig() == Config.ARGB_4444 ? Config.ARGB_8888 : Config.RGB_565;
        Config newConfig = Config.ARGB_8888;
        final Config config = source.getConfig();
        // GIF files generate null configs, assume ARGB_8888
        if (config != null) {
            switch (config) {
                case RGB_565:
                    newConfig = Config.RGB_565;
                    break;
                case ALPHA_8:
                    newConfig = Config.ALPHA_8;
                    break;
                case ARGB_4444:
                case ARGB_8888:
                default:
                    newConfig = Config.ARGB_8888;
                    break;
            }
        }

        if (m == null || m.isIdentity()) {
            bitmap = createBitmap(neww, newh, newConfig, source.hasAlpha());