From 8a5b55ca6c69671a138f65ab15bcf93163f24a37 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 26 Nov 2008 13:26:40 +0000 Subject: [PATCH] [matrix] Impose a maximum number of refinement iterations Ensure we do not loop forever trying to minimise the error between the pixman and cairo matrices - for instance when the FPU is not running at full precision. --- src/cairo-matrix.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cairo-matrix.c b/src/cairo-matrix.c index 055898331..6dfe537f2 100644 --- a/src/cairo-matrix.c +++ b/src/cairo-matrix.c @@ -879,6 +879,7 @@ _cairo_matrix_to_pixman_matrix (const cairo_matrix_t *matrix, *pixman_transform = pixman_identity_transform; } else { cairo_matrix_t inv; + unsigned max_iterations; pixman_transform->matrix[0][0] = _cairo_fixed_16_16_from_double (matrix->xx); pixman_transform->matrix[0][1] = _cairo_fixed_16_16_from_double (matrix->xy); @@ -913,6 +914,7 @@ _cairo_matrix_to_pixman_matrix (const cairo_matrix_t *matrix, /* find the pattern space coordinate that maps to (xc, yc) */ xc += .5; yc += .5; /* offset for the pixel centre */ + max_iterations = 5; do { double x,y; pixman_vector_t vector; @@ -942,6 +944,6 @@ _cairo_matrix_to_pixman_matrix (const cairo_matrix_t *matrix, if (dx == 0 && dy == 0) break; - } while (TRUE); + } while (--max_iterations); } }