diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-11-26 13:26:40 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-11-26 16:15:35 +0000 |
commit | 8a5b55ca6c69671a138f65ab15bcf93163f24a37 (patch) | |
tree | 5c2c78f42317d14403ace97662ed631494542bc9 | |
parent | 4218699642c621eb3098a5251ef88d8c7d8a96d2 (diff) |
[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.
-rw-r--r-- | src/cairo-matrix.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cairo-matrix.c b/src/cairo-matrix.c index 05589833..6dfe537f 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); } } |