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

Commit 04ae94e7 authored by Jerome Gaillard's avatar Jerome Gaillard Committed by Android (Google) Code Review
Browse files

Merge "Implement delegate for new native method from Bitmap"

parents accc1553 9758e22d
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ public final class Bitmap_Delegate {


    public enum BitmapCreateFlags {
        PREMULTIPLIED, MUTABLE
        NONE, PREMULTIPLIED, MUTABLE
    }

    // ---- delegate manager ----
@@ -616,6 +616,26 @@ public final class Bitmap_Delegate {
        // do nothing as Bitmap_Delegate does not have caches
    }

    @LayoutlibDelegate
    /*package*/ static Bitmap nativeCopyPreserveInternalConfig(long nativeBitmap) {
        Bitmap_Delegate srcBmpDelegate = sManager.getDelegate(nativeBitmap);
        if (srcBmpDelegate == null) {
            return null;
        }

        BufferedImage srcImage = srcBmpDelegate.getImage();

        // create the image
        BufferedImage image = new BufferedImage(srcImage.getColorModel(), srcImage.copyData(null),
                srcImage.isAlphaPremultiplied(), null);

        // create a delegate with the content of the stream.
        Bitmap_Delegate delegate = new Bitmap_Delegate(image, srcBmpDelegate.getConfig());

        return createBitmap(delegate, EnumSet.of(BitmapCreateFlags.NONE),
                Bitmap.getDefaultDensity());
    }

    // ---- Private delegate/helper methods ----

    private Bitmap_Delegate(BufferedImage image, Config config) {