summaryrefslogtreecommitdiff
path: root/src/cairo-matrix.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-08-03 22:27:22 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-08-06 10:15:51 +0100
commit85b688a3f6271427befca699de3a7a15162fc59e (patch)
tree15a0df2620e59e55a4bf4d1639a15d831ac4d0ac /src/cairo-matrix.c
parent0db9e010fa70c65451d324cc9c0ade989f77fedd (diff)
downloadcairo-85b688a3f6271427befca699de3a7a15162fc59e.tar.gz
[matrix] Use hypot()
Use hypot() instead of open-coding sqrt(x*x + y*y). In theory, the compiler could emit highly efficient code. In practice it's slower, but more likely to be more accurate -- but the difference over a bare sqrt() is likely not to be perceptible.
Diffstat (limited to 'src/cairo-matrix.c')
-rw-r--r--src/cairo-matrix.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cairo-matrix.c b/src/cairo-matrix.c
index b9e7290a6..6c83388e9 100644
--- a/src/cairo-matrix.c
+++ b/src/cairo-matrix.c
@@ -624,7 +624,7 @@ _cairo_matrix_compute_basis_scale_factors (const cairo_matrix_t *matrix,
double major, minor;
cairo_matrix_transform_distance (matrix, &x, &y);
- major = sqrt(x*x + y*y);
+ major = hypot (x, y);
/*
* ignore mirroring
*/
@@ -856,7 +856,7 @@ _cairo_matrix_transformed_circle_major_axis (const cairo_matrix_t *matrix,
g = 0.5 * (i - j);
h = a*c + b*d;
- return radius * sqrt (f + sqrt (g*g+h*h));
+ return radius * sqrt (f + hypot (g, h));
/*
* we don't need the minor axis length, which is