!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;
for (auto it = curAllSurfaces.rbegin(); it != curAllSurfaces.rend(); ++it) {
auto curSurface = RSBaseRenderNode::ReinterpretCast<RSSurfaceRenderNode>(*it);
if (curSurface == nullptr || curSurface->GetDstRect().IsEmpty()) {
if (curSurface == nullptr || curSurface->GetDstRect().IsEmpty() || curSurface->IsLeashWindow()) {
continue;
}
Occlusion::Rect occlusionRect;
@ -791,7 +791,7 @@ void RSMainThread::CalcOcclusion()
if (!winDirty) {
for (auto it = curAllSurfaces.rbegin(); it != curAllSurfaces.rend(); ++it) {
auto surface = RSBaseRenderNode::ReinterpretCast<RSSurfaceRenderNode>(*it);
if (surface == nullptr) {
if (surface == nullptr || surface->IsLeashWindow()) {
continue;
}
if (surface->GetZorderChanged() || surface->GetDstRectChanged() ||

View File

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

View File

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

View File

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

View File

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