summaryrefslogtreecommitdiff
path: root/src/cairo-matrix.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-08-08 09:11:10 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2008-08-08 09:11:10 +0100
commit49fb0e834ecf31ac61735e2e35a1b486d5290db6 (patch)
tree26a433059dd654e33c7fd5cd17b2e66697152d04 /src/cairo-matrix.c
parenteabe572981e1e415171dbfde81c3bf94297355b4 (diff)
downloadcairo-49fb0e834ecf31ac61735e2e35a1b486d5290db6.tar.gz
[matrix] Prefer a return parameter for _compute_determinant().
Returning a double tends to be slightly more efficient than passing a pointer to fill, and is a lot easier to read.
Diffstat (limited to 'src/cairo-matrix.c')
-rw-r--r--src/cairo-matrix.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/cairo-matrix.c b/src/cairo-matrix.c
index b704cdee0..7676c5075 100644
--- a/src/cairo-matrix.c
+++ b/src/cairo-matrix.c
@@ -488,7 +488,7 @@ cairo_matrix_invert (cairo_matrix_t *matrix)
/* inv (A) = 1/det (A) * adj (A) */
double det;
- _cairo_matrix_compute_determinant (matrix, &det);
+ det = _cairo_matrix_compute_determinant (matrix);
if (! ISFINITE (det))
return _cairo_error (CAIRO_STATUS_INVALID_MATRIX);
@@ -508,21 +508,20 @@ _cairo_matrix_is_invertible (const cairo_matrix_t *matrix)
{
double det;
- _cairo_matrix_compute_determinant (matrix, &det);
+ det = _cairo_matrix_compute_determinant (matrix);
return ISFINITE (det) && det != 0.;
}
-void
-_cairo_matrix_compute_determinant (const cairo_matrix_t *matrix,
- double *det)
+double
+_cairo_matrix_compute_determinant (const cairo_matrix_t *matrix)
{
double a, b, c, d;
a = matrix->xx; b = matrix->yx;
c = matrix->xy; d = matrix->yy;
- *det = a*d - b*c;
+ return a*d - b*c;
}
/* Compute the amount that each basis vector is scaled by. */
@@ -532,7 +531,7 @@ _cairo_matrix_compute_scale_factors (const cairo_matrix_t *matrix,
{
double det;
- _cairo_matrix_compute_determinant (matrix, &det);
+ det = _cairo_matrix_compute_determinant (matrix);
if (! ISFINITE (det))
return _cairo_error (CAIRO_STATUS_INVALID_MATRIX);