diff options
author | 2020-10-30 04:25:00 +0000 | |
---|---|---|
committer | 2020-10-30 04:25:00 +0000 | |
commit | 5cc8820fdda3a7d41f4e36c6ac67110573135a9e (patch) | |
tree | e112dfd8ad529c4d4e2b3f10e921d0f973cfcb13 /services/surfaceflinger/BufferStateLayer.cpp | |
parent | 3c3c27b1efa8b419bb030e2206dc0802ef88a321 (diff) | |
parent | e7f79c51ec0d00bc79d9e4f017a56cdb627667bb (diff) |
Merge "Check if the buffer is actually being scaled instead of only checking scaling mode"
Diffstat (limited to 'services/surfaceflinger/BufferStateLayer.cpp')
-rw-r--r-- | services/surfaceflinger/BufferStateLayer.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/services/surfaceflinger/BufferStateLayer.cpp b/services/surfaceflinger/BufferStateLayer.cpp index 6f344c721a..f85151449b 100644 --- a/services/surfaceflinger/BufferStateLayer.cpp +++ b/services/surfaceflinger/BufferStateLayer.cpp @@ -744,6 +744,31 @@ Layer::RoundedCornerState BufferStateLayer::getRoundedCornerState() const { static_cast<float>(s.active.transform.ty() + s.active.h)), radius); } + +bool BufferStateLayer::bufferNeedsFiltering() const { + const State& s(getDrawingState()); + if (!s.buffer) { + return false; + } + + uint32_t bufferWidth = s.buffer->width; + uint32_t bufferHeight = s.buffer->height; + + // Undo any transformations on the buffer and return the result. + if (s.transform & ui::Transform::ROT_90) { + std::swap(bufferWidth, bufferHeight); + } + + if (s.transformToDisplayInverse) { + uint32_t invTransform = DisplayDevice::getPrimaryDisplayRotationFlags(); + if (invTransform & ui::Transform::ROT_90) { + std::swap(bufferWidth, bufferHeight); + } + } + + const Rect layerSize{getBounds()}; + return layerSize.width() != bufferWidth || layerSize.height() != bufferHeight; +} } // namespace android // TODO(b/129481165): remove the #pragma below and fix conversion issues |