fixResetReqBugs

Signed-off-by: hw_wyx <wuyinxiao@huawei.com>
Change-Id: Id94aa2ea2ef5c1fca4c9f8db935325e9394ef49c
This commit is contained in:
hw_wyx 2024-07-20 16:32:59 +08:00
parent f42a5b234b
commit 89086303bb
2 changed files with 16 additions and 1 deletions

View File

@ -132,6 +132,19 @@ void ImageModelNG::ResetImage()
CHECK_NULL_VOID(pattern);
pattern->SetNeedLoadAlt(false);
pattern->ResetImageAndAlt();
if (pattern->GetImageType() == ImagePattern::ImageType::ANIMATION) {
if (pattern->GetHasSizeChanged()) {
pattern->ResetPictureSize();
}
pattern->StopAnimation();
pattern->ResetImages();
if (!frameNode->GetChildren().empty()) {
auto imageFrameNode = AceType::DynamicCast<FrameNode>(frameNode->GetChildren().front());
ACE_RESET_NODE_LAYOUT_PROPERTY(ImageLayoutProperty, ImageSourceInfo, imageFrameNode);
frameNode->RemoveChild(imageFrameNode);
}
pattern->SetImageType(ImagePattern::ImageType::BASE);
}
}
void ImageModelNG::ResetImage(FrameNode* frameNode)

View File

@ -520,7 +520,7 @@ RefPtr<NodePaintMethod> ImagePattern::CreateNodePaintMethod()
return MakeRefPtr<ImagePaintMethod>(
obscuredImage_, isSelected_, overlayMod_, sensitive, interpolationDefault_);
}
return nullptr;
return MakeRefPtr<ImagePaintMethod>(nullptr, isSelected_, overlayMod_, sensitive, interpolationDefault_);
}
bool ImagePattern::OnDirtyLayoutWrapperSwap(const RefPtr<LayoutWrapper>& dirty, const DirtySwapConfig& config)
@ -2027,6 +2027,8 @@ void ImagePattern::ResetImageAndAlt()
auto rsRenderContext = frameNode->GetRenderContext();
CHECK_NULL_VOID(rsRenderContext);
rsRenderContext->ClearDrawCommands();
CloseSelectOverlay();
DestroyAnalyzerOverlay();
frameNode->MarkDirtyNode(PROPERTY_UPDATE_RENDER);
}