memononen/nanosvg

using embedded NSVG structs instead of embedded SVG data?

darealshinji opened this issue · 2 comments

I was wondering, in cases where someone might use embedded SVG data, would it be more efficient to parse that data with NanoSVG, dump the data as an array of bytes and then compile the actual program with that dumped data to copy into allocated NSVG structs? Or is the rendering part the most computation-intensive part, in which case someone could simply optimize the SVG before embedding (see scour)?

Anyway, I was trying to do that, but somethings not working right and the rendered picture is broken.
https://gist.github.com/darealshinji/e30847aa20ac428b68a1f5ad3e0dd7f8
(those are 2 files)

@oehhar Thanks for that info. I kinda thought it might be like that. Well, I can only recommend using scour in that case to minimize the SVG data before embedding it into the source code.
By the way, if you dump the data into source code that will initialize all struct members like this=> shape->foo=1; shape->bar=9.99; compiling will takes ages on large SVG data, such as "23.svg".