!10722 相机预览锁定设置只在旋转过程中生效

Merge pull request !10722 from 沁心/0505
This commit is contained in:
openharmony_ci 2024-05-06 05:13:51 +00:00 committed by Gitee
commit ef8735109f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 21 additions and 12 deletions

View File

@ -49,6 +49,9 @@
namespace OHOS {
namespace Rosen {
namespace {
constexpr int32_t FIX_ROTATION_DEGREE_FOR_FOLD_SCREEN = -90;
}
void RSUniRenderUtil::MergeDirtyHistory(std::shared_ptr<RSDisplayRenderNode>& node, int32_t bufferAge,
bool useAlignedDirtyRegion, bool renderParallel)
{
@ -1186,7 +1189,7 @@ void RSUniRenderUtil::DealWithNodeGravity(RSSurfaceRenderNode& node, const Scree
void RSUniRenderUtil::CheckForceHardwareAndUpdateDstRect(RSSurfaceRenderNode& node)
{
if (!node.GetForceHardwareByUser()) {
if (!node.GetForceHardware()) {
return;
}
RectI srcRect = { 0, 0, node.GetBuffer()->GetSurfaceBufferWidth(), node.GetBuffer()->GetSurfaceBufferHeight() };
@ -1235,7 +1238,9 @@ GraphicTransformType RSUniRenderUtil::GetLayerTransform(RSSurfaceRenderNode& nod
if (!consumer) {
return GraphicTransformType::GRAPHIC_ROTATE_NONE;
}
int surfaceNodeRotation = node.GetForceHardwareByUser() ? -1 * node.GetFixedRotationDegree() :
static int32_t rotationDegree = (system::GetParameter("const.build.product", "") == "ALT") ?
FIX_ROTATION_DEGREE_FOR_FOLD_SCREEN : 0;
int surfaceNodeRotation = node.GetForceHardware() ? -1 * rotationDegree :
RSUniRenderUtil::GetRotationFromMatrix(node.GetTotalMatrix());
int totalRotation = (RotateEnumToInt(screenInfo.rotation) + surfaceNodeRotation +
RSBaseRenderUtil::RotateEnumToInt(RSBaseRenderUtil::GetRotateTransform(consumer->GetTransform()))) % 360;

View File

@ -1223,7 +1223,8 @@ void RSUniRenderVisitor::QuickPrepareDisplayRenderNode(RSDisplayRenderNode& node
SendRcdMessage(node);
ancestorNodeHasAnimation_ = false;
dirtyFlag_ = isDirty_ || node.IsRotationChanged();
displayNodeRotationChanged_ = node.IsRotationChanged();
dirtyFlag_ = isDirty_ || displayNodeRotationChanged_;
prepareClipRect_ = screenRect_;
curAlpha_ = 1.0f;
node.UpdateRotation();
@ -1634,7 +1635,8 @@ void RSUniRenderVisitor::UpdateHwcNodeInfoForAppNode(RSSurfaceRenderNode& node)
}
node.SetHardwareForcedDisabledState(false);
node.SetHardwareForcedDisabledByVisibility(false);
if ((!node.GetForceHardwareByUser() && !IsHardwareComposerEnabled()) ||
node.SetForceHardware(displayNodeRotationChanged_ || isScreenRotationAnimating_);
if ((!node.GetForceHardware() && !IsHardwareComposerEnabled()) ||
curSurfaceNode_->GetVisibleRegion().IsEmpty() || !node.GetBuffer()) {
RS_OPTIONAL_TRACE_NAME_FMT("hwc debug: name:%s id:%llu disabled by param/invisible/no buffer",
node.GetName().c_str(), node.GetId());
@ -1699,6 +1701,7 @@ void RSUniRenderVisitor::UpdateHwcNodeByTransform(RSSurfaceRenderNode& node)
if (!node.GetBuffer()) {
return;
}
node.SetForceHardware(displayNodeRotationChanged_ || isScreenRotationAnimating_);
RSUniRenderUtil::DealWithNodeGravity(node, screenInfo_);
RSUniRenderUtil::LayerRotate(node, screenInfo_);
RSUniRenderUtil::LayerCrop(node, screenInfo_);

View File

@ -472,6 +472,7 @@ private:
bool isOcclusionEnabled_ = false;
bool isSkipCanvasNodeOutOfScreen_ = false;
bool isScreenRotationAnimating_ = false;
bool displayNodeRotationChanged_ = false;
std::vector<std::string> dfxTargetSurfaceNames_;
PartialRenderType partialRenderType_;
QuickSkipPrepareType quickSkipPrepareType_;

View File

@ -133,8 +133,8 @@ public:
}
void SetForceHardwareAndFixRotation(bool flag);
bool GetForceHardwareByUser() const;
int32_t GetFixedRotationDegree() const;
bool GetForceHardware() const;
void SetForceHardware(bool flag);
SelfDrawingNodeType GetSelfDrawingNodeType() const
{
@ -246,7 +246,7 @@ public:
bool IsHardwareForcedDisabled() const
{
if (isForceHardwareByUser_ && !isHardwareForcedDisabledByVisibility_) {
if (isForceHardware_ && !isHardwareForcedDisabledByVisibility_) {
return false;
}
return isHardwareForcedDisabled_ || isHardwareForcedDisabledByVisibility_ ||
@ -1236,9 +1236,9 @@ private:
// used for hardware enabled nodes
bool isHardwareEnabledNode_ = false;
bool isForceHardwareByUser_ = false;
bool isForceHardware_ = false;
bool isHardwareForcedDisabledByVisibility_ = false;
RectI originalDstRect_;
int32_t fixedRotationDegree_ = -90;
SelfDrawingNodeType selfDrawingType_ = SelfDrawingNodeType::DEFAULT;
bool isCurrentFrameHardwareEnabled_ = false;
bool isLastFrameHardwareEnabled_ = false;

View File

@ -639,14 +639,14 @@ void RSSurfaceRenderNode::SetForceHardwareAndFixRotation(bool flag)
}
}
bool RSSurfaceRenderNode::GetForceHardwareByUser() const
bool RSSurfaceRenderNode::GetForceHardware() const
{
return isForceHardwareByUser_;
return isForceHardware_;
}
int32_t RSSurfaceRenderNode::GetFixedRotationDegree() const
void RSSurfaceRenderNode::SetForceHardware(bool flag)
{
return fixedRotationDegree_;
isForceHardware_ = isForceHardwareByUser_ && flag;
}
void RSSurfaceRenderNode::SetSecurityLayer(bool isSecurityLayer)