diff options
author | Zhijun He <zhijunhe@google.com> | 2015-03-20 11:39:55 -0700 |
---|---|---|
committer | Zhijun He <zhijunhe@google.com> | 2015-03-30 16:17:35 -0700 |
commit | 2f17431194efc5a13981550b004dd8d5d2a42e5e (patch) | |
tree | 688fa9c58004aa592bb37349b3678bcb545180f6 | |
parent | 8a78286915a8f71eb09b5ae29a3bd8fb977180e6 (diff) | |
download | frameworks_base-2f17431194efc5a13981550b004dd8d5d2a42e5e.zip frameworks_base-2f17431194efc5a13981550b004dd8d5d2a42e5e.tar.gz frameworks_base-2f17431194efc5a13981550b004dd8d5d2a42e5e.tar.bz2 |
ImageFormat: add PRIVATE format
Bug: 19865019
Change-Id: I1a9335fe1733a5b28d9cb20485b509fb216cb52b
-rw-r--r-- | api/current.txt | 1 | ||||
-rw-r--r-- | api/system-current.txt | 1 | ||||
-rw-r--r-- | core/jni/android_view_Surface.cpp | 4 | ||||
-rw-r--r-- | graphics/java/android/graphics/ImageFormat.java | 28 | ||||
-rw-r--r-- | include/android_runtime/android_view_Surface.h | 1 |
5 files changed, 34 insertions, 1 deletions
diff --git a/api/current.txt b/api/current.txt index 11a5083..3516231 100644 --- a/api/current.txt +++ b/api/current.txt @@ -11138,6 +11138,7 @@ package android.graphics { field public static final int JPEG = 256; // 0x100 field public static final int NV16 = 16; // 0x10 field public static final int NV21 = 17; // 0x11 + field public static final int PRIVATE = 34; // 0x22 field public static final int RAW10 = 37; // 0x25 field public static final int RAW_SENSOR = 32; // 0x20 field public static final int RGB_565 = 4; // 0x4 diff --git a/api/system-current.txt b/api/system-current.txt index 874307d..0757667 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -11422,6 +11422,7 @@ package android.graphics { field public static final int JPEG = 256; // 0x100 field public static final int NV16 = 16; // 0x10 field public static final int NV21 = 17; // 0x11 + field public static final int PRIVATE = 34; // 0x22 field public static final int RAW10 = 37; // 0x25 field public static final int RAW_SENSOR = 32; // 0x20 field public static final int RGB_565 = 4; // 0x4 diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp index fff8604..f1c90ea 100644 --- a/core/jni/android_view_Surface.cpp +++ b/core/jni/android_view_Surface.cpp @@ -192,6 +192,9 @@ PublicFormat android_view_Surface_mapHalFormatDataspaceToPublicFormat( case HAL_PIXEL_FORMAT_YCbCr_422_I: // Name differs, though the value is the same return PublicFormat::YUY2; + case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED: + // Name differs, though the value is the same + return PublicFormat::PRIVATE; case HAL_PIXEL_FORMAT_Y16: // Dataspace-dependent switch (dataSpace) { @@ -216,7 +219,6 @@ PublicFormat android_view_Surface_mapHalFormatDataspaceToPublicFormat( break; case HAL_PIXEL_FORMAT_BGRA_8888: case HAL_PIXEL_FORMAT_RAW_OPAQUE: - case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED: // Not defined in public API return PublicFormat::UNKNOWN; diff --git a/graphics/java/android/graphics/ImageFormat.java b/graphics/java/android/graphics/ImageFormat.java index 49c4247..ada8c12 100644 --- a/graphics/java/android/graphics/ImageFormat.java +++ b/graphics/java/android/graphics/ImageFormat.java @@ -388,6 +388,33 @@ public class ImageFormat { public static final int DEPTH_POINT_CLOUD = 0x101; /** + * Android private opaque image format. + * <p> + * The choices of the actual format and pixel data layout are entirely up to + * the device-specific and framework internal implementations, and may vary + * depending on use cases even for the same device. The buffers of this + * format can be produced by components like + * {@link android.media.ImageWriter ImageWriter} , and interpreted correctly + * by consumers like {@link android.hardware.camera2.CameraDevice + * CameraDevice} based on the device/framework private information. However, + * these buffers are not directly accessible to the application. + * </p> + * <p> + * When an {@link android.media.Image Image} of this format is obtained from + * an {@link android.media.ImageReader ImageReader} or + * {@link android.media.ImageWriter ImageWriter}, the + * {@link android.media.Image#getPlanes() getPlanes()} method will return an + * empty {@link android.media.Image.Plane Plane} array. + * </p> + * <p> + * If a buffer of this format is to be used as an OpenGL ES texture, the + * framework will assume that sampling the texture will always return an + * alpha value of 1.0 (i.e. the buffer contains only opaque pixel values). + * </p> + */ + public static final int PRIVATE = 0x22; + + /** * Use this function to retrieve the number of bits per pixel of an * ImageFormat. * @@ -447,6 +474,7 @@ public class ImageFormat { case RAW10: case DEPTH16: case DEPTH_POINT_CLOUD: + case PRIVATE: return true; } diff --git a/include/android_runtime/android_view_Surface.h b/include/android_runtime/android_view_Surface.h index a6836a8..ed83314 100644 --- a/include/android_runtime/android_view_Surface.h +++ b/include/android_runtime/android_view_Surface.h @@ -43,6 +43,7 @@ enum class PublicFormat { NV21 = 0x11, YUY2 = 0x14, RAW_SENSOR = 0x20, + PRIVATE = 0x22, YUV_420_888 = 0x23, RAW10 = 0x25, JPEG = 0x100, |