[cairo-commit] 4 commits - src/cairo.c src/cairoint.h src/cairo-path.c src/cairo-path-fixed.c src/cairo-path-private.h src/cairo-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Oct 30 04:24:08 PDT 2007


 src/cairo-path-fixed.c   |   11 ++++-------
 src/cairo-path-private.h |    2 --
 src/cairo-path.c         |    4 ++--
 src/cairo-surface.c      |    2 +-
 src/cairo.c              |   13 +++++--------
 src/cairoint.h           |    2 +-
 6 files changed, 13 insertions(+), 21 deletions(-)

New commits:
commit 0d42af2427d1de27845cb8a6b3d290a562c28fc6
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Oct 30 11:13:44 2007 +0000

    [cairo-surface] Fix typo in doc.
    
    s/INVALUE_FORMAT/INVALID_FORMAT/

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 4fa2e4c..9e1acdc 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -171,7 +171,7 @@ slim_hidden_def(cairo_surface_get_content);
  *
  * Return value: %CAIRO_STATUS_SUCCESS, %CAIRO_STATUS_NULL_POINTER,
  * %CAIRO_STATUS_NO_MEMORY, %CAIRO_STATUS_READ_ERROR,
- * %CAIRO_STATUS_INVALID_CONTENT, %CAIRO_STATUS_INVALUE_FORMAT, or
+ * %CAIRO_STATUS_INVALID_CONTENT, %CAIRO_STATUS_INVALID_FORMAT, or
  * %CAIRO_STATUS_INVALID_VISUAL.
  **/
 cairo_status_t
commit 39664b7cac7244ac901cb361442ca2967d74a542
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Oct 30 11:01:40 2007 +0000

    [cairo-path] Return CAIRO_STATUS_SUCCESS.
    
    If we have already returned the error status, then it is cleaner (and
    the common idiom) to use 'return CAIRO_STATUS_SUCCESS' rather than
    'return status'.

diff --git a/src/cairo-path.c b/src/cairo-path.c
index 9c18b8d..b9086c4 100644
--- a/src/cairo-path.c
+++ b/src/cairo-path.c
@@ -339,7 +339,7 @@ _cairo_path_populate (cairo_path_t		*path,
     /* Sanity check the count */
     assert (cpp.data - path->data == path->num_data);
 
-    return status;
+    return CAIRO_STATUS_SUCCESS;
 }
 
 cairo_path_t *
commit e57df319633f8ebd0249096d76c9058f31f9835b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Oct 30 10:58:16 2007 +0000

    [cairo-path] Make _cairo_path_nil static.
    
    _cairo_path_nil is only used within cairo-path.c, so there is no reason
    to expose it to the rest of the libary.

diff --git a/src/cairo-path-private.h b/src/cairo-path-private.h
index d855c19..a24eaa4 100644
--- a/src/cairo-path-private.h
+++ b/src/cairo-path-private.h
@@ -39,8 +39,6 @@
 
 #include "cairoint.h"
 
-extern const cairo_private cairo_path_t _cairo_path_nil;
-
 cairo_private cairo_path_t *
 _cairo_path_create (cairo_path_fixed_t *path,
 		    cairo_gstate_t     *gstate);
diff --git a/src/cairo-path.c b/src/cairo-path.c
index 90b726d..9c18b8d 100644
--- a/src/cairo-path.c
+++ b/src/cairo-path.c
@@ -39,7 +39,7 @@
 #include "cairo-path-private.h"
 #include "cairo-path-fixed-private.h"
 
-const cairo_path_t _cairo_path_nil = { CAIRO_STATUS_NO_MEMORY, NULL, 0 };
+static const cairo_path_t _cairo_path_nil = { CAIRO_STATUS_NO_MEMORY, NULL, 0 };
 
 /* Closure for path interpretation. */
 typedef struct cairo_path_count {
commit 6fdb7f129c8154e288ee40765fa63ffaeebaf8fd
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Oct 30 10:42:22 2007 +0000

    Simplify return value from cairo_path_fixed_get_current_point().
    
    The only caller of cairo_path_fixed_get_current_point(), used the status
    return to determine whether or not the path had a current point (and did
    not propagate the error) - for which we had already removed the
    _cairo_error() markup. Now we reduce the boolean status return to a
    cairo_bool_t, with a net reduction in code.

diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c
index a92bcd6..6aaa2ee 100644
--- a/src/cairo-path-fixed.c
+++ b/src/cairo-path-fixed.c
@@ -340,21 +340,18 @@ _cairo_path_fixed_close_path (cairo_path_fixed_t *path)
     return CAIRO_STATUS_SUCCESS;
 }
 
-cairo_status_t
+cairo_bool_t
 _cairo_path_fixed_get_current_point (cairo_path_fixed_t *path,
 				     cairo_fixed_t	*x,
 				     cairo_fixed_t	*y)
 {
-    if (! path->has_current_point) {
-	/* No need for _cairo_error() as the only caller,
-	 * cairo_get_current_point(), expects and handles NO_CURRENT_POINT */
-	return CAIRO_STATUS_NO_CURRENT_POINT;
-    }
+    if (! path->has_current_point)
+	return FALSE;
 
     *x = path->current_point.x;
     *y = path->current_point.y;
 
-    return CAIRO_STATUS_SUCCESS;
+    return TRUE;
 }
 
 static cairo_status_t
diff --git a/src/cairo.c b/src/cairo.c
index 73c2dc4..d5ee15c 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -3166,20 +3166,17 @@ cairo_get_antialias (cairo_t *cr)
 void
 cairo_get_current_point (cairo_t *cr, double *x_ret, double *y_ret)
 {
-    cairo_status_t status = CAIRO_STATUS_NO_CURRENT_POINT;
     cairo_fixed_t x_fixed, y_fixed;
     double x, y;
 
-    if (cr->status == CAIRO_STATUS_SUCCESS)
-	status = _cairo_path_fixed_get_current_point (cr->path,
-	                                              &x_fixed, &y_fixed);
-    if (status == CAIRO_STATUS_NO_CURRENT_POINT) {
-	x = 0.0;
-	y = 0.0;
-    } else {
+    if (cr->status == CAIRO_STATUS_SUCCESS &&
+	_cairo_path_fixed_get_current_point (cr->path, &x_fixed, &y_fixed)) {
 	x = _cairo_fixed_to_double (x_fixed);
 	y = _cairo_fixed_to_double (y_fixed);
 	_cairo_gstate_backend_to_user (cr->gstate, &x, &y);
+    } else {
+	x = 0.0;
+	y = 0.0;
     }
 
     if (x_ret)
diff --git a/src/cairoint.h b/src/cairoint.h
index 16e8a08..225cb4b 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -1479,7 +1479,7 @@ _cairo_path_fixed_rel_curve_to (cairo_path_fixed_t *path,
 cairo_private cairo_status_t
 _cairo_path_fixed_close_path (cairo_path_fixed_t *path);
 
-cairo_private cairo_status_t
+cairo_private cairo_bool_t
 _cairo_path_fixed_get_current_point (cairo_path_fixed_t *path,
 				     cairo_fixed_t	*x,
 				     cairo_fixed_t	*y);


More information about the cairo-commit mailing list