package com.bytedance.fresco.nativeheif;

import android.graphics.Bitmap;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import java.nio.ByteBuffer;

public class HeifData {
    public final byte[] data;
    public final int height;
    public final int width;

    static {
        Covode.recordClassIndex(26369);
    }

    public Bitmap newBitmap(Bitmap.Config config) {
        MethodCollector.i(17431);
        byte[] bArr = this.data;
        if (bArr == null || bArr.length <= 0 || this.width <= 0 || this.height <= 0) {
            MethodCollector.o(17431);
            return null;
        }
        if (config == null) {
            config = Bitmap.Config.ARGB_8888;
        }
        Bitmap createBitmap = Bitmap.createBitmap(this.width, this.height, config);
        createBitmap.copyPixelsFromBuffer(ByteBuffer.wrap(this.data));
        MethodCollector.o(17431);
        return createBitmap;
    }

    public HeifData(byte[] bArr, int i, int i2) {
        this.data = bArr;
        this.width = i;
        this.height = i2;
    }
}
