google / forma

An efficient vector-graphics renderer
Apache License 2.0
2.62k stars 51 forks source link

Added line culling. #29

Closed dragostis closed 1 year ago

dragostis commented 1 year ago

This adds line culling in the SegmentBuffer where possible. In our case, this means top, right, and bottom of the render area.

This also refactors part of the SegmentBuffer which improves time spent filling it by around 40%.

It also improves super zoomed-in SVGs:

cargo run --release -p demo -- svg assets/svgs/paris-30k.svg -s 20

This went from 250ms to 12ms on an M1 Pro. Fixes #25.