am 16d8f10e: am 4cb04c46: Use image rect information to display zoomed picture.

Merge commit '16d8f10ebf75e809cc14d866fded7749363b9d8f' into eclair-mr2-plus-aosp

* commit '16d8f10ebf75e809cc14d866fded7749363b9d8f':
  Use image rect information to display zoomed picture.
This commit is contained in:
Wu-cheng Li
2009-10-29 19:55:41 -07:00
committed by Android Git Automerger
3 changed files with 27 additions and 4 deletions

View File

@@ -865,7 +865,11 @@ status_t CameraService::Client::takePicture()
} }
// snapshot taken // snapshot taken
void CameraService::Client::handleShutter() void CameraService::Client::handleShutter(
image_rect_type *size // The width and height of yuv picture for
// registerBuffer. If this is NULL, use the picture
// size from parameters.
)
{ {
// Play shutter sound. // Play shutter sound.
if (mMediaPlayerClick.get() != NULL) { if (mMediaPlayerClick.get() != NULL) {
@@ -889,12 +893,21 @@ void CameraService::Client::handleShutter()
if (mSurface != 0 && !mUseOverlay) { if (mSurface != 0 && !mUseOverlay) {
int w, h; int w, h;
CameraParameters params(mHardware->getParameters()); CameraParameters params(mHardware->getParameters());
params.getPictureSize(&w, &h);
uint32_t transform = 0; uint32_t transform = 0;
if (params.getOrientation() == CameraParameters::CAMERA_ORIENTATION_PORTRAIT) { if (params.getOrientation() == CameraParameters::CAMERA_ORIENTATION_PORTRAIT) {
LOGV("portrait mode"); LOGV("portrait mode");
transform = ISurface::BufferHeap::ROT_90; transform = ISurface::BufferHeap::ROT_90;
} }
if (size == NULL) {
params.getPictureSize(&w, &h);
} else {
w = size->width;
h = size->height;
w &= ~1;
h &= ~1;
LOGD("Snapshot image width=%d, height=%d", w, h);
}
ISurface::BufferHeap buffers(w, h, w, h, ISurface::BufferHeap buffers(w, h, w, h,
PIXEL_FORMAT_YCbCr_420_SP, transform, 0, mHardware->getRawHeap()); PIXEL_FORMAT_YCbCr_420_SP, transform, 0, mHardware->getRawHeap());
@@ -1048,7 +1061,8 @@ void CameraService::Client::notifyCallback(int32_t msgType, int32_t ext1, int32_
switch (msgType) { switch (msgType) {
case CAMERA_MSG_SHUTTER: case CAMERA_MSG_SHUTTER:
client->handleShutter(); // ext1 is the dimension of the yuv picture.
client->handleShutter((image_rect_type *)ext1);
break; break;
default: default:
sp<ICameraClient> c = client->mCameraClient; sp<ICameraClient> c = client->mCameraClient;

View File

@@ -145,7 +145,7 @@ private:
static sp<Client> getClientFromCookie(void* user); static sp<Client> getClientFromCookie(void* user);
void handlePreviewData(const sp<IMemory>&); void handlePreviewData(const sp<IMemory>&);
void handleShutter(); void handleShutter(image_rect_type *image);
void handlePostview(const sp<IMemory>&); void handlePostview(const sp<IMemory>&);
void handleRawPicture(const sp<IMemory>&); void handleRawPicture(const sp<IMemory>&);
void handleCompressedPicture(const sp<IMemory>&); void handleCompressedPicture(const sp<IMemory>&);

View File

@@ -25,6 +25,15 @@
#include <ui/Overlay.h> #include <ui/Overlay.h>
namespace android { namespace android {
/**
* The size of image for display.
*/
typedef struct image_rect_struct
{
uint32_t width; /* Image width */
uint32_t height; /* Image height */
} image_rect_type;
typedef void (*notify_callback)(int32_t msgType, typedef void (*notify_callback)(int32_t msgType,
int32_t ext1, int32_t ext1,