!38316 【bug】reset需求问题修复

Merge pull request !38316 from 吴寅潇/fixResetReqBugs
This commit is contained in:
openharmony_ci 2024-07-20 10:54:46 +00:00 committed by Gitee
commit 95dae27f1f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
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);
}