Add Bitmap#getHardwareBuffer
Bug: 148155907 Bug: 135299581 Test: TODO Hidden for now. We'd like to make it an SDK API eventually (b/148155907). Internal code is currently calling createGraphicBufferHandle. This is not something we plan to expose from the UI rendering module, so add a method to get a HardwareBuffer instead. This is something we were already planning to add. It seems that clients of createGraphicBufferHandle really wanted a Parcelable to pass the HARDWARE Bitmap to another thread. This should satisfy that use case. Change-Id: Id701f7c7eab37830cd7d2cdb929cbe6ba4eca119
This commit is contained in:
@@ -2243,6 +2243,19 @@ public final class Bitmap implements Parcelable {
|
||||
return nativeCreateGraphicBufferHandle(mNativePtr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link HardwareBuffer} which is internally used by hardware bitmap
|
||||
*
|
||||
* Note: the HardwareBuffer does *not* have an associated {@link ColorSpace}.
|
||||
* To render this object the same as its rendered with this Bitmap, you
|
||||
* should also call {@link getColorSpace}.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public HardwareBuffer getHardwareBuffer() {
|
||||
return nativeGetHardwareBuffer(mNativePtr);
|
||||
}
|
||||
|
||||
//////////// native methods
|
||||
|
||||
private static native Bitmap nativeCreate(int[] colors, int offset,
|
||||
@@ -2308,6 +2321,7 @@ public final class Bitmap implements Parcelable {
|
||||
private static native Bitmap nativeWrapHardwareBufferBitmap(HardwareBuffer buffer,
|
||||
long nativeColorSpace);
|
||||
private static native GraphicBuffer nativeCreateGraphicBufferHandle(long nativeBitmap);
|
||||
private static native HardwareBuffer nativeGetHardwareBuffer(long nativeBitmap);
|
||||
private static native ColorSpace nativeComputeColorSpace(long nativePtr);
|
||||
private static native void nativeSetColorSpace(long nativePtr, long nativeColorSpace);
|
||||
private static native boolean nativeIsSRGB(long nativePtr);
|
||||
|
||||
Reference in New Issue
Block a user