diff options
| author | 2012-05-07 13:50:11 -0700 | |
|---|---|---|
| committer | 2012-05-08 17:08:33 -0700 | |
| commit | d72f233ffa125856a44976a50a66ceb669f49ab2 (patch) | |
| tree | fbc8f965d4601b08825c86aa040450b60471ffa3 /libs/gui/BufferQueue.cpp | |
| parent | 59332804306c054082a39e9b004146bd03ae1d30 (diff) | |
libgui: Add support for post-xform crops.
This change adds support for specifying a crop rectangle to a
SurfaceTextureClient that is in post-transformed coordinate space.
Change-Id: I247901de343e71b32850f7ae3bac62dfa612ad3d
Bug: 6299171
Diffstat (limited to 'libs/gui/BufferQueue.cpp')
| -rw-r--r-- | libs/gui/BufferQueue.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp index 5095ebd128..e53162ba41 100644 --- a/libs/gui/BufferQueue.cpp +++ b/libs/gui/BufferQueue.cpp @@ -540,15 +540,11 @@ status_t BufferQueue::queueBuffer(int buf, uint32_t transform; int scalingMode; int64_t timestamp; - Rect activeRect; - input.deflate(×tamp, &crop, &scalingMode, &transform, - &activeRect); + input.deflate(×tamp, &crop, &scalingMode, &transform); - ST_LOGV("queueBuffer: slot=%d time=%lld crop=[%d,%d,%d,%d] " - "active=[%d,%d,%d,%d]", buf, timestamp, crop.left, crop.top, - crop.right, crop.bottom, activeRect.left, activeRect.top, - activeRect.right, activeRect.bottom); + ST_LOGV("queueBuffer: slot=%d time=%lld crop=[%d,%d,%d,%d]", + buf, timestamp, crop.left, crop.top, crop.right, crop.bottom); sp<ConsumerListener> listener; @@ -572,6 +568,16 @@ status_t BufferQueue::queueBuffer(int buf, return -EINVAL; } + const sp<GraphicBuffer>& graphicBuffer(mSlots[buf].mGraphicBuffer); + Rect bufferRect(graphicBuffer->getWidth(), graphicBuffer->getHeight()); + Rect croppedCrop; + crop.intersect(bufferRect, &croppedCrop); + if (croppedCrop != crop) { + ST_LOGE("queueBuffer: crop rect is not contained within the " + "buffer in slot %d", buf); + return -EINVAL; + } + if (mSynchronousMode) { // In synchronous mode we queue all buffers in a FIFO. mQueue.push_back(buf); @@ -600,12 +606,12 @@ status_t BufferQueue::queueBuffer(int buf, mSlots[buf].mTimestamp = timestamp; mSlots[buf].mCrop = crop; mSlots[buf].mTransform = transform; - mSlots[buf].mActiveRect = activeRect; switch (scalingMode) { case NATIVE_WINDOW_SCALING_MODE_FREEZE: case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP: + case NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP: break; default: ST_LOGE("unknown scaling mode: %d (ignoring)", scalingMode); @@ -859,7 +865,6 @@ status_t BufferQueue::acquireBuffer(BufferItem *buffer) { buffer->mFrameNumber = mSlots[buf].mFrameNumber; buffer->mTimestamp = mSlots[buf].mTimestamp; buffer->mBuf = buf; - buffer->mActiveRect = mSlots[buf].mActiveRect; mSlots[buf].mAcquireCalled = true; mSlots[buf].mBufferState = BufferSlot::ACQUIRED; |