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

render: Stroke paths with tiny-skia-path #11062

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

torokati44
Copy link
Member

@torokati44 torokati44 commented May 15, 2023

This is supposed to fix #7565 by not using lyon's StrokeTessellator - instead, for strokes, converting the Ruffle path to a tiny_skia_path::Path first, then running a tiny_skia_path::PathStroker on it, then converting that to a lyon path, and tessellating it as a fill with a non-zero fill rule.

It's dumb and probably slow, but hey, it seems to work.

Fixes #13656, and fixes #13658 too.

@Dinnerbone
Copy link
Contributor

probably slow

Any metrics on this already or do you want me to benchmark something?

@torokati44
Copy link
Member Author

No metrics yet at all. I am currently just surprised that this approach even works as well as it appears to do (and first try, thanks Rust!).

I plan to do some benchmarking soon, but if you find the time and initiative, more eyes on it can't hurt.
Although I don't think this is in its final form yet.

Related: I suppose a wireframe rendering mode could come in handy for debugging/visualization/coolness purposes... I know it's not as simple now as back in the old GL_LINE_LOOP days, but any rudimentary solution would be fine for this.

@torokati44 torokati44 force-pushed the tiny-skia-path branch 3 times, most recently from e7cdf1d to cb7611b Compare May 20, 2023 22:43
@torokati44 torokati44 force-pushed the tiny-skia-path branch 2 times, most recently from 290ee34 to fec7ab2 Compare June 8, 2023 00:24
@torokati44 torokati44 force-pushed the tiny-skia-path branch 6 times, most recently from 10d2ff0 to f0421b7 Compare June 17, 2023 16:15
@torokati44 torokati44 marked this pull request as ready for review June 17, 2023 23:26
@torokati44 torokati44 force-pushed the tiny-skia-path branch 2 times, most recently from ec669bd to 9d3be60 Compare June 18, 2023 20:54
@torokati44 torokati44 added A-rendering Area: Rendering & Graphics waiting-on-review Waiting on review from a Ruffle team member labels Jun 18, 2023
@torokati44 torokati44 force-pushed the tiny-skia-path branch 2 times, most recently from 8dc3171 to d95d5d4 Compare June 25, 2023 22:01
@torokati44 torokati44 marked this pull request as draft July 10, 2023 13:57
@torokati44 torokati44 marked this pull request as ready for review July 18, 2023 23:24
@torokati44 torokati44 force-pushed the tiny-skia-path branch 2 times, most recently from 93a8de4 to a2451eb Compare October 23, 2023 22:25
@torokati44
Copy link
Member Author

Somewhat related, for debugging/verifying/inspecting purposes: #11880

@torokati44
Copy link
Member Author

One small problem with this is that tiny-skia-path does not support different line cap styles at the start and the end of a path. I can try to add and PR this, but no promises. It's not that often needed, AFAIK only available through the Graphics drawing API (or something like that), and not from SWF tags.

Also, the exact dotting/dashing algorithm might be different (see the updated avm2/graphics_direct_commands expected test output) but I don't find this to be that big a deal.

And finally, this way of making a stroke mesh might, in some rare cases (such as in the linked z0r.de loop) produce highly suboptimal meshes, with lots of unnecessary internal vertices. While we could try to be clever and throw those away, I don't think the additional CPU overhead of the already slow tessellation justifies the handful of vertices saved for the GPU. I could be wrong though...

@danielhjacobs danielhjacobs added the T-fix Type: Bug fix (in something that's supposed to work already) label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rendering Area: Rendering & Graphics T-fix Type: Bug fix (in something that's supposed to work already) waiting-on-review Waiting on review from a Ruffle team member
Projects
None yet
3 participants