Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pico_svg] Encode group transform in scene #609

Merged
merged 1 commit into from
Jun 20, 2024
Merged

[pico_svg] Encode group transform in scene #609

merged 1 commit into from
Jun 20, 2024

Conversation

raphlinus
Copy link
Contributor

Build the scene recursively, applying the transform at group nodes, rather than flattening to a single list of items. This causes the transform to be applied correctly to stroke styles, which among other things fixes the rendering of the waves example from the Nehab timings data set.

We're deliberately keeping things minimal, but if we were to add other properties to groups (clips, opacity, etc), then this change would support that.

Build the scene recursively, applying the transform at group nodes, rather than flattening to a single list of items. This causes the transform to be applied correctly to stroke styles, which among other things fixes the rendering of the waves example from the Nehab timings data set.

We're deliberately keeping things minimal, but if we were to add other properties to groups (clips, opacity, etc), then this change would support that.
Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

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

I've not tested this on the scene which sees an improvement, but this is only in example code, so it should be fine

@@ -71,6 +71,38 @@ fn example_scene_of(file: PathBuf) -> ExampleScene {
}
}

fn render_svg_rec(items: &[crate::pico_svg::Item]) -> Scene {
Copy link
Member

Choose a reason for hiding this comment

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

I don't really like this function name; I'm not familiar with this _rec naming scheme being used.

Unfortunately, I don't have a better suggestion at the moment, so it's probably fine to keep?

examples/scenes/src/svg.rs Show resolved Hide resolved
@raphlinus raphlinus added this pull request to the merge queue Jun 20, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 20, 2024
@DJMcNab DJMcNab added this pull request to the merge queue Jun 20, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 20, 2024
@xStrom xStrom added this pull request to the merge queue Jun 20, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 20, 2024
@xStrom xStrom added this pull request to the merge queue Jun 20, 2024
Merged via the queue into main with commit fb947d6 Jun 20, 2024
16 checks passed
@xStrom xStrom deleted the svg_affine branch June 20, 2024 20:38
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.

3 participants