[PATCH] Fix regression in cairo output when transforming ctm

Adrian Johnson ajohnson at redneon.com
Wed Mar 12 04:06:26 PDT 2008


The check for an invertable matrix had the side effect of inverting
the matrix.

Make a copy of the matrix before testing if it is invertable.
---
 poppler/CairoOutputDev.cc |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index d69013a..57c3ac5 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -209,7 +209,7 @@ void CairoOutputDev::setDefaultCTM(double *ctm) {
 void CairoOutputDev::updateCTM(GfxState *state, double m11, double m12,
 				double m21, double m22,
 				double m31, double m32) {
-  cairo_matrix_t matrix;
+  cairo_matrix_t matrix, invert_matrix;
   matrix.xx = m11;
   matrix.yx = m12;
   matrix.xy = m21;
@@ -225,8 +225,9 @@ void CairoOutputDev::updateCTM(GfxState *state, double m11, double m12,
    *
    * 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)) {
+   * instead of having to invert the matrix. */
+  invert_matrix = matrix;
+  if (cairo_matrix_invert(&invert_matrix)) {
     warning("matrix not invertible\n");
     return;
   }
-- 
1.5.2.4


--------------040309050603040203060400--


More information about the poppler mailing list