-
Notifications
You must be signed in to change notification settings - Fork 188
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
Consider using tiny-skia #357
Comments
hi, thank you nice work 🙂. Looks promising I will try to create a |
|
@arctic-alpaca with the text drawing should be not problem, we uses for raqote also a custom implementation based on |
@arctic-alpaca raqote has a very rudimentary text support which relies on system libraries. I plan to use a pure Rust implementation eventually. |
Thanks for the explanations! |
@arctic-alpaca you are welcome. Yes that is the main effort of implement a new render backend. What you have to do then is to connect you RenderContext2D with a window. That is done inside of the shell crate. But with |
maybe it is worth to creating a RenderBackend trait. |
@kivimango yes that's the plan 🙂. And I want to separate each render and window backend in a own crate. This will reduce a lot of |
With the upcoming milestone alpha5 I want to do same further performance improvements. And I will also start an experimental tiny-skia render backend. |
Glad to here. After 3 weeks, I'm still at 90%. This is just how software development works. =) The library become 20-50% faster and there are only two things left: stroke dashing (easy) and clipping (hard). Once again, I hope to finish in two weeks. But we'll see. From the performance prospective, tiny-skia is 2-3x faster than cairo in most cases, but there are still weird cases when cairo is faster. And compared to raqote, we are 4-7x faster, depending on a task. Also, unlike raqote, tiny-skia supports bicubic bitmaps transformation and hairline stroking (stroke-width < 1px). |
That's true ;-)
That's great I think clippling is the last part we currently need from tiny skia. |
Here is an implementation of the tiny-skia backend, currently is not complete but is understandable for the majority of the widgets, missing functionalities needed to finish it:
Also, I have a problem with the gradients, for some reason they don't work, and |
Yes, clipping with path will be supported in the release.
Skia converts Arcs to conic curves and then into quads. So it still not as perfect, I guess. tiny-skia skips arcs completely for now.
Can you provide the input values you are using? |
I think is better with the context, I checked the input in which it fails is not empty and its two points are separated, also it fails in
I saw the roadmap thank you!
Well, then I will implement them with beziers, thanks |
Yes, I saw this code. I'm asking about the actual values/number, so I can try to reproduce it myself.
Looks like a malformed transform for me. |
Sorry, here is the input values for one of the gradients of the calculator example:
I'm using |
Thanks. I was able to reproduce it. Will see what's wrong. PS: this is because start_x and end_x are the same. Not sure why this is a problem. |
It wasn't a trivial fix, but it's fixed now. |
Thank you very much, your crate is pretty fast |
Does it visually noticeable compared to raqote? |
Very, I don't know if I'm oversensitive but for me is a great speed up. You can check yourself. |
Nice to hear. I will add |
@sandmor I've added |
Thanks, but you don't have to run so much 😄, this of anyway will not get merged until at least rectangular clipping gets supported. |
@sandmor I've just added clipping. |
@RazrFalcon Thank you, currently I'm working in the arcs, draw the extremes is a bit complex but with the help of Stack Overflow I expect to soon have the function ended then I will look into the path and if there is another bugs on my implementation, if not I will do a pull request, Thanks! |
@RazrFalcon is |
@sandmor I can port Skia's implementation of arc if you like. It's very robust. No,
This must not happen. Could you provide a minimal example?
What paths? Clip paths? |
Don't worry I already implemented it, although I'd appreciate if you can view some obvious optimization on my code.... I think it have too many conditions I tried to decrease them but I don't have many experience with this. |
Yes, This is the one I'm using in
It was already fixed. At least on my tests. |
Yeah, good idea, but then I need some tools: The capability of get and set the clippping mask, and the capability to overlap a path area over a clipping mask or if you can maintain simple the things at cost of some performance then only the power of generate a clipping mask from a path and then I manually merge the result with the current clipping mask
So... I can not see how it draws an arc, only calculates some parameters, I can do that with sin/cos, the problem is calculate the bezier control points needed to trace the arc contour but don't worry you have reason, the performance is negligible in this case I only like to make the things as efficiently as possible... even if somethings sacrifice some code prettiness |
Merged in. |
Since you're already using
raqote
, I though you might be interest in a faster, more actively developed alternative.tiny-skia is a direct
raqote
rival. It's basically a Skia CPU subset ported to pure Rust.And it's usually 2-6x faster than
raqote
, while still 2-3 times slower than Skia (it's mainly SIMD issues). In many cases it's even faster thancairo
.Is still in development (90% is done) and I plan to use it in resvg very soon. And I'm interested in any kind of feedback.
The text was updated successfully, but these errors were encountered: