Skip to content

gg: optimise the draw_rounded_rect_filled function#26390

Merged
spytheman merged 5 commits into
vlang:masterfrom
Linklancien:rewrite_draw_rounded_rect_filled
Jan 19, 2026
Merged

gg: optimise the draw_rounded_rect_filled function#26390
spytheman merged 5 commits into
vlang:masterfrom
Linklancien:rewrite_draw_rounded_rect_filled

Conversation

@Linklancien

Copy link
Copy Markdown
Contributor

This PR aims to optimise the draw_rounded_rect_filled function by changing how it works:
Now instead of drawing four corner and 3 rectangle, it draw the top part, the middle part using a rectangle and the bottom part

The top and bottom part are drawn as follow:
For each angle, you place a new point on each side, right and left using the sgl.begin_triangle_strip() primitive

@Linklancien

Copy link
Copy Markdown
Contributor Author

To check if this work as well as before, a new function has been added in #26389, that way we can compare if it doesn't break anything

Comment thread vlib/gg/draw.c.v Outdated

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Linklancien 🙇🏻 .

I could only test on macos, the result is that the before/after renders look the same to me 🥳, even though the code is less, and generates a smaller number of vertices.

Image

@spytheman spytheman merged commit 394abc1 into vlang:master Jan 19, 2026
76 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants