cppfw / svgren

:camera: SVG rendering library in C++
MIT License
206 stars 41 forks source link

can't process svg #27

Closed Papirosnik closed 7 years ago

Papirosnik commented 7 years ago

Hi there! Thanks for the great lib. I'd like to use it in further but unfortunately had encountered a problem. I've got a svg that can't be properly processed (see attachment). I realize that that svg is pretty complicated but still want to get it rendered. Rendering it on my PC takes about a minute and gives a memory corruption as a result. (google chrome spits it out in a few seconds) Could you please locate the problem and fix it?

saeitsystems commented 7 years ago

This is a "hardcore" svg file ;-) ....... I suppose there are quite a few missing features and problems to render this properly. Good luck!

igagis commented 7 years ago

Thanks for reporting the issue. Nice SVG :). I'll have a look and try to make a fix.

igagis commented 7 years ago

@Papirosnik I got the image rendered correctly, no crash. It was not fast, though, here are time measurements on my system:

SVG loaded in 4.699 sec.
SVG rendered in 190.085 sec.

I was trying on linux. What is your operating system? Could you try with latest version of svgren?

It is not ok of course that it takes that long to render it, I might have a look why it is so and try to optimize.

Papirosnik commented 7 years ago

@igagis Win10 64bit, i5-3450, 16GB, Intel(R) HD Graphics. One time (of 10) I managed to see result image but usually got access violation or other unexpected behaviour. Some fixes/optimization are very much expected )

igagis commented 7 years ago

@Papirosnik I tried on windows (VS2017) couple of times, also got image rendered in about a minute, no crashes. But I found that in Debug configuration there is assertion failure because some style properties are not implemented. Did you also try only in Debug mode? Can you try Release mode? Also, which Visual Studio do you use? 2015 or 2017?

Papirosnik commented 7 years ago

VS 2015, both modes... any ideas about performance?

igagis commented 7 years ago

Performance is under investigation, it takes time to analyze...

igagis commented 7 years ago

Good news! I managed to increase the performance drastically, now it takes less than a second to render that SVG. Although, loading the SVG is still not that fast, it takes 1-2 seconds. I have one idea about how to improve that, I made a bug for that https://github.com/igagis/svgdom/issues/16

@Papirosnik please update svgdom to version 0.2.70 and svgren to version 0.4.36 and try

Papirosnik commented 7 years ago

This is not a good news, it is the greatest! ) thanks a lot, it works like a charm!

igagis commented 7 years ago

Ok then, closing the bug