!3753 适配leashwindow阴影 , 删除 USE_CACHE_SURFACE_NUM

Merge pull request !3753 from lingkang/fix_leashwindow_shadow_from_20230223
This commit is contained in:
openharmony_ci 2023-02-25 09:06:55 +00:00 committed by Gitee
commit b152e5d8a6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 14 additions and 8 deletions

View File

@ -715,7 +715,7 @@ void RSMainThread::CalcOcclusionImplementation(std::vector<RSBaseRenderNode::Sha
std::map<uint32_t, bool> pidVisMap; std::map<uint32_t, bool> pidVisMap;
for (auto it = curAllSurfaces.rbegin(); it != curAllSurfaces.rend(); ++it) { for (auto it = curAllSurfaces.rbegin(); it != curAllSurfaces.rend(); ++it) {
auto curSurface = RSBaseRenderNode::ReinterpretCast<RSSurfaceRenderNode>(*it); auto curSurface = RSBaseRenderNode::ReinterpretCast<RSSurfaceRenderNode>(*it);
if (curSurface == nullptr || curSurface->GetDstRect().IsEmpty()) { if (curSurface == nullptr || curSurface->GetDstRect().IsEmpty() || curSurface->IsLeashWindow()) {
continue; continue;
} }
Occlusion::Rect occlusionRect; Occlusion::Rect occlusionRect;
@ -791,7 +791,7 @@ void RSMainThread::CalcOcclusion()
if (!winDirty) { if (!winDirty) {
for (auto it = curAllSurfaces.rbegin(); it != curAllSurfaces.rend(); ++it) { for (auto it = curAllSurfaces.rbegin(); it != curAllSurfaces.rend(); ++it) {
auto surface = RSBaseRenderNode::ReinterpretCast<RSSurfaceRenderNode>(*it); auto surface = RSBaseRenderNode::ReinterpretCast<RSSurfaceRenderNode>(*it);
if (surface == nullptr) { if (surface == nullptr || surface->IsLeashWindow()) {
continue; continue;
} }
if (surface->GetZorderChanged() || surface->GetDstRectChanged() || if (surface->GetZorderChanged() || surface->GetDstRectChanged() ||

View File

@ -76,7 +76,7 @@ void RSUniRenderProcessor::ProcessDisplaySurface(RSDisplayRenderNode& node)
layers_.emplace_back(layer); layers_.emplace_back(layer);
for (auto surface : node.GetCurAllSurfaces()) { for (auto surface : node.GetCurAllSurfaces()) {
auto surfaceNode = RSBaseRenderNode::ReinterpretCast<RSSurfaceRenderNode>(surface); auto surfaceNode = RSBaseRenderNode::ReinterpretCast<RSSurfaceRenderNode>(surface);
if (!surfaceNode || !surfaceNode->GetOcclusionVisible()) { if (!surfaceNode || !surfaceNode->GetOcclusionVisible() || surfaceNode->IsLeashWindow()) {
continue; continue;
} }
layerNum++; layerNum++;

View File

@ -44,7 +44,6 @@
namespace OHOS { namespace OHOS {
namespace Rosen { namespace Rosen {
namespace { namespace {
constexpr uint32_t USE_CACHE_SURFACE_NUM = 7;
bool IsFirstFrameReadyToDraw(RSSurfaceRenderNode& node) bool IsFirstFrameReadyToDraw(RSSurfaceRenderNode& node)
{ {
@ -1012,8 +1011,7 @@ void RSUniRenderVisitor::ProcessDisplayRenderNode(RSDisplayRenderNode& node)
// enable cache if screen rotation is not times of 90 degree // enable cache if screen rotation is not times of 90 degree
canvas_->SetCacheEnabled(geoPtr->IsNeedClientCompose()); canvas_->SetCacheEnabled(geoPtr->IsNeedClientCompose());
} }
canvas_->SetCacheEnabled(canvas_->isCacheEnabled() ||
node.GetCurAllSurfaces().size() > USE_CACHE_SURFACE_NUM);
if (canvas_->isCacheEnabled()) { if (canvas_->isCacheEnabled()) {
// we are doing rotation animation, try offscreen render if capable // we are doing rotation animation, try offscreen render if capable
ClearTransparentBeforeSaveLayer(); ClearTransparentBeforeSaveLayer();

View File

@ -73,6 +73,11 @@ public:
return nodeType_ == RSSurfaceNodeType::ABILITY_COMPONENT_NODE; return nodeType_ == RSSurfaceNodeType::ABILITY_COMPONENT_NODE;
} }
bool IsLeashWindow() const
{
return nodeType_ == RSSurfaceNodeType::LEASH_WINDOW_NODE;
}
// indicate if this node type can enable hardware composer // indicate if this node type can enable hardware composer
bool IsHardwareEnabledType() const bool IsHardwareEnabledType() const
{ {

View File

@ -143,13 +143,16 @@ void RSSurfaceRenderNode::PrepareRenderAfterChildren(RSPaintFilterCanvas& canvas
void RSSurfaceRenderNode::CollectSurface( void RSSurfaceRenderNode::CollectSurface(
const std::shared_ptr<RSBaseRenderNode>& node, std::vector<RSBaseRenderNode::SharedPtr>& vec, bool isUniRender) const std::shared_ptr<RSBaseRenderNode>& node, std::vector<RSBaseRenderNode::SharedPtr>& vec, bool isUniRender)
{ {
if (nodeType_ == RSSurfaceNodeType::STARTING_WINDOW_NODE) { if (IsStartingWindow()) {
if (isUniRender) { if (isUniRender) {
vec.emplace_back(shared_from_this()); vec.emplace_back(shared_from_this());
} }
return; return;
} }
if (nodeType_ == RSSurfaceNodeType::LEASH_WINDOW_NODE) { if (IsLeashWindow()) {
if (isUniRender) {
vec.emplace_back(shared_from_this());
}
for (auto& child : node->GetSortedChildren()) { for (auto& child : node->GetSortedChildren()) {
child->CollectSurface(child, vec, isUniRender); child->CollectSurface(child, vec, isUniRender);
} }