Improve snapshot clearing consistency

Updated snapshot result to clear the
internal SkImage whenever the layer changes.
The previous logic did not clear out the snapshot
in various use cases. Because the implementation
before relied on the snapshot created with SkSurface
this makes the cleanup logic consistent with SkImages
created with SkImage::makeWithFilter

Bug: 188450217
Test: manual testing of discord app
Change-Id: I6391eb3b49794e54705bf5c6a09d2bdfd0564d05
This commit is contained in:
Nader Jawad
2021-06-17 14:10:04 -07:00
parent a388d2533d
commit b502ad7847
2 changed files with 6 additions and 2 deletions

View File

@@ -455,8 +455,7 @@ void RenderNode::destroyLayers() {
if (hasLayer()) {
this->setLayerSurface(nullptr);
}
mSnapshotResult.snapshot = nullptr;
mTargetImageFilter = nullptr;
if (mDisplayList) {
mDisplayList.updateChildren([](RenderNode* child) { child->destroyLayers(); });
}

View File

@@ -330,6 +330,11 @@ public:
} else {
mSkiaLayer.reset();
}
// Clear out the previous snapshot and the image filter the previous
// snapshot was created with whenever the layer changes.
mSnapshotResult.snapshot = nullptr;
mTargetImageFilter = nullptr;
}
/**