diff options
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
| -rw-r--r-- | services/surfaceflinger/Layer.cpp | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 752407aedc..25929ed1d7 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -117,6 +117,7 @@ Layer::Layer(const LayerCreationArgs& args) mCurrentState.metadata = args.metadata; mCurrentState.shadowRadius = 0.f; mCurrentState.treeHasFrameRateVote = false; + mCurrentState.fixedTransformHint = ui::Transform::ROT_INVALID; // drawing state & current state are identical mDrawingState = mCurrentState; @@ -1333,6 +1334,18 @@ bool Layer::setShadowRadius(float shadowRadius) { return true; } +bool Layer::setFixedTransformHint(ui::Transform::RotationFlags fixedTransformHint) { + if (mCurrentState.fixedTransformHint == fixedTransformHint) { + return false; + } + + mCurrentState.sequence++; + mCurrentState.fixedTransformHint = fixedTransformHint; + mCurrentState.modified = true; + setTransactionFlags(eTransactionNeeded); + return true; +} + void Layer::updateTreeHasFrameRateVote() { const auto traverseTree = [&](const LayerVector::Visitor& visitor) { auto parent = getParent(); @@ -1460,19 +1473,19 @@ uint32_t Layer::getEffectiveUsage(uint32_t usage) const { } void Layer::updateTransformHint(const sp<const DisplayDevice>& display) const { - uint32_t orientation = 0; + ui::Transform::RotationFlags transformHint = ui::Transform::ROT_0; // Disable setting transform hint if the debug flag is set. if (!mFlinger->mDebugDisableTransformHint) { // The transform hint is used to improve performance, but we can // only have a single transform hint, it cannot // apply to all displays. const ui::Transform& planeTransform = display->getTransform(); - orientation = planeTransform.getOrientation(); - if (orientation & ui::Transform::ROT_INVALID) { - orientation = 0; + transformHint = static_cast<ui::Transform::RotationFlags>(planeTransform.getOrientation()); + if (transformHint & ui::Transform::ROT_INVALID) { + transformHint = ui::Transform::ROT_0; } } - setTransformHint(orientation); + setTransformHint(transformHint); } // ---------------------------------------------------------------------------- @@ -2076,6 +2089,16 @@ half Layer::getAlpha() const { return parentAlpha * getDrawingState().color.a; } +ui::Transform::RotationFlags Layer::getFixedTransformHint() const { + ui::Transform::RotationFlags fixedTransformHint = mCurrentState.fixedTransformHint; + if (fixedTransformHint != ui::Transform::ROT_INVALID) { + return fixedTransformHint; + } + const auto& p = mCurrentParent.promote(); + if (!p) return fixedTransformHint; + return p->getFixedTransformHint(); +} + half4 Layer::getColor() const { const half4 color(getDrawingState().color); return half4(color.r, color.g, color.b, getAlpha()); |