Settings

Theme

A look at pathfinder

nical.github.io

85 points by throwupaway123 7 years ago · 12 comments

Reader

pcwalton 7 years ago

Main author of Pathfinder here--feel free to ask any questions. :)

Thanks to Nical for the excellent writeup!

  • OskarS 7 years ago

    My previous (rather limited) understanding of Pathfinder was that it was just a text renderer, I didn't realize that it was a more general vector graphics package. Is the idea for Pathfinder that it should be integrated into Firefox for all its vector rendering needs (SVG and so forth)?

  • jacobolus 7 years ago

    Does this do proper linear (rather than gamma-encoded) compositing / anti-aliasing?

    If so, do people get mad that their fonts look a bit lighter than existing rasterization tools which (incorrectly) work in gammma-encoded color space?

    • pcwalton 7 years ago

      Gamma correct compositing is an option. You can play with it if you load a monochrome SVG in the demo.

      For fonts, Pathfinder uses the standard trick of dilating the outlines a bit in order to make fonts look a bit darker at small sizes.

  • iTokio 7 years ago

    Is there still a need to cache results in a texture or is it practical to render from scratch each frame?

    • nical 7 years ago

      If you know that the result will not change over frames, blitting a cached image will always be faster than re-rendering. It's not necessarily a need, just an improvement. That said pathfinder is fast enough already that it can deal with rendering interesting workloads every frames at 60fps, and will keep getting better at it, I think that there is room for improvement in the tiling phase.

    • pcwalton 7 years ago

      I would like to eventually add the option to cache masks in a texture. I think this should probably be an option for the user and not something I do behind the user's back unless the user explicitly opts into heuristics, though.

cerberusss 7 years ago

So if I read this correctly, it's an algorithm that Firefox could use when it handles the HTML canvas tag. For instance to draw SVG or text. Is that correct? And the good thing here, is that it uses GPU instructions to determine occlusion, and thus speed up the drawing process.

What I don't get: if that's the case, shouldn't it be integrated at a lower level, i.e. not just for drawing SVG or text, but the whole of the canvas tag? Because that's where occlusion also could take place?

  • pcwalton 7 years ago

    Yes, it would make sense to use Pathfinder for canvas as well. Some care is necessary to avoid regressing apps that read canvas data back from GPU to CPU frequently, to avoid thrashing the I/O bus, but in general it should be doable.

    In fact, Pathfinder offers a subset of the HTML canvas API which you can use in your Rust apps right now. Here's an example: https://github.com/pcwalton/pathfinder/blob/master/examples/...

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection