-
Notifications
You must be signed in to change notification settings - Fork 69
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
Optimize rectangular clipping #10
Comments
Hey! I'm relying on rectangular clipping quite a bit in the upcoming software renderer for I'd be willing to take a stab at this. Is it something you'd prefer to implement yourself? If not, any specific pointers? |
Well... it's an extremely hard thing to do even for myself. You have to have a very deep understanding of how Skia/tiny-skia works to do so. Not to mention that clipping in Skia and tiny-skia are completely different. Skia's implementation is miles more complicated (it's like 3000 LOC), but way faster. And tiny-skia's one is basically an afterthought. I don't have a good answer here. tiny-skia, de-facto, is the best CPU 2D library for Rust, sure, but it still sucks! There are months of work left and I have zero time now and in the future. If you want to dive into this - go ahead. But I don't really have any guidance for you. And there is no point into looking how Skia works, because clipping in tiny-skia is completely different, at least right now. The only hint I can give you is that Skia/tiny-skia works in two steps. First, it crates a horizontal "run", a line of pixels that should be blittered/rendered. And then it passes it to the rendering pipeline. Line-by-line. Honestly, I think you would be better off using smaller Pixmaps instead of masks. This would give you rectangular masks for free. Basically, instead of having a large Pixmap + clip rect, you can just create a smaller Pixmap, render on top of it (make sure to translate/transform your "layers" accordingly) and then blend it back to the main Pixmap. PS: I really hope someone would write a brand new 2D CPU library instead of tiny-skia, but I highly double of that. It's a really hard task. And in the mean time, tiny-skia is basically an abandonware. |
Omit alpha mask generation for a simple rectangle.
The text was updated successfully, but these errors were encountered: