diff options
author | Riley Andrews <riandrews@google.com> | 2015-05-11 16:08:22 -0700 |
---|---|---|
committer | Riley Andrews <riandrews@google.com> | 2015-05-18 19:55:39 +0000 |
commit | 721ae5fec5f1fd4f93aa2a361a0ac298e15ce353 (patch) | |
tree | c331ac3a8453867756de6e456c9624d84d27bbae /graphics | |
parent | 39d7f30ebe490c1d6aee76b0b61e3e67dec13e34 (diff) | |
download | frameworks_base-721ae5fec5f1fd4f93aa2a361a0ac298e15ce353.zip frameworks_base-721ae5fec5f1fd4f93aa2a361a0ac298e15ce353.tar.gz frameworks_base-721ae5fec5f1fd4f93aa2a361a0ac298e15ce353.tar.bz2 |
Add internal bitmap api for creating immutable ashmem backed bitmaps.
Bug 21037890
Change-Id: I827e83dd75e301e7d93ead5efdd744f0d8435ae5
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/Bitmap.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java index 2d8b0b2..a999b71 100644 --- a/graphics/java/android/graphics/Bitmap.java +++ b/graphics/java/android/graphics/Bitmap.java @@ -558,6 +558,22 @@ public final class Bitmap implements Parcelable { } /** + * Creates a new immutable bitmap backed by ashmem which can efficiently + * be passed between processes. + * + * @hide + */ + public Bitmap createAshmemBitmap() { + checkRecycled("Can't copy a recycled bitmap"); + Bitmap b = nativeCopyAshmem(mFinalizer.mNativeBitmap); + if (b != null) { + b.setPremultiplied(mRequestPremultiplied); + b.mDensity = mDensity; + } + return b; + } + + /** * Creates a new bitmap, scaled from an existing bitmap, when possible. If the * specified width and height are the same as the current width and height of * the source bitmap, the source bitmap is returned and no new bitmap is @@ -1636,6 +1652,7 @@ public final class Bitmap implements Parcelable { int nativeConfig, boolean mutable); private static native Bitmap nativeCopy(long nativeSrcBitmap, int nativeConfig, boolean isMutable); + private static native Bitmap nativeCopyAshmem(long nativeSrcBitmap); private static native void nativeDestructor(long nativeBitmap); private static native boolean nativeRecycle(long nativeBitmap); private static native void nativeReconfigure(long nativeBitmap, int width, int height, |