1 From 940c62bd51d498d5cdc7d8b1b8aecd750d1094ef Mon Sep 17 00:00:00 2001
2 From: Jonathan Morton <jonathan.morton@movial.com>
3 Date: Wed, 2 Jun 2010 13:58:31 +0300
4 Subject: [PATCH] Rely less on DP FPU for common matrix funcs.
7 src/cairo-matrix.c | 20 ++++++++++----------
8 1 files changed, 10 insertions(+), 10 deletions(-)
10 diff --git a/src/cairo-matrix.c b/src/cairo-matrix.c
11 index de1c6ed..7519852 100644
12 --- a/src/cairo-matrix.c
13 +++ b/src/cairo-matrix.c
15 #define ISFINITE(x) ((x) * (x) >= 0.) /* check for NaNs */
18 +static const cairo_matrix_t
19 +_cairo_matrix_identity = {
26 _cairo_matrix_scalar_multiply (cairo_matrix_t *matrix, double scalar);
28 @@ -58,10 +65,8 @@ _cairo_matrix_compute_adjoint (cairo_matrix_t *matrix);
30 cairo_matrix_init_identity (cairo_matrix_t *matrix)
32 - cairo_matrix_init (matrix,
36 + matrix->xx = matrix->yy = 1;
37 + matrix->xy = matrix->yx = matrix->x0 = matrix->y0 = 0;
39 slim_hidden_def(cairo_matrix_init_identity);
41 @@ -86,7 +91,6 @@ slim_hidden_def(cairo_matrix_init_identity);
43 cairo_matrix_init (cairo_matrix_t *matrix,
49 @@ -650,19 +654,32 @@ _cairo_matrix_compute_basis_scale_factors (const cairo_matrix_t *matrix,
50 return CAIRO_STATUS_SUCCESS;
53 +static inline cairo_bool_t
54 +_cairo_compare_matrix (const cairo_matrix_t *a, const cairo_matrix_t *b, const int n)
56 + uint64_t *ia = (uint64_t*) a;
57 + uint64_t *ib = (uint64_t*) b;
61 + assert(sizeof(double) == sizeof(uint64_t));
63 + for(i=0; i < n; i++)
70 _cairo_matrix_is_identity (const cairo_matrix_t *matrix)
72 - return (matrix->xx == 1.0 && matrix->yx == 0.0 &&
73 - matrix->xy == 0.0 && matrix->yy == 1.0 &&
74 - matrix->x0 == 0.0 && matrix->y0 == 0.0);
75 + return _cairo_compare_matrix(matrix, &_cairo_matrix_identity, 6);
79 _cairo_matrix_is_translation (const cairo_matrix_t *matrix)
81 - return (matrix->xx == 1.0 && matrix->yx == 0.0 &&
82 - matrix->xy == 0.0 && matrix->yy == 1.0);
83 + return _cairo_compare_matrix(matrix, &_cairo_matrix_identity, 4);