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

New svg renderer #93

Open
redhog opened this issue Sep 25, 2023 · 8 comments
Open

New svg renderer #93

redhog opened this issue Sep 25, 2023 · 8 comments

Comments

@redhog
Copy link
Owner

redhog commented Sep 25, 2023

@IanTrudel
Copy link
Collaborator

This should be in #51! We had a lengthy conversation about it.

Skia/CEF are most likely the best option in terms of reliability, robustness and performance. They are essentially the backbone of Chrome and Chromium.

I have been experimenting with libcef in C here and there. It needs a proper wrapper because it's written in C++.

@redhog
Copy link
Owner Author

redhog commented Dec 7, 2023

It would be advantageous to have one where the DOM is accessible via the API, and DOM and CSS can also be changed via the API (and the image rerendered). Can Skia do this?
I remeber looking at Skia and discarding it because of C++, but writing a wrapper might be worth it?

@IanTrudel
Copy link
Collaborator

It would be advantageous to have one where the DOM is accessible via the API, and DOM and CSS can also be changed via the API (and the image rerendered). Can Skia do this? I remeber looking at Skia and discarding it because of C++, but writing a wrapper might be worth it?

Skia would be an excellent replacement for cairo. It would be worth writing a wrapper for it. As far as DOM and CSS are concerned, what you have in mind would be using CEF (Chrome Embedded Framework). CEF also includes Skia anyway. It would also need a wrapper but the possibilities for us would be endless if we get that in InfiniteGlass.

We would have access to the DOM, Canvas/SVG, HTML, JavaScript, and a blazing fast rendering for anything we use it for. That's essentially why so many applications are embedding CEF.

@redhog
Copy link
Owner Author

redhog commented Dec 12, 2023

How much RAM does CEF eat though? It is a bit scary to put too heave stuff in the renderer, esp. as it is a single process...

@IanTrudel
Copy link
Collaborator

How much RAM does CEF eat though? It is a bit scary to put too heave stuff in the renderer, esp. as it is a single process...

The short answer would be this has to be checked.

It's widely used in a variety of applications, which likely means memory usage is acceptable. It may tend to grow over time but it can be mitigated in various ways such as using cgroups.

Running this in a single process shouldn't be a problem but it has risks. Chrome/Chromium, for example, are running tabs in independent processes, allowing restoring a tab when it crashes without crashing the browser. GIL will however be removed and multiple processes are coming to Python.

I don't want to oversell CEF. The highlights are the features it provides, e.g. everything on your wishlist. There is perhaps a tradeoff here where the library is widely used, well maintained and efficient but with the cost of higher memory usage.

The alternatives we have talked about in the past would mean using several libraries that wouldn't even come close to the features offered by CEF.

InfiniteGlass is considerably leaner than GNOME, KDE and the likes. GNOME uses the Firefox JavaScript engine for its shell extensions. How concerned should we be about memory usage?

@redhog
Copy link
Owner Author

redhog commented Dec 14, 2023

I think my main issue is that this has to live in the renderer. I rather do more complex stuff in separate processes, that are written in python (or other languages), than in the renderer with is pure C. But: It might be worth it. Having CSS is definitely nice. JS isn't a bad thing either.

One thing to note is that we are rendering the same SVG at multiple zooms and pans, so this must be easily available in the API.

@redhog
Copy link
Owner Author

redhog commented Dec 14, 2023

I'd say give it a try! Worst thing that can happen is you spend some time to wrap it, and then it turns out not to work very well...

@IanTrudel
Copy link
Collaborator

I'd say give it a try! Worst thing that can happen is you spend some time to wrap it, and then it turns out not to work very well...

Exciting! I will finish up with the rsvg and build issues first and provide a new branch or PR. Those are currently necessary to run InfiniteGlass on my machine.

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

No branches or pull requests

2 participants