!10699 bugfix for ion memLeak

Merge pull request !10699 from QAZ/0505
This commit is contained in:
openharmony_ci 2024-05-06 07:44:03 +00:00 committed by Gitee
commit 8fbf7e6505
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 8 additions and 16 deletions

View File

@ -399,6 +399,9 @@ void RSDisplayRenderNodeDrawable::OnDraw(Drawing::Canvas& canvas)
canvasRotation_ = screenManager->GetCanvasRotation(params->GetScreenId());
auto mirroredNode = params->GetMirrorSource().lock();
if (!mirroredNode && displayNodeSp->GetCacheImgForCapture()) {
displayNodeSp->SetCacheImgForCapture(nullptr);
}
if (!mirroredNode && displayNodeSp->GetCacheImgForCapture()) {
mirroredNode->SetCacheImgForCapture(nullptr);
}
@ -472,7 +475,6 @@ void RSDisplayRenderNodeDrawable::OnDraw(Drawing::Canvas& canvas)
curCanvas_->SetBrightnessRatio(0.5f);
curCanvas_->SetScreenId(screenId);
}
curCanvas_->SetCurDisplayNode(displayNodeSp);
// canvas draw
{

View File

@ -183,7 +183,11 @@ void RSSurfaceRenderNodeDrawable::OnDraw(Drawing::Canvas& canvas)
}
Drawing::Region curSurfaceDrawRegion = CalculateVisibleRegion(uniParam, surfaceParams, surfaceNode, isuifirstNode);
// when surfacenode named "CapsuleWindow", cache the current canvas as SkImage for screen recording
auto curDisplayNode = rscanvas->GetCurDisplayNode();
auto curDisplayNode = surfaceParams->GetAncestorDisplayNode().lock()->ReinterpretCastTo<RSDisplayRenderNode>();
if (!curDisplayNode) {
RS_LOGE("surfaceNode GetAncestorDisplayNode() return nullptr");
return;
}
if (curDisplayNode && surfaceParams->GetName().find("CapsuleWindow") != std::string::npos) {
CacheImgForCapture(*rscanvas, curDisplayNode);
NodeId nodeId = FindInstanceChildOfDisplay(surfaceNode->GetParent().lock());

View File

@ -31,7 +31,6 @@
namespace OHOS {
namespace Rosen {
class RSDisplayRenderNode;
class RSB_EXPORT RSPaintFilterCanvasBase : public Drawing::Canvas {
public:
@ -154,8 +153,6 @@ public:
void PopDirtyRegion();
bool IsDirtyRegionStackEmpty();
Drawing::Region& GetCurDirtyRegion();
std::shared_ptr<RSDisplayRenderNode> GetCurDisplayNode() const;
void SetCurDisplayNode(std::shared_ptr<RSDisplayRenderNode> curDisplayNode);
// alpha related
void MultiplyAlpha(float alpha);
@ -320,7 +317,6 @@ protected:
}
private:
std::shared_ptr<RSDisplayRenderNode> curDisplayNode_ = nullptr;
Drawing::Surface* surface_ = nullptr;
std::stack<float> alphaStack_;
std::stack<Env> envStack_;

View File

@ -1235,16 +1235,6 @@ void RSPaintFilterCanvas::RestoreEnvToCount(int count)
}
}
std::shared_ptr<RSDisplayRenderNode> RSPaintFilterCanvas::GetCurDisplayNode() const
{
return curDisplayNode_;
}
void RSPaintFilterCanvas::SetCurDisplayNode(std::shared_ptr<RSDisplayRenderNode> curDisplayNode)
{
curDisplayNode_ = curDisplayNode;
}
int RSPaintFilterCanvas::GetEnvSaveCount() const
{
return envStack_.size();