alafr / SVG-to-PDFKit

Insert SVG into a PDF document created with PDFKit
MIT License
397 stars 111 forks source link

More performance by omitting unnecessary call to getBoundingBox for clip path calculation #143

Closed te-netronic closed 2 years ago

te-netronic commented 3 years ago

Fix for issue #141. The bounding box for the clip path is only needed in the case, when the clip-path attribute 'clipPathUnits' is set to 'objectBoundingBox', but was called every time. In bigger SVGs the call to getBoundingBox takes seconds because the bounding shape contains more than 100,000 points. When this call can be omitted, the over-all performance gains up to 90%.