Skip to content

Problem: rounded box lose the round corner when rotating - #322

Open
yihuang wants to merge 1 commit into
pocket-stack:mainfrom
yihuang:fix-roundbox
Open

Problem: rounded box lose the round corner when rotating#322
yihuang wants to merge 1 commit into
pocket-stack:mainfrom
yihuang:fix-roundbox

Conversation

@yihuang

@yihuang yihuang commented Aug 22, 2026

Copy link
Copy Markdown

when rotating a rounded box, the round corner disappears.

Copilot AI lite review requested due to automatic review settings August 22, 2026 06:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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: paint routes them to emit_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 thread engine/core/src/draw.rs
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 thread engine/core/src/draw.rs
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 thread engine/core/src/draw.rs
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;
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