Path ops failure/bug

87 views
Skip to first unread message

Mike Clifton

unread,
Nov 6, 2024, 5:54:13 PM11/6/24
to skia-discuss
I'm using Skia's path ops and it mostly works great, but sometimes I'm getting failures when trying to combine what appear to be valid paths.

I've been able to create a reproducible case as a Skia fiddle:


Basically, I create two paths, an oval and a star. I then try to subtract the star from the circle. I get back a result path, but it's not what it should be. The picture here shows the outlines of the oval and star, and the red area is (what is supposed to be) circle - star.

If I tweak some of the coordinates slightly, I can get it to work. But am I doing something wrong, or is this a bug in path ops? Should I go ahead and file a bug?

Mike Clifton

unread,
Nov 6, 2024, 5:58:36 PM11/6/24
to skia-discuss
In this picture I've tweaked the coordinates of the star path. The result is a distorted star, but the path op gives the right result - the red area shows the star path subtracted from the oval shape. I'd like to get basically this result without distorting the star.



Jim Van Verth

unread,
Nov 7, 2024, 10:13:25 AM11/7/24
to skia-d...@googlegroups.com
That sounds like a bug, I'd go ahead and file it.

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/skia-discuss/23cc8aef-83ca-4aef-b143-352c38b490b1n%40googlegroups.com.


--

Jim Van Verth |
 Software Engineer | Google.com

Mike Clifton

unread,
Nov 7, 2024, 12:55:34 PM11/7/24
to skia-discuss
Ok, thanks. I've filed a bug here:

Mike Clifton

unread,
Mar 20, 2025, 3:19:18 PM3/20/25
to skia-discuss
This issue is still something I'm struggling with, but I learned something new about it. So here's a little update.

Here's the initial Skia fiddle that shows the problem (PathOps fails in some situations):

But here's a new fiddle that works. In this case, I took the path coordinates from my original example and scaled them down by 1000 times. Same basic paths, just scaled down. And now the PathOps works correctly:

The red region is the circle minus the star, and the black lines illustrate the original circle and star paths.

My new question I guess is, does anyone know why the smaller coordinates work correctly, while the bigger numbers fail? Is there some "sweet spot" of numbers that are safer for use with PathOps? I can rescale paths up or down, do the path ops, then scale them back to their original coordinates, but how do I know what this safe range might be?

If this can't be easily fixed, is there someone who might be able to give some guidance on the safe numerical range for path coordinates?

Reply all
Reply to author
Forward
0 new messages