diff options
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; |