servo / pathfinder

A fast, practical GPU rasterizer for fonts and vector graphics
Apache License 2.0
3.52k stars 198 forks source link

cannot get bounding box of a path #561

Open Hurricane996 opened 3 months ago

Hurricane996 commented 3 months ago

there's no way to get the bounding box of a path without cloning the path and calling into_outline on the clone. this is slow.

Hurricane996 commented 3 months ago

the solution would be to add a get_bounds method to path which calls flush_current_contour and returns outline.bounds

s3bk commented 3 months ago

I assume you are talking about the Path in pathfinder_canvas ? It doesn't even need to call flush. Just call bounds() on the outlines and current_contour and compute their union.