cppfw / svgren

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

CAIRO_STATUS_NO_MEMORY on pretty simple svg #51

Closed Papirosnik closed 6 years ago

Papirosnik commented 6 years ago

Hi there! I have bumped into svg that cannot be processed. It's unlikely that there is no memory it looks like a bug. Hope you could sort this out as usual easily ) granddad.zip

igagis commented 6 years ago

This seems to be a bug in cairo. I will try to create a minimal example and submit a bug to cairo.

igagis commented 6 years ago

It appears that there is a bug for this already: https://bugs.freedesktop.org/show_bug.cgi?id=102966

igagis commented 6 years ago

@Papirosnik While it does not look like the cairo bug will be fixed anytime soon, I'm attaching the corrected version of the original SVG which can be rendered by svgren. I commented couple of paths and it does not seem to change anything in the image. granddad_corrected.svg.zip

Papirosnik commented 6 years ago

I can see that blue outlines on grandfather's sleeves have been disappeared. At least in Chrome this is pretty noticeable. Anyway, thank you for the problem localization. Let's wait cairo )

igagis commented 6 years ago

Ok. The commeted path elements are using radial gradients for fill style property. And if you look up those referenced gradients you'll see that those are using some weirdly large values for gradient transformation matrix and gradient radius. These gradients are causing problems in cairo. If you could adjust those in your SVG editor to use some more sane values, then you could have those blue outlines on sleeves.

These are those gradients:

<radialGradient cx="0" cy="0" gradientTransform="matrix(0.9999999999999999999999999997, 0.9999999999999999999999999997, 0.00001797114126678521327014218009, 0.00002596838591034755134281200631, -52694933.1, -76139799.3)" gradientUnits="userSpaceOnUse" id="2" r="-6481920.0">

...

<radialGradient cx="0" cy="0" gradientTransform="matrix(1.000000000000000000000000000, 1.000000000000000000000000000, -0.000007911964699074074074074074077, 0.00003057385766050028174786127761, 93951826.35, 107374165.8)" gradientUnits="userSpaceOnUse" id="73" r="-7995801.6">
igagis commented 6 years ago

@Papirosnik maybe this bug can be closed too since workaround was implemented in #56 ?

Papirosnik commented 6 years ago

Well, I thought we have to have some reminder about that bug but this was a weak argument in favor of it. so, let's close.

igagis commented 6 years ago

I agree that workaround should be considered a temporary solution. But, on practice there is nothing more permanent than temporary :). It does not look like this Cairo bug will be fixed in near future, so I see no reason having the reminder about that :). So, yeah, let's close.