diff --git a/frameworks/core/components_ng/pattern/image/image_pattern.cpp b/frameworks/core/components_ng/pattern/image/image_pattern.cpp index ebc43e5b36b59d8c9e4b94c84b595c6c60e9c27c..ac9b399a825cf6e1a734c72531eb64cfbf8e80e4 100644 --- a/frameworks/core/components_ng/pattern/image/image_pattern.cpp +++ b/frameworks/core/components_ng/pattern/image/image_pattern.cpp @@ -2770,7 +2770,7 @@ void ImagePattern::DumpInfo(std::unique_ptr& json) } else { json->Put("imageLoadingContext", "null"); } - + json->Put("supportSvg2", supportSvg2_); json->Put("draggable", enableDrag_); json->Put("enableAnalyzer", isEnableAnalyzer_); } diff --git a/frameworks/core/image/image_source_info.cpp b/frameworks/core/image/image_source_info.cpp index 9d26e27be32ef7664350097f3220c4feb0790973..be32818505a8a83264089b1dd277e8399864402b 100644 --- a/frameworks/core/image/image_source_info.cpp +++ b/frameworks/core/image/image_source_info.cpp @@ -406,11 +406,18 @@ bool ImageSourceInfo::SupportObjCache() const std::string ImageSourceInfo::GetKey() const { + std::string key = cacheKey_; + if (!isSvg_) { + return key; + } // only svg sets fillColor - if (isSvg_ && fillColor_.has_value()) { - return cacheKey_ + fillColor_.value().ColorToString(); + if (fillColor_.has_value()) { + key += fillColor_.value().ColorToString(); + } + if (IsSupportSvg2()) { + key += "supportSvg2"; } - return cacheKey_; + return key; } void ImageSourceInfo::SetContainerId(int32_t containerId)