From 2699e1573421d1064e2e864c01a506411e05fa49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=85=A8=E8=B6=85?= Date: Fri, 12 Sep 2025 11:32:57 +0800 Subject: [PATCH] =?UTF-8?q?image=E7=BB=84=E4=BB=B6supportSvg2=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E6=B7=BB=E5=8A=A0DumpInfo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张全超 --- .../components_ng/pattern/image/image_pattern.cpp | 2 +- frameworks/core/image/image_source_info.cpp | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/frameworks/core/components_ng/pattern/image/image_pattern.cpp b/frameworks/core/components_ng/pattern/image/image_pattern.cpp index ebc43e5b36b..ac9b399a825 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 9d26e27be32..be32818505a 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) -- Gitee