diff options
author | Mathias Agopian <mathias@google.com> | 2010-02-17 17:53:09 -0800 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-02-18 15:32:47 -0800 |
commit | a696f5d667227365da732481770767dcb330dd23 (patch) | |
tree | 0a89f08df3f88daea3f29948c8d5cdd7675a3fff /core/jni/android_graphics_PixelFormat.cpp | |
parent | be8af08cf4cf9384b3fa13c853c40d761211ceed (diff) | |
download | frameworks_base-a696f5d667227365da732481770767dcb330dd23.zip frameworks_base-a696f5d667227365da732481770767dcb330dd23.tar.gz frameworks_base-a696f5d667227365da732481770767dcb330dd23.tar.bz2 |
Add ImageFormat.java and move the Camera/YUV constants from PixelFormat to it.
PixelFormat's corresponding constansts are now deprecated.
Diffstat (limited to 'core/jni/android_graphics_PixelFormat.cpp')
-rw-r--r-- | core/jni/android_graphics_PixelFormat.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/core/jni/android_graphics_PixelFormat.cpp b/core/jni/android_graphics_PixelFormat.cpp index 0643622..5b8363c 100644 --- a/core/jni/android_graphics_PixelFormat.cpp +++ b/core/jni/android_graphics_PixelFormat.cpp @@ -48,11 +48,35 @@ static void android_graphics_getPixelFormatInfo( JNIEnv* env, jobject clazz, jint format, jobject pixelFormatObject) { PixelFormatInfo info; - status_t err = getPixelFormatInfo(format, &info); + status_t err; + + // we need this for backward compatibility with PixelFormat's + // deprecated constants + switch (format) { + case HAL_PIXEL_FORMAT_YCbCr_422_SP: + // defined as the bytes per pixel of the Y plane + info.bytesPerPixel = 1; + info.bitsPerPixel = 16; + goto done; + case HAL_PIXEL_FORMAT_YCrCb_420_SP: + // defined as the bytes per pixel of the Y plane + info.bytesPerPixel = 1; + info.bitsPerPixel = 12; + goto done; + case HAL_PIXEL_FORMAT_YCbCr_422_I: + // defined as the bytes per pixel of the Y plane + info.bytesPerPixel = 1; + info.bitsPerPixel = 16; + goto done; + } + + err = getPixelFormatInfo(format, &info); if (err < 0) { doThrow(env, "java/lang/IllegalArgumentException"); return; } + +done: env->SetIntField(pixelFormatObject, offsets.bytesPerPixel, info.bytesPerPixel); env->SetIntField(pixelFormatObject, offsets.bitsPerPixel, info.bitsPerPixel); } |