diff --git a/frameworks/core/components_ng/pattern/image/image_dfx.h b/frameworks/core/components_ng/pattern/image/image_dfx.h index 40316f7ca607472e208dc233627f298ce8535ce6..b74d5352ba58146a89b8ba2086cc07072ad6a4ac 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 f9b5d9a9429714e5fc9c25440410912f0c23ffa1..c7a00358e93a015a18c6df8b4b25c9f7935fb923 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 a3c0ac0802cf77196f33df0a0530058c85b52f96..34266cc0f22033424925a79e10783d2df9e55dc6 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;