diff options
author | Carl Worth <cworth@cworth.org> | 2005-06-20 09:59:23 +0000 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2005-06-20 09:59:23 +0000 |
commit | f15ec64e7f2cfb9071c05ec072e49f364dbc4164 (patch) | |
tree | 760ade37c6906403066cab359df8a570ff6b4f58 | |
parent | 3b8da5f213c3d0cf4357b29207639357241938bb (diff) |
Rip out cairo_set_error_notfiy function as it is clear that it is not the right approach.
Remove error-notify test.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | doc/public/tmpl/cairo.sgml | 19 | ||||
-rw-r--r-- | src/cairo-private.h | 3 | ||||
-rw-r--r-- | src/cairo.c | 32 | ||||
-rw-r--r-- | src/cairo.h | 14 | ||||
-rw-r--r-- | test/.cvsignore | 1 | ||||
-rw-r--r-- | test/Makefile.am | 2 | ||||
-rw-r--r-- | test/error-notify.c | 108 |
8 files changed, 12 insertions, 179 deletions
@@ -1,3 +1,15 @@ +2005-06-20 Carl Worth <cworth@cworth.org> + + * src/cairo.h: + * src/cairo-private.h: + * src/cairo.c: (_cairo_error), (cairo_create): Rip out + cairo_set_error_notfiy function as it is clear that it is not the + right approach. + + * test/.cvsignore: + * test/Makefile.am: + * test/error-notify.c: Remove error-notify test. + 2005-06-17 Carl Worth <cworth@cworth.org> * src/cairo-xcb-surface.c (_get_image_surface): Remove references diff --git a/doc/public/tmpl/cairo.sgml b/doc/public/tmpl/cairo.sgml index f6a827c70..992ace500 100644 --- a/doc/public/tmpl/cairo.sgml +++ b/doc/public/tmpl/cairo.sgml @@ -977,25 +977,6 @@ Drawing contexts. @Returns: -<!-- ##### USER_FUNCTION cairo_error_notify_func_t ##### --> -<para> - -</para> - -@closure: -@status: - - -<!-- ##### FUNCTION cairo_set_error_notify ##### --> -<para> - -</para> - -@cr: -@error_notify: -@closure: - - <!-- ##### ENUM cairo_filter_t ##### --> <para> diff --git a/src/cairo-private.h b/src/cairo-private.h index d63d98b7e..7051f7ebd 100644 --- a/src/cairo-private.h +++ b/src/cairo-private.h @@ -44,9 +44,6 @@ struct _cairo { cairo_status_t status; - cairo_error_notify_func_t error_notify; - void *error_notify_closure; - cairo_path_fixed_t path; cairo_gstate_t *gstate; diff --git a/src/cairo.c b/src/cairo.c index 06182e979..c49c03496 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -46,8 +46,6 @@ static const cairo_t cairo_nil = { (unsigned int)-1, /* ref_count */ CAIRO_STATUS_NO_MEMORY, /* status */ - NULL, /* error_notify */ - NULL, /* error_notify_closure */ { /* path */ NULL, NULL, /* op_buf_head, op_buf_tail */ NULL, NULL, /* arg_buf_head, arg_buf_tail */ @@ -92,9 +90,6 @@ _cairo_error (cairo_t *cr, cairo_status_t status) status <= CAIRO_STATUS_LAST_STATUS); cr->status = status; - - if (cr->error_notify) - (cr->error_notify) (cr->error_notify_closure, status); } /** @@ -143,9 +138,6 @@ cairo_create (cairo_surface_t *target) cr->status = CAIRO_STATUS_SUCCESS; - cr->error_notify = NULL; - cr->error_notify_closure = NULL; - _cairo_path_fixed_init (&cr->path); if (target == NULL) { @@ -2329,30 +2321,6 @@ cairo_status_to_string (cairo_status_t status) return "<unknown error status>"; } -/** - * cairo_set_error_notify: - * @cr: a cairo context - * @error_notify: an function to be called when an error occurs - * @closure: a closure argument to be passed to @error_notify - * - * Installs an error notifier within @cr. If an error is set within - * @cr, (eg. such that cairo_status(@cr) would return something other - * than CAIRO_STATUS_SUCCESS), then @error_notify will be called with - * the given @closure value as well as the #cairo_status_t value of - * the error. - * - * An error notifier can be cleared by passing NULL for @error_notify - * and for @closure. - **/ -void -cairo_set_error_notify (cairo_t *cr, - cairo_error_notify_func_t error_notify, - void *closure) -{ - cr->error_notify = error_notify; - cr->error_notify_closure = closure; -} - void _cairo_restrict_value (double *value, double min, double max) { diff --git a/src/cairo.h b/src/cairo.h index fe9b2e7e3..0fcd85602 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -884,20 +884,6 @@ cairo_status (cairo_t *cr); const char * cairo_status_to_string (cairo_status_t status); -/** - * cairo_error_notify_func_t - * - * #cairo_error_notify_func_t the type of function which is called - * when an error is detected by cairo. It is passed a closure and the - * #cairo_status_t value of the error. - */ -typedef void (*cairo_error_notify_func_t) (void *closure, cairo_status_t status); - -void -cairo_set_error_notify (cairo_t *cr, - cairo_error_notify_func_t error_notify, - void *closure); - /* Surface manipulation */ /** diff --git a/test/.cvsignore b/test/.cvsignore index d8fbef681..0b4c1531c 100644 --- a/test/.cvsignore +++ b/test/.cvsignore @@ -6,7 +6,6 @@ clip-nesting clip-twice coverage create-for-png -error-notify fill-and-stroke fill-rule filter-nearest-offset diff --git a/test/Makefile.am b/test/Makefile.am index cdefac969..48204192d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -3,7 +3,6 @@ TESTS = \ clip-nesting \ clip-twice \ create-for-png \ -error-notify \ fill-and-stroke \ fill-rule \ filter-nearest-offset \ @@ -135,7 +134,6 @@ LDADDS = libcairotest.la $(top_builddir)/src/libcairo.la clip_nesting_LDADD = $(LDADDS) clip_twice_LDADD = $(LDADDS) create_for_png_LDADD = $(LDADDS) -error_notify_LDADD = $(LDADDS) fill_and_stroke_LDADD = $(LDADDS) fill_rule_LDADD = $(LDADDS) filter_nearest_offset_LDADD = $(LDADDS) diff --git a/test/error-notify.c b/test/error-notify.c deleted file mode 100644 index 0086455c4..000000000 --- a/test/error-notify.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright © 2005 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Carl D. Worth <cworth@cworth.org> - */ - -#include <stdlib.h> - -#include "cairo-test.h" - -cairo_test_t test = { - "error-notify", - "Tests calls to cairo_error_notify", - 0, 0 -}; - -typedef struct test_result { - cairo_test_status_t status; -} test_result_t; - -static void -toggle_status (void *closure, cairo_status_t status) -{ - test_result_t *result = closure; - - if (result->status == CAIRO_TEST_SUCCESS) - result->status = CAIRO_TEST_FAILURE; - else - result->status = CAIRO_TEST_SUCCESS; -} - -static cairo_test_status_t -do_test (cairo_t *cr, int width, int height) -{ - cairo_t *cr2; - test_result_t result; - - /* We do all our testing in an alternate cr so that we don't leave - * an error in the original. */ - - cr2 = cairo_create (cairo_get_target (cr)); - - cairo_set_error_notify (cr2, toggle_status, &result); - - cairo_test_log (" Testing that error notify function is called:\t\t"); - { - result.status = CAIRO_TEST_FAILURE; - /* Trigger an error by trying to set a NULL source. */ - cairo_set_source (cr2, NULL); - if (result.status != CAIRO_TEST_SUCCESS) { - cairo_test_log ("FAIL\n"); - return CAIRO_TEST_FAILURE; - } else { - cairo_test_log ("PASS\n"); - } - } - - cairo_test_log (" Testing that cr remains in an error state:\t\t"); - { - result.status = CAIRO_TEST_FAILURE; - cairo_move_to (cr2, 0.0, 0.0); - if (result.status != CAIRO_TEST_SUCCESS) { - cairo_test_log ("FAIL\n"); - return CAIRO_TEST_FAILURE; - } else { - cairo_test_log ("PASS\n"); - } - } - - cairo_test_log (" Testing that error notify function can be cleared:\t"); - { - cairo_set_error_notify (cr2, NULL, NULL); - cairo_set_source (cr2, NULL); - if (result.status != CAIRO_TEST_SUCCESS) { - cairo_test_log ("FAIL\n"); - return CAIRO_TEST_FAILURE; - } else { - cairo_test_log ("PASS\n"); - } - } - - return CAIRO_TEST_SUCCESS; -} - -int -main (void) -{ - return cairo_test (&test, do_test); -} |