From ae8846f7ff8daf99748cb6a3c9535127c71a521a Mon Sep 17 00:00:00 2001 From: huangzhongyan Date: Fri, 5 Sep 2025 17:08:09 +0800 Subject: [PATCH 1/3] =?UTF-8?q?image=5Fdfx=E5=A2=9E=E5=8A=A0autoResize?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huangzhongyan Change-Id: I3ed594996653913c2431ee579a15a7d81b9ee077 --- .../core/components_ng/pattern/image/image_dfx.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/frameworks/core/components_ng/pattern/image/image_dfx.h b/frameworks/core/components_ng/pattern/image/image_dfx.h index 40316f7ca60..9b1ce779135 100644 --- a/frameworks/core/components_ng/pattern/image/image_dfx.h +++ b/frameworks/core/components_ng/pattern/image/image_dfx.h @@ -31,8 +31,8 @@ struct ImageNodeId { class ImageDfxConfig { public: ImageDfxConfig( - const ImageNodeId& nodeInfo, int32_t srcType, std::string imageSrc, bool isTrimMemRecycle = false) - : nodeInfo_(nodeInfo), srcType_(srcType), imageSrc_(imageSrc), isTrimMemRecycle_(isTrimMemRecycle) + const ImageNodeId& nodeInfo, int32_t srcType, std::string imageSrc, bool isTrimMemRecycle = false, bool autoResize = false) + : nodeInfo_(nodeInfo), srcType_(srcType), imageSrc_(imageSrc), isTrimMemRecycle_(isTrimMemRecycle), autoResize_(autoResize) { InitToStringWithoutSrc(); InitToStringWithSrc(); @@ -55,6 +55,11 @@ public: return isTrimMemRecycle_; } + bool GetAutoResize() const + { + return autoResize_; + } + int32_t GetNodeId() const { return nodeInfo_.nodeId_; @@ -63,7 +68,9 @@ public: int64_t GetAccessibilityId() const { return nodeInfo_.accessibilityId_; - } + } + + std::string GetImageSrc() const { @@ -95,6 +102,7 @@ private: std::string withSrcInfo_ = ""; float frameSizeWidth_ = 0.0f; float frameSizeHeight_ = 0.0f; + bool autoResize_ = false; void InitToStringWithoutSrc() { @@ -106,6 +114,7 @@ private: .append(std::to_string(nodeInfo_.canvasNodeId_)) .append("-") .append(std::to_string(srcType_)) + .append(autoResize_ ? "true" : "false") .append("]"); } @@ -121,6 +130,7 @@ private: .append(std::to_string(srcType_)) .append("]-[") .append(imageSrc_) + .append(autoResize_ ? "true" : "false") .append("]"); } }; -- Gitee From fd157e022026e524de08ac1e11cc06a9bdc2714f Mon Sep 17 00:00:00 2001 From: huang-zhongyan Date: Sat, 6 Sep 2025 10:02:09 +0800 Subject: [PATCH 2/3] =?UTF-8?q?Revert=20"image=5Fdfx=E5=A2=9E=E5=8A=A0auto?= =?UTF-8?q?Resize=E4=BF=A1=E6=81=AF"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ae8846f7ff8daf99748cb6a3c9535127c71a521a. --- .../core/components_ng/pattern/image/image_dfx.h | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/frameworks/core/components_ng/pattern/image/image_dfx.h b/frameworks/core/components_ng/pattern/image/image_dfx.h index 9b1ce779135..40316f7ca60 100644 --- a/frameworks/core/components_ng/pattern/image/image_dfx.h +++ b/frameworks/core/components_ng/pattern/image/image_dfx.h @@ -31,8 +31,8 @@ struct ImageNodeId { class ImageDfxConfig { public: ImageDfxConfig( - const ImageNodeId& nodeInfo, int32_t srcType, std::string imageSrc, bool isTrimMemRecycle = false, bool autoResize = false) - : nodeInfo_(nodeInfo), srcType_(srcType), imageSrc_(imageSrc), isTrimMemRecycle_(isTrimMemRecycle), autoResize_(autoResize) + const ImageNodeId& nodeInfo, int32_t srcType, std::string imageSrc, bool isTrimMemRecycle = false) + : nodeInfo_(nodeInfo), srcType_(srcType), imageSrc_(imageSrc), isTrimMemRecycle_(isTrimMemRecycle) { InitToStringWithoutSrc(); InitToStringWithSrc(); @@ -55,11 +55,6 @@ public: return isTrimMemRecycle_; } - bool GetAutoResize() const - { - return autoResize_; - } - int32_t GetNodeId() const { return nodeInfo_.nodeId_; @@ -68,9 +63,7 @@ public: int64_t GetAccessibilityId() const { return nodeInfo_.accessibilityId_; - } - - + } std::string GetImageSrc() const { @@ -102,7 +95,6 @@ private: std::string withSrcInfo_ = ""; float frameSizeWidth_ = 0.0f; float frameSizeHeight_ = 0.0f; - bool autoResize_ = false; void InitToStringWithoutSrc() { @@ -114,7 +106,6 @@ private: .append(std::to_string(nodeInfo_.canvasNodeId_)) .append("-") .append(std::to_string(srcType_)) - .append(autoResize_ ? "true" : "false") .append("]"); } @@ -130,7 +121,6 @@ private: .append(std::to_string(srcType_)) .append("]-[") .append(imageSrc_) - .append(autoResize_ ? "true" : "false") .append("]"); } }; -- Gitee From df07e39baac1698de1676ba8aef9f0e8d007c305 Mon Sep 17 00:00:00 2001 From: huang-zhongyan Date: Sat, 6 Sep 2025 10:55:10 +0800 Subject: [PATCH 3/3] =?UTF-8?q?image=5Fdfx=E5=A2=9E=E5=8A=A0=E6=88=90?= =?UTF-8?q?=E5=91=98=E5=8F=98=E9=87=8FautoResize/Trace-DrawToRSCanvas=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0autoResize=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huang-zhongyan Change-Id: I059be58683fe3fc4a86dba8a7c8bfba636da35ff Signed-off-by: huang-zhongyan --- .../components_ng/pattern/image/image_dfx.h | 17 +++++++++++++++-- .../pattern/image/image_pattern.cpp | 1 + .../render/adapter/pixelmap_image.cpp | 4 ++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/frameworks/core/components_ng/pattern/image/image_dfx.h b/frameworks/core/components_ng/pattern/image/image_dfx.h index 40316f7ca60..b74d5352ba5 100644 --- a/frameworks/core/components_ng/pattern/image/image_dfx.h +++ b/frameworks/core/components_ng/pattern/image/image_dfx.h @@ -31,8 +31,8 @@ struct ImageNodeId { class ImageDfxConfig { public: ImageDfxConfig( - const ImageNodeId& nodeInfo, int32_t srcType, std::string imageSrc, bool isTrimMemRecycle = false) - : nodeInfo_(nodeInfo), srcType_(srcType), imageSrc_(imageSrc), isTrimMemRecycle_(isTrimMemRecycle) + const ImageNodeId& nodeInfo, int32_t srcType, std::string imageSrc, bool isTrimMemRecycle = false, bool autoResize = false) + : nodeInfo_(nodeInfo), srcType_(srcType), imageSrc_(imageSrc), isTrimMemRecycle_(isTrimMemRecycle), autoResize_(autoResize) { InitToStringWithoutSrc(); InitToStringWithSrc(); @@ -55,6 +55,16 @@ public: return isTrimMemRecycle_; } + void SetAutoResize(bool autoResize) + { + autoResize_ = autoResize; + } + + bool GetAutoResize() const + { + return autoResize_; + } + int32_t GetNodeId() const { return nodeInfo_.nodeId_; @@ -95,6 +105,7 @@ private: std::string withSrcInfo_ = ""; float frameSizeWidth_ = 0.0f; float frameSizeHeight_ = 0.0f; + bool autoResize_ = false; void InitToStringWithoutSrc() { @@ -106,6 +117,7 @@ private: .append(std::to_string(nodeInfo_.canvasNodeId_)) .append("-") .append(std::to_string(srcType_)) + .append(autoResize_ ? "true" : "false") .append("]"); } @@ -121,6 +133,7 @@ private: .append(std::to_string(srcType_)) .append("]-[") .append(imageSrc_) + .append(autoResize_ ? "true" : "false") .append("]"); } }; diff --git a/frameworks/core/components_ng/pattern/image/image_pattern.cpp b/frameworks/core/components_ng/pattern/image/image_pattern.cpp index f9b5d9a9429..c7a00358e93 100644 --- a/frameworks/core/components_ng/pattern/image/image_pattern.cpp +++ b/frameworks/core/components_ng/pattern/image/image_pattern.cpp @@ -654,6 +654,7 @@ void ImagePattern::StartDecoding(const SizeF& dstSize) const auto& props = DynamicCast(host->GetLayoutProperty()); CHECK_NULL_VOID(props); bool autoResize = props->GetAutoResize().value_or(autoResizeDefault_); + imageDfxConfig_.SetAutoResize(autoResize); ImageFit imageFit = props->GetImageFit().value_or(ImageFit::COVER); const std::optional& sourceSize = props->GetSourceSize(); diff --git a/frameworks/core/components_ng/render/adapter/pixelmap_image.cpp b/frameworks/core/components_ng/render/adapter/pixelmap_image.cpp index a3c0ac0802c..34266cc0f22 100644 --- a/frameworks/core/components_ng/render/adapter/pixelmap_image.cpp +++ b/frameworks/core/components_ng/render/adapter/pixelmap_image.cpp @@ -336,8 +336,8 @@ void PixelMapImage::DrawToRSCanvas( if (CheckIfNeedForStretching(canvas, srcRect, dstRect, radiusXY)) { return; } - ACE_SCOPED_TRACE("DrawToRSCanvas %s-%f-%f-%d-%d", dfxConfig.ToStringWithSrc().c_str(), - dfxConfig.GetFrameSizeWidth(), dfxConfig.GetFrameSizeHeight(), pixmap->GetWidth(), pixmap->GetHeight()); + ACE_SCOPED_TRACE("DrawToRSCanvas %s-%f-%f-%d-%d-%d", dfxConfig.ToStringWithSrc().c_str(), + dfxConfig.GetFrameSizeWidth(), dfxConfig.GetFrameSizeHeight(), pixmap->GetWidth(), pixmap->GetHeight(), autoResize->dfxConfig.GetAutoResize()); const auto& config = GetPaintConfig(); RSBrush brush; RSSamplingOptions options; -- Gitee