From 7f31566c5895dad00997720f78ef2a0584ca3fa2 Mon Sep 17 00:00:00 2001 From: m00472246 Date: Fri, 1 Sep 2023 17:37:31 +0800 Subject: [PATCH] =?UTF-8?q?getBounds=E5=9C=A8PathLayoutAlgorithm::MeasureC?= =?UTF-8?q?ontent=E4=B8=AD=E6=9B=BF=E6=8D=A2=20Signed-off-by:=20m00472246?= =?UTF-8?q?=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: m00472246 --- .../pattern/shape/path_layout_algorithm.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frameworks/core/components_ng/pattern/shape/path_layout_algorithm.cpp b/frameworks/core/components_ng/pattern/shape/path_layout_algorithm.cpp index 66d4bad61b51..ae60bf01e8da 100644 --- a/frameworks/core/components_ng/pattern/shape/path_layout_algorithm.cpp +++ b/frameworks/core/components_ng/pattern/shape/path_layout_algorithm.cpp @@ -22,6 +22,7 @@ #include "base/utils/utils.h" #include "core/components_ng/base/frame_node.h" #include "core/components_ng/pattern/shape/path_paint_property.h" +#include "core/components_ng/render/drawing.h" namespace OHOS::Ace::NG { namespace { @@ -45,12 +46,20 @@ std::optional PathLayoutAlgorithm::MeasureContent( auto pathCommands = paintProperty->GetCommandsValue(""); CHECK_NULL_RETURN(!pathCommands.empty(), SizeF()); +#ifndef USE_ROSEN_DRAWING SkPath skPath; bool ret = SkParsePath::FromSVGString(pathCommands.c_str(), &skPath); CHECK_NULL_RETURN(ret, SizeF()); auto skRect = skPath.getBounds(); auto right = skRect.right(); auto bottom = skRect.bottom(); +#else + RSRecordingPath rsRecordingPath; + rsRecordingPath.BuildFromSVGSting(pathCommands); + auto rsRect = rsRecordingPath.GetBounds(); + auto right = rsRecordingPath.GetRight(); + auto bottom = rsRecordingPath.GetBottom(); +#endif if (NearZero(right) && NearZero(bottom)) { return SizeF(); } -- Gitee