Loading tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java +21 −1 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ public final class Bitmap_Delegate { public enum BitmapCreateFlags { PREMULTIPLIED, MUTABLE NONE, PREMULTIPLIED, MUTABLE } // ---- delegate manager ---- Loading Loading @@ -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) { Loading Loading
tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java +21 −1 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ public final class Bitmap_Delegate { public enum BitmapCreateFlags { PREMULTIPLIED, MUTABLE NONE, PREMULTIPLIED, MUTABLE } // ---- delegate manager ---- Loading Loading @@ -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) { Loading