Closed kindaro closed 5 years ago
Can you try to call dumpDrawing somehow a put the result somewhere?
Dump drawing should print-out the scene in nearly haskell, workable for debugging
You have Infinity
and NaN
s n the dumped diagram:
(fill [LinePrim Line (V2 (-Infinity) (-Infinity)) (V2 (-Infinity) (-Infinity)),LinePrim Line (V2 (-Infinity) (-Infinity)) (V2 (-Infinity) (-Infinity)),LinePrim Line (V2 (-Infinity) (-Infinity)) (V2 (-Infinity) (-Infinity)),LinePrim Line (V2 (-Infinity) (-Infinity)) (V2 NaN NaN)] >>=
This is not filtered by Rasterific, and yeah, it makes the rendering go bonker.
@Twinside Thank you for taking time to research this issue.
So what can be done?
I am not sure I can control this. The data I supply to the diagrams
API is somewhat shady (like, sin pi
shady), but it is legit. The same diagrams render flawlessly with SVG back end.
Can you explain to me what data type you are showing, and maybe post the code you used to obtain it, so that I can examine my various diagrams with it and locate what goes wrong?
I've tried the SVG, and you have NaN and Infinity written in your SVG (that your browser probably ignore), I wouldn't call that flawless. The code is mostly the copy/past of Diagram.Rasterific with a call changed to dump the generated drawing, I've pushed it here.
I've added safegard to Rasterific for these cases, at least it shouldn't go into an infinite loop anymore.
Unfortunately, I do not have a short example. I am trying stuff with graphs, and one thing I did was to render a graph in some fashion. I discovered that, while I could vectorize it with the SVG back end, if I try to do the same with Rasterific, it eats all memory in an infinite loop. I did some profiling and I found out that the looping function is
clipLine
.Here is the commit. You can run it with, for example,
cabal run exes -- --output x.png --width 200
. It hangs when I try it. If you replaceclr489
example graph with, say,cyc3
, it will render beautifully.Here is the profiling log.
Please let me know if it hangs on your machine too, and if I can do anything else to help.