diff options
author | Carl Worth <cworth@cworth.org> | 2007-01-18 13:01:53 -0800 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2007-01-18 13:09:23 -0800 |
commit | 28d6a228f030dbec05ab5b0ba680db272df67c49 (patch) | |
tree | 00b063f0c3279b3f9e9d1757a461ea747c015b3a | |
parent | bc7072064e421e4c5e5043aada6cae1d8250938f (diff) |
Fix cairo_get_dash and cairo_get_dash_count APIs
Make these functions consistent with other cairo_get functions
by making cairo_get_dash_count return the count directly, and
removing the cairo_status_t return value from cairo_get_dash.
-rw-r--r-- | src/cairo.c | 37 | ||||
-rw-r--r-- | src/cairo.h | 6 | ||||
-rw-r--r-- | test/get-and-set.c | 17 |
3 files changed, 20 insertions, 40 deletions
diff --git a/src/cairo.c b/src/cairo.c index 637c0d0ee..2e522a63b 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -953,26 +953,18 @@ cairo_set_dash (cairo_t *cr, /** * cairo_get_dash_count: * @cr: a #cairo_t - * @count: return value for the number of dash values, or %NULL * - * Gets the length of the dash array in @cr. + * Returns the length of the dash array in @cr (0 if dashing is not + * currently in effect). * - * Return value: %CAIRO_STATUS_SUCCESS, or error status set on - * @cr. + * See also cairo_set_dash() and cairo_get_dash(). * * Since: 1.4 */ -cairo_status_t -cairo_get_dash_count (cairo_t *cr, - int *count) +int +cairo_get_dash_count (cairo_t *cr) { - if (cr->status) - return cr->status; - - if (count) - *count = cr->gstate->stroke_style.num_dashes; - - return CAIRO_STATUS_SUCCESS; + return cr->gstate->stroke_style.num_dashes; } /** @@ -985,27 +977,20 @@ cairo_get_dash_count (cairo_t *cr, * enough to hold at least the number of values returned by * cairo_get_dash_count(). * - * Return value: %CAIRO_STATUS_SUCCESS, or error status set on - * @cr. - * * Since: 1.4 **/ -cairo_status_t +void cairo_get_dash (cairo_t *cr, double *dashes, double *offset) { - if (cr->status) - return cr->status; - - memcpy (dashes, - cr->gstate->stroke_style.dash, - sizeof(double) * cr->gstate->stroke_style.num_dashes); + if (dashes) + memcpy (dashes, + cr->gstate->stroke_style.dash, + sizeof (double) * cr->gstate->stroke_style.num_dashes); if (offset) *offset = cr->gstate->stroke_style.dash_offset; - - return CAIRO_STATUS_SUCCESS; } void diff --git a/src/cairo.h b/src/cairo.h index bd2620ac0..1c3fb25ea 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -1113,10 +1113,10 @@ cairo_get_line_join (cairo_t *cr); cairo_public double cairo_get_miter_limit (cairo_t *cr); -cairo_public cairo_status_t -cairo_get_dash_count (cairo_t *cr, int *count); +cairo_public int +cairo_get_dash_count (cairo_t *cr); -cairo_public cairo_status_t +cairo_public void cairo_get_dash (cairo_t *cr, double *dashes, double *offset); cairo_public void diff --git a/test/get-and-set.c b/test/get-and-set.c index ec35834fe..c23707e4c 100644 --- a/test/get-and-set.c +++ b/test/get-and-set.c @@ -93,6 +93,8 @@ settings_set (cairo_t *cr, settings_t *settings) static int settings_get (cairo_t *cr, settings_t *settings) { + int count; + settings->op = cairo_get_operator (cr); settings->tolerance = cairo_get_tolerance (cr); settings->fill_rule = cairo_get_fill_rule (cr); @@ -102,18 +104,11 @@ settings_get (cairo_t *cr, settings_t *settings) settings->miter_limit = cairo_get_miter_limit (cr); cairo_get_matrix (cr, &settings->matrix); - { - cairo_status_t status; - int count; - - status = cairo_get_dash_count (cr, &count); - if (status || count != 5) - return -1; + count = cairo_get_dash_count (cr); + if (count != 5) + return -1; - status = cairo_get_dash (cr, settings->dash, &settings->dash_offset); - if (status) - return -1; - } + cairo_get_dash (cr, settings->dash, &settings->dash_offset); return 0; } |