diff options
| author | Yuqian Yang <crupest@crupest.life> | 2025-12-11 23:51:58 +0800 |
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2025-12-11 23:51:58 +0800 |
| commit | c0c0106cf47fdff397756913b8646541f3bb9928 (patch) | |
| tree | 945d0a3662ac92577c966f49578e46ba743ea84b /src/ui/render/GeometryRenderObject.cpp | |
| parent | e833e810aaa324d7de1630c2fb0528564b182742 (diff) | |
| download | cru-c0c0106cf47fdff397756913b8646541f3bb9928.tar.gz cru-c0c0106cf47fdff397756913b8646541f3bb9928.tar.bz2 cru-c0c0106cf47fdff397756913b8646541f3bb9928.zip | |
Add paint invalid area.
Diffstat (limited to 'src/ui/render/GeometryRenderObject.cpp')
| -rw-r--r-- | src/ui/render/GeometryRenderObject.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/ui/render/GeometryRenderObject.cpp b/src/ui/render/GeometryRenderObject.cpp index 84379b39..1ab0d8ed 100644 --- a/src/ui/render/GeometryRenderObject.cpp +++ b/src/ui/render/GeometryRenderObject.cpp @@ -60,9 +60,23 @@ void GeometryRenderObject::SetStrokeWidth(float width) { InvalidatePaint(); } -void GeometryRenderObject::Draw(platform::graphics::IPainter* painter) { +RenderObject* GeometryRenderObject::HitTest(const Point& point) { + return GetPaddingRect().IsPointInside(point) ? this : nullptr; +} + +Size GeometryRenderObject::OnMeasureContent( + const MeasureRequirement& requirement) { + Size result = GetViewPort().GetSize(); + return requirement.ExpandToSuggestAndCoerce(result); +} + +void GeometryRenderObject::OnLayoutContent(const Rect& content_rect) {} + +void GeometryRenderObject::OnDraw(RenderObjectDrawContext& context) { if (!geometry_) return; + auto painter = context.painter; + painter->PushState(); auto content_rect = GetContentRect(); @@ -86,15 +100,4 @@ void GeometryRenderObject::Draw(platform::graphics::IPainter* painter) { painter->PopState(); } -RenderObject* GeometryRenderObject::HitTest(const Point& point) { - return GetPaddingRect().IsPointInside(point) ? this : nullptr; -} - -Size GeometryRenderObject::OnMeasureContent( - const MeasureRequirement& requirement) { - Size result = GetViewPort().GetSize(); - return requirement.ExpandToSuggestAndCoerce(result); -} - -void GeometryRenderObject::OnLayoutContent(const Rect& content_rect) {} } // namespace cru::ui::render |
