Commit ec01926e authored by Jeff Muizelaar's avatar Jeff Muizelaar

Avoid setting a singular ctm

Ignoring singular ctm's gives a better result than having
our cairo context error and turn off. Related to #14398.
parent 4882d7a1
......@@ -217,6 +217,20 @@ void CairoOutputDev::updateCTM(GfxState *state, double m11, double m12,
matrix.x0 = m31;
matrix.y0 = m32;
/* Make sure the matrix is invertible before setting it.
* cairo will blow up if we give it a matrix that's not
* invertible, so we need to check before passing it
* to cairo_transform. Ignoring it is likely to give better
* results than not rendering anything at all. See #14398
* Ideally, we could do the cairo_transform
* and then check if anything went wrong and fix it then
* instead of having to invert the matrix twice. */
if (cairo_matrix_invert(&matrix)) {
warning("matrix not invertible\n");
cairo_transform (cairo, &matrix);
if (cairo_shape)
cairo_transform (cairo_shape, &matrix);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment