skia-canvas
skia-canvas copied to clipboard
Error: internal error in Neon module: called `Option::unwrap()` on a `None` value
const ctx = canvas.getContext('2d');
canvas.gpu = false;
ctx.setTransform(0, 0, 0, 0, 154, 271.60133333333334);
ctx.beginPath();
ctx.arc(0, 0, 2, 0, 6.283185307179586);
ctx.closePath();
ctx.fill();
After executing the above statement, an error will be reported. When setTransform is deleted, the error will disappear.
Did you mean to set the scaling terms to zero in your transform matrix?
I saw this recently also when trying to fill/stroke a path with an invalid transform.
The error comes from canvas/mod.rs @ 312 in draw_path()
method due to the current transform not being invertable. Fix for error:
- let inverse = self.state.matrix.invert().unwrap();
+ let inverse = self.state.matrix.invert().unwrap_or_default();
Though it still won't draw anything, just won't throw error 😉