diff options
| author | 2019-12-03 10:49:17 -0800 | |
|---|---|---|
| committer | 2019-12-03 13:32:09 -0800 | |
| commit | 45e4b3b9e1f2135d9959ec17dc4daf0b3cd5e1bd (patch) | |
| tree | 9a8d1a468cc89907b3159b804ee8a64ff277a81f /libs/gui/BLASTBufferQueue.cpp | |
| parent | d3b90d223824dbfe1f827d6e089d96902af08f8f (diff) | |
Set the crop on the BLASt adapter
Bug: 141938470
Test: build, boot, libgui_test
Change-Id: I8eee383bd8aeb82d42bb3e26a5fe68a5b7ac8ae4
Diffstat (limited to 'libs/gui/BLASTBufferQueue.cpp')
| -rw-r--r-- | libs/gui/BLASTBufferQueue.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp index 06a5f06e31..29ea84e76d 100644 --- a/libs/gui/BLASTBufferQueue.cpp +++ b/libs/gui/BLASTBufferQueue.cpp @@ -19,6 +19,7 @@ #include <gui/BLASTBufferQueue.h> #include <gui/BufferItemConsumer.h> +#include <gui/GLConsumer.h> #include <chrono> @@ -131,13 +132,20 @@ void BLASTBufferQueue::processNextBufferLocked() { t->addTransactionCompletedCallback(transactionCallbackThunk, static_cast<void*>(this)); t->setFrame(mSurfaceControl, {0, 0, (int32_t)buffer->getWidth(), (int32_t)buffer->getHeight()}); - t->setCrop(mSurfaceControl, {0, 0, (int32_t)buffer->getWidth(), (int32_t)buffer->getHeight()}); + t->setCrop(mSurfaceControl, computeCrop(mLastSubmittedBufferItem)); if (applyTransaction) { t->apply(); } } +Rect BLASTBufferQueue::computeCrop(const BufferItem& item) { + if (item.mScalingMode == NATIVE_WINDOW_SCALING_MODE_SCALE_CROP) { + return GLConsumer::scaleDownCrop(item.mCrop, mWidth, mHeight); + } + return item.mCrop; +} + void BLASTBufferQueue::onFrameAvailable(const BufferItem& item) { std::lock_guard _lock{mMutex}; |