From 2a358c2f010664425dc8ba4695cc1132ef2affc9 Mon Sep 17 00:00:00 2001 From: Tyler Luu Date: Tue, 5 Jun 2012 17:39:03 -0500 Subject: camera: bsa: Set crop before enqueueing - Set the crop rectangle for surface texture, so surface texture can compute transform matrix that will be used by applications. Change-Id: I6e245c99ac3196518d8a9ee83c162d3ce380b7e9 Signed-off-by: Tyler Luu Signed-off-by: Vladimir Petrov --- camera/BufferSourceAdapter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'camera/BufferSourceAdapter.cpp') diff --git a/camera/BufferSourceAdapter.cpp b/camera/BufferSourceAdapter.cpp index d0c3fd9..d6de80c 100644 --- a/camera/BufferSourceAdapter.cpp +++ b/camera/BufferSourceAdapter.cpp @@ -673,6 +673,7 @@ void BufferSourceAdapter::handleFrameCallback(CameraFrame* frame) status_t ret = NO_ERROR; buffer_handle_t *handle = NULL; int i; + uint32_t x, y; android::GraphicBufferMapper &mapper = android::GraphicBufferMapper::get(); android::AutoMutex lock(mLock); @@ -699,6 +700,14 @@ void BufferSourceAdapter::handleFrameCallback(CameraFrame* frame) return; } + CameraHal::getXYFromOffset(&x, &y, frame->mOffset, frame->mAlignment, mPixelFormat); + CAMHAL_LOGVB("offset = %u left = %d top = %d right = %d bottom = %d", + frame->mOffset, x, y, x + frame->mWidth, y + frame->mHeight); + ret = mBufferSource->set_crop(mBufferSource, x, y, x + frame->mWidth, y + frame->mHeight); + if (NO_ERROR != ret) { + CAMHAL_LOGE("mBufferSource->set_crop returned error %d", ret); + } + if ( NULL != frame->mMetaData.get() ) { camera_memory_t *extMeta = frame->mMetaData->getExtendedMetadata(); if ( NULL != extMeta ) { -- cgit v1.2.3