[poppler] poppler/CairoOutputDev.cc

Jeff Muizelaar jrmuizel at kemper.freedesktop.org
Sun Mar 2 17:15:03 PST 2008


 poppler/CairoOutputDev.cc |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

New commits:
commit ec01926e5a9dc16e200060497c43e79a1623698d
Author: Jeff Muizelaar <jeff at infidigm.net>
Date:   Sun Mar 2 20:15:20 2008 -0500

    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.

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 43b1ca4..d69013a 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -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");
+    return;
+  }
+
   cairo_transform (cairo, &matrix);
   if (cairo_shape)
     cairo_transform (cairo_shape, &matrix);


More information about the poppler mailing list