Problem: rounded box lose the round corner when rotating - #322
Open
yihuang wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds screen-space scanline rasterization to preserve rounded corners for rotated flat boxes.
Changes:
- Updates rendering documentation.
- Adds rotated rounded-polygon generation and scanline emission.
- Routes rotated flat fills through the new path.
Open items include gradient rendering support, focused regression tests, and PSP performance benchmarking.
Suppressed comments (1)
engine/core/src/draw.rs:2099
- Rotated border-only rounded nodes never reach this new branch:
paintroutes them toemit_rounded_border, whose non-axis-aligned fallback is still four transformed rectangular strips. Therefore a rounded border with no background/gradient still loses its outer rounded corners when rotated, despite the PR's new rotated rounded-box behavior. Please cover this path as well.
if !world.is_axis_aligned() {
if let Fill::Flat(color) = fill {
self.emit_rotated_rounded_box(dl, world, x0, y0, x1, y1, radius, color, clip);
return;
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+2096
to
2101
| if !world.is_axis_aligned() { | ||
| if let Fill::Flat(color) = fill { | ||
| self.emit_rotated_rounded_box(dl, world, x0, y0, x1, y1, radius, color, clip); | ||
| return; | ||
| } | ||
| self.emit_box(dl, world, x0, y0, x1, y1, fill, clip); |
Comment on lines
+2075
to
+2076
| let screen: Vec<(f32, f32)> = pts.iter().map(|&(x, y)| world.apply(x, y)).collect(); | ||
| self.emit_rotated_flat_polygon(dl, &screen, color, clip); |
Comment on lines
+1988
to
+1998
| for py in iy0..iy1 { | ||
| let y = py as f32 + 0.5; | ||
| let mut xs = [0.0f32; 32]; | ||
| let mut n = 0usize; | ||
| for i in 0..pts.len() { | ||
| let (ax, ay) = pts[i]; | ||
| let (bx, by) = pts[(i + 1) % pts.len()]; | ||
| if (ay <= y && y < by) || (by <= y && y < ay) { | ||
| if n < xs.len() { | ||
| xs[n] = ax + (y - ay) * (bx - ax) / (by - ay); | ||
| n += 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
when rotating a rounded box, the round corner disappears.