aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/cairo/files/0001-Rely-less-on-DP-FPU-for-common-matrix-test-funcs.patch
blob: c54da08b299b25e90a592b1315d7976bd61ee6b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
From 940c62bd51d498d5cdc7d8b1b8aecd750d1094ef Mon Sep 17 00:00:00 2001
From: Jonathan Morton <jonathan.morton@movial.com>
Date: Wed, 2 Jun 2010 13:58:31 +0300
Subject: [PATCH] Rely less on DP FPU for common matrix funcs.

---
 src/cairo-matrix.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/cairo-matrix.c b/src/cairo-matrix.c
index de1c6ed..3aec9e5 100644
--- a/src/cairo-matrix.c
+++ b/src/cairo-matrix.c
@@ -43,6 +43,13 @@
 #define ISFINITE(x) ((x) * (x) >= 0.) /* check for NaNs */
 #endif
 
+static const cairo_matrix_t
+_cairo_matrix_identity = {
+	.xx = 1,	.xy = 0,
+	.yx = 0,	.yy = 1,
+	.x0 = 0,	.y0 = 0
+};
+
 static void
 _cairo_matrix_scalar_multiply (cairo_matrix_t *matrix, double scalar);
 
@@ -58,10 +65,7 @@ _cairo_matrix_compute_adjoint (cairo_matrix_t *matrix);
 void
 cairo_matrix_init_identity (cairo_matrix_t *matrix)
 {
-    cairo_matrix_init (matrix,
-		       1, 0,
-		       0, 1,
-		       0, 0);
+	*matrix = _cairo_matrix_identity;
 }
 slim_hidden_def(cairo_matrix_init_identity);
 
@@ -86,7 +90,6 @@ slim_hidden_def(cairo_matrix_init_identity);
 void
 cairo_matrix_init (cairo_matrix_t *matrix,
 		   double xx, double yx,
-
 		   double xy, double yy,
 		   double x0, double y0)
 {
@@ -653,16 +656,13 @@ _cairo_matrix_compute_basis_scale_factors (const cairo_matrix_t *matrix,
 cairo_bool_t
 _cairo_matrix_is_identity (const cairo_matrix_t *matrix)
 {
-    return (matrix->xx == 1.0 && matrix->yx == 0.0 &&
-	    matrix->xy == 0.0 && matrix->yy == 1.0 &&
-	    matrix->x0 == 0.0 && matrix->y0 == 0.0);
+	return !memcmp(matrix, &_cairo_matrix_identity, sizeof(cairo_matrix_t));
 }
 
 cairo_bool_t
 _cairo_matrix_is_translation (const cairo_matrix_t *matrix)
 {
-    return (matrix->xx == 1.0 && matrix->yx == 0.0 &&
-	    matrix->xy == 0.0 && matrix->yy == 1.0);
+	return !memcmp(matrix, &_cairo_matrix_identity, sizeof(double)*4);
 }
 
 cairo_bool_t
-- 
1.5.6.1