summaryrefslogtreecommitdiffstats
path: root/camera/libcameraservice/CameraService.cpp
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2009-10-23 17:39:46 +0800
committerWu-cheng Li <wuchengli@google.com>2009-10-29 13:20:26 +0800
commit4cb04c4654e9718a73b378e7b9962dee454efa8d (patch)
treeb0ca9496027477f28833f0f85288bb6611f80c52 /camera/libcameraservice/CameraService.cpp
parent38a9becfdd23e582571f624b624680cc5938d423 (diff)
downloadframeworks_base-4cb04c4654e9718a73b378e7b9962dee454efa8d.zip
frameworks_base-4cb04c4654e9718a73b378e7b9962dee454efa8d.tar.gz
frameworks_base-4cb04c4654e9718a73b378e7b9962dee454efa8d.tar.bz2
Use image rect information to display zoomed picture.
Diffstat (limited to 'camera/libcameraservice/CameraService.cpp')
-rw-r--r--camera/libcameraservice/CameraService.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp
index 6880144..29531ca 100644
--- a/camera/libcameraservice/CameraService.cpp
+++ b/camera/libcameraservice/CameraService.cpp
@@ -865,7 +865,11 @@ status_t CameraService::Client::takePicture()
}
// 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.
if (mMediaPlayerClick.get() != NULL) {
@@ -889,12 +893,21 @@ void CameraService::Client::handleShutter()
if (mSurface != 0 && !mUseOverlay) {
int w, h;
CameraParameters params(mHardware->getParameters());
- params.getPictureSize(&w, &h);
uint32_t transform = 0;
if (params.getOrientation() == CameraParameters::CAMERA_ORIENTATION_PORTRAIT) {
LOGV("portrait mode");
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,
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) {
case CAMERA_MSG_SHUTTER:
- client->handleShutter();
+ // ext1 is the dimension of the yuv picture.
+ client->handleShutter((image_rect_type *)ext1);
break;
default:
sp<ICameraClient> c = client->mCameraClient;