diff options
| -rw-r--r-- | services/surfaceflinger/BufferLayerConsumer.cpp | 8 | ||||
| -rw-r--r-- | services/surfaceflinger/BufferLayerConsumer.h | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/services/surfaceflinger/BufferLayerConsumer.cpp b/services/surfaceflinger/BufferLayerConsumer.cpp index 87333d0ffd..ae8ebf0e01 100644 --- a/services/surfaceflinger/BufferLayerConsumer.cpp +++ b/services/surfaceflinger/BufferLayerConsumer.cpp @@ -435,7 +435,9 @@ void BufferLayerConsumer::computeCurrentTransformMatrixLocked() { BLC_LOGD("computeCurrentTransformMatrixLocked: " "mCurrentTextureImage is nullptr"); } - const Rect& cropRect = canUseImageCrop(mCurrentCrop) ? Rect::EMPTY_RECT : mCurrentCrop; + + const Rect& currentCrop = getCurrentCropLocked(); + const Rect& cropRect = canUseImageCrop(currentCrop) ? Rect::EMPTY_RECT : currentCrop; GLConsumer::computeTransformMatrix(mCurrentTransformMatrix, buf, cropRect, mCurrentTransform, mFilteringEnabled); } @@ -490,6 +492,10 @@ sp<GraphicBuffer> BufferLayerConsumer::getCurrentBuffer(int* outSlot) const { Rect BufferLayerConsumer::getCurrentCrop() const { Mutex::Autolock lock(mMutex); + return getCurrentCropLocked(); +} + +Rect BufferLayerConsumer::getCurrentCropLocked() const { return (mCurrentScalingMode == NATIVE_WINDOW_SCALING_MODE_SCALE_CROP) ? GLConsumer::scaleDownCrop(mCurrentCrop, mDefaultWidth, mDefaultHeight) : mCurrentCrop; diff --git a/services/surfaceflinger/BufferLayerConsumer.h b/services/surfaceflinger/BufferLayerConsumer.h index f81cdb1d91..84404c7f0f 100644 --- a/services/surfaceflinger/BufferLayerConsumer.h +++ b/services/surfaceflinger/BufferLayerConsumer.h @@ -274,6 +274,9 @@ private: // mCurrentTextureImage must not be nullptr. void computeCurrentTransformMatrixLocked(); + // See getCurrentCrop, but with mMutex already held. + Rect getCurrentCropLocked() const; + // doFenceWaitLocked inserts a wait command into the RenderEngine command // stream to ensure that it is safe for future RenderEngine commands to // access the current texture buffer. |