Updated some recipes
[openembedded.git] / recipes / cairo / files / 0001-Rely-less-on-DP-FPU-for-common-matrix-test-funcs.patch
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.
5
6 ---
7  src/cairo-matrix.c |   20 ++++++++++----------
8  1 files changed, 10 insertions(+), 10 deletions(-)
9
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
14 @@ -43,6 +43,13 @@
15  #define ISFINITE(x) ((x) * (x) >= 0.) /* check for NaNs */
16  #endif
17  
18 +static const cairo_matrix_t
19 +_cairo_matrix_identity = {
20 +       .xx = 1,        .xy = 0,
21 +       .yx = 0,        .yy = 1,
22 +       .x0 = 0,        .y0 = 0
23 +};
24 +
25  static void
26  _cairo_matrix_scalar_multiply (cairo_matrix_t *matrix, double scalar);
27  
28 @@ -58,10 +65,8 @@ _cairo_matrix_compute_adjoint (cairo_matrix_t *matrix);
29  void
30  cairo_matrix_init_identity (cairo_matrix_t *matrix)
31  {
32 -    cairo_matrix_init (matrix,
33 -                      1, 0,
34 -                      0, 1,
35 -                      0, 0);
36 +       matrix->xx = matrix->yy = 1;
37 +       matrix->xy = matrix->yx = matrix->x0 = matrix->y0 = 0;
38  }
39  slim_hidden_def(cairo_matrix_init_identity);
40  
41 @@ -86,7 +91,6 @@ slim_hidden_def(cairo_matrix_init_identity);
42  void
43  cairo_matrix_init (cairo_matrix_t *matrix,
44                    double xx, double yx,
45 -
46                    double xy, double yy,
47                    double x0, double y0)
48  {
49 @@ -650,19 +654,32 @@ _cairo_matrix_compute_basis_scale_factors (const cairo_matrix_t *matrix,
50      return CAIRO_STATUS_SUCCESS;
51  }
52  
53 +static inline cairo_bool_t
54 +_cairo_compare_matrix (const cairo_matrix_t *a, const cairo_matrix_t *b, const int n)
55 +{
56 +       uint64_t *ia = (uint64_t*) a;
57 +       uint64_t *ib = (uint64_t*) b;
58 +       uint64_t x = 0;
59 +       int i;
60 +
61 +       assert(sizeof(double) == sizeof(uint64_t));
62 +
63 +       for(i=0; i < n; i++)
64 +               x |= ia[i] ^ ib[i];
65 +
66 +       return !x;
67 +}
68 +
69  cairo_bool_t
70  _cairo_matrix_is_identity (const cairo_matrix_t *matrix)
71  {
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);
76  }
77  
78  cairo_bool_t
79  _cairo_matrix_is_translation (const cairo_matrix_t *matrix)
80  {
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);
84  }
85  
86  cairo_bool_t