diff options
author | Yuqian Yang <crupest@crupest.life> | 2025-09-07 11:46:11 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-09-07 11:46:11 +0800 |
commit | a0403d95bea3e3a3eaedf71a0d9c6d4e1316bd8c (patch) | |
tree | b97687f99055b04775b63b7bafd2c909a7074cdb /src/ui/render | |
parent | 20123151d12a0b01453ab6a36c84e4d3e5ea9504 (diff) | |
download | cru-a0403d95bea3e3a3eaedf71a0d9c6d4e1316bd8c.tar.gz cru-a0403d95bea3e3a3eaedf71a0d9c6d4e1316bd8c.tar.bz2 cru-a0403d95bea3e3a3eaedf71a0d9c6d4e1316bd8c.zip |
Use std::string in logger.
Diffstat (limited to 'src/ui/render')
-rw-r--r-- | src/ui/render/BorderRenderObject.cpp | 14 | ||||
-rw-r--r-- | src/ui/render/FlexLayoutRenderObject.cpp | 4 | ||||
-rw-r--r-- | src/ui/render/RenderObject.cpp | 22 | ||||
-rw-r--r-- | src/ui/render/TextRenderObject.cpp | 7 |
4 files changed, 25 insertions, 22 deletions
diff --git a/src/ui/render/BorderRenderObject.cpp b/src/ui/render/BorderRenderObject.cpp index 0e97c5e8..03fdff24 100644 --- a/src/ui/render/BorderRenderObject.cpp +++ b/src/ui/render/BorderRenderObject.cpp @@ -82,11 +82,13 @@ RenderObject* BorderRenderObject::HitTest(const Point& point) { void BorderRenderObject::Draw(platform::graphics::IPainter* painter) { if constexpr (debug_flags::draw) { CRU_LOG_TAG_DEBUG( - u"BorderRenderObject draw, background: {}, foreground: {}.", - background_brush_ == nullptr ? u"NONE" - : background_brush_->GetDebugString(), - foreground_brush_ == nullptr ? u"NONE" - : foreground_brush_->GetDebugString()); + "BorderRenderObject draw, background: {}, foreground: {}.", + background_brush_ == nullptr + ? "NONE" + : background_brush_->GetDebugString().ToUtf8(), + foreground_brush_ == nullptr + ? "NONE" + : foreground_brush_->GetDebugString().ToUtf8()); } if (background_brush_ != nullptr) @@ -95,7 +97,7 @@ void BorderRenderObject::Draw(platform::graphics::IPainter* painter) { if (is_border_enabled_) { if (border_brush_ == nullptr) { - CRU_LOG_TAG_WARN(u"Border is enabled but border brush is null."); + CRU_LOG_TAG_WARN("Border is enabled but border brush is null."); } else { painter->FillGeometry(geometry_.get(), border_brush_.get()); } diff --git a/src/ui/render/FlexLayoutRenderObject.cpp b/src/ui/render/FlexLayoutRenderObject.cpp index 588c379b..efc98602 100644 --- a/src/ui/render/FlexLayoutRenderObject.cpp +++ b/src/ui/render/FlexLayoutRenderObject.cpp @@ -90,7 +90,7 @@ Size FlexLayoutMeasureContentImpl( const MeasureRequirement& requirement, const MeasureSize& preferred_size, const std::vector<RenderObject*>& children, const std::vector<FlexChildLayoutData>& layout_data, - Alignment item_cross_align, String kLogTag) { + Alignment item_cross_align, std::string kLogTag) { Expects(children.size() == layout_data.size()); direction_tag_t direction_tag; @@ -301,7 +301,7 @@ Size FlexLayoutMeasureContentImpl( if (max_main_length.IsSpecified() && total_length > max_main_length.GetLengthOrUndefined()) { CRU_LOG_TAG_WARN( - u"(Measure) Children's main axis length exceeds required max length."); + "(Measure) Children's main axis length exceeds required max length."); total_length = max_main_length.GetLengthOrUndefined(); } else if (min_main_length.IsSpecified() && total_length < min_main_length.GetLengthOrUndefined()) { diff --git a/src/ui/render/RenderObject.cpp b/src/ui/render/RenderObject.cpp index b3a28d6d..1803a131 100644 --- a/src/ui/render/RenderObject.cpp +++ b/src/ui/render/RenderObject.cpp @@ -119,16 +119,16 @@ void RenderObject::Measure(const MeasureRequirement& requirement, preferred_size.OverrideBy(preferred_size_); if constexpr (cru::ui::debug_flags::layout) { - CRU_LOG_TAG_DEBUG(u"{} Measure begins :\nrequirement: {}\npreferred size: {}", - this->GetDebugPathInTree(), requirement.ToDebugString(), - preferred_size.ToDebugString()); + CRU_LOG_TAG_DEBUG("{} Measure begins :\nrequirement: {}\npreferred size: {}", + this->GetDebugPathInTree().ToUtf8(), requirement.ToDebugString().ToUtf8(), + preferred_size.ToDebugString().ToUtf8()); } desired_size_ = OnMeasureCore(merged_requirement, merged_preferred_size); if constexpr (cru::ui::debug_flags::layout) { - CRU_LOG_TAG_DEBUG(u"{} Measure ends :\nresult size: {}", - this->GetDebugPathInTree(), desired_size_); + CRU_LOG_TAG_DEBUG("{} Measure ends :\nresult size: {}", + this->GetDebugPathInTree().ToUtf8(), desired_size_); } Ensures(desired_size_.width >= 0); @@ -144,8 +144,8 @@ Size RenderObject::Measure1(const BoxConstraint& constraint) { void RenderObject::Layout(const Point& offset) { if constexpr (cru::ui::debug_flags::layout) { - CRU_LOG_TAG_DEBUG(u"{} Layout :\noffset: {} size: {}", - this->GetDebugPathInTree(), offset, desired_size_); + CRU_LOG_TAG_DEBUG("{} Layout :\noffset: {} size: {}", + this->GetDebugPathInTree().ToUtf8(), offset, desired_size_); } offset_ = offset; size_ = desired_size_; @@ -192,14 +192,14 @@ Size RenderObject::OnMeasureCore1(const BoxConstraint& constraint) { if (space_size.width > merged_constraint.max.width) { space_size.width = merged_constraint.max.width; - CRU_LOG_TAG_WARN(u"{} space width is over constraint.max.width", - this->GetDebugPathInTree()); + CRU_LOG_TAG_WARN("{} space width is over constraint.max.width", + this->GetDebugPathInTree().ToUtf8()); } if (space_size.height > merged_constraint.max.height) { space_size.height = merged_constraint.max.height; - CRU_LOG_TAG_WARN(u"{} space height is over constraint.max.height", - this->GetDebugPathInTree()); + CRU_LOG_TAG_WARN("{} space height is over constraint.max.height", + this->GetDebugPathInTree().ToUtf8()); } BoxConstraint content_constraint{merged_constraint.max - space_size, diff --git a/src/ui/render/TextRenderObject.cpp b/src/ui/render/TextRenderObject.cpp index 8a579041..346b4957 100644 --- a/src/ui/render/TextRenderObject.cpp +++ b/src/ui/render/TextRenderObject.cpp @@ -178,10 +178,11 @@ RenderObject* TextRenderObject::HitTest(const Point& point) { void TextRenderObject::Draw(platform::graphics::IPainter* painter) { if constexpr (debug_flags::draw) { CRU_LOG_TAG_DEBUG( - u"Begin to paint, total_offset: {}, size: {}, text_layout: " - u"{}, brush: {}.", + "Begin to paint, total_offset: {}, size: {}, text_layout: " + "{}, brush: {}.", this->GetTotalOffset(), this->GetDesiredSize(), - this->text_layout_->GetDebugString(), this->brush_->GetDebugString()); + this->text_layout_->GetDebugString().ToUtf8(), + this->brush_->GetDebugString().ToUtf8()); } if (this->selection_range_.has_value()) { |