Draft: Add the ability to turn rasterization into a no-op

Federico Mena Quintero requested to merge federico/librsvg:no-rendering into main

I'm trying to see how much time is spent in Cairo rasterization, by turning it into a no-op.

This MR adds a --rasterize=false option to rsvg-bench, which is reflected in a new CairoRenderer.rasterize(false) method. For now, turning off rasterization means that cr.stroke() and cr.fill() are not called, while the rest of the library operates as usual.


  • @sophie-h @BrainBlasted This just adds a method in the Rust API, but since librsvg is not in crates.io yet, I have not been paying much attention to semver, and have just been using GNOME's versioning scheme. Would it be possible for you to try to build loupe with this branch of librsvg? Absolutely nothing should break; if it does, it's my bug.

  • Make rsvg-bench actually use the document's natural size; I don't remember why I hardcoded it to 100x100.

  • Disable compositing? cr.pop_group_to_source() makes this a bit awkward, we would have to omit the push_group as well. Maybe doable since everything is contained within drawing_ctx.rs.

  • Disable filtering? Easy to do; just make filters::render_primitive() a no-op.

  • Disable masking? Probably similar to disabling compositing.

Merge request reports