diff --git a/boilerplate/Makefile.sources b/boilerplate/Makefile.sources index b3cea81..da91348 100644 --- a/boilerplate/Makefile.sources +++ b/boilerplate/Makefile.sources -19,7 +19,7 @@ cairo_boilerplate_sources = \ # automake is stupid enough to always use c++ linker if we enable the # following lines, even if beos surface is not enabled. Disable it for now. cairo_boilerplate_beos_private = cairo-boilerplate-beos-private.h -#libcairoboilerplate_la_SOURCES += cairo-boilerplate-beos.cpp +cairo_boilerplate_beos_sources = cairo-boilerplate-beos.cpp cairo_boilerplate_directfb_private = cairo-boilerplate-directfb-private.h cairo_boilerplate_directfb_sources = cairo-boilerplate-directfb.c diff --git a/boilerplate/cairo-boilerplate-beos-private.h b/boilerplate/cairo-boilerplate-beos-private.h index 1d800c2..a3c0513 100644 --- a/boilerplate/cairo-boilerplate-beos-private.h +++ b/boilerplate/cairo-boilerplate-beos-private.h -9,14 +9,14 @@ CAIRO_BEGIN_DECLS extern cairo_surface_t * _cairo_boilerplate_beos_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); + cairo_content_t content, + int width, + int height, + int max_width, + int max_height, + cairo_boilerplate_mode_t mode, + int id, + void **closure); extern void _cairo_boilerplate_beos_cleanup (void* closure); diff --git a/boilerplate/cairo-boilerplate-beos.cpp b/boilerplate/cairo-boilerplate-beos.cpp index 497d927..ada828a 100644 --- a/boilerplate/cairo-boilerplate-beos.cpp +++ b/boilerplate/cairo-boilerplate-beos.cpp -171,11 +171,14 @@ struct beos_boilerplate_closure // Test a real window cairo_surface_t * _cairo_boilerplate_beos_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - cairo_boilerplate_mode_t mode, - void **closure) + cairo_content_t content, + int width, + int height, + int max_width, + int max_height, + cairo_boilerplate_mode_t mode, + int id, + void **closure) { float right = width ? width - 1 : 0; float bottom = height ? height - 1 : 0; -206,11 +209,14 @@ _cairo_boilerplate_beos_cleanup (void* closure) // Test a bitmap cairo_surface_t * _cairo_boilerplate_beos_create_surface_for_bitmap (const char *name, - cairo_content_t content, - int width, - int height, - cairo_boilerplate_mode_t mode, - void **closure) + cairo_content_t content, + int width, + int height, + int max_width, + int max_height, + cairo_boilerplate_mode_t mode, + int id, + void **closure) { BRect rect(0.0, 0.0, width - 1, height - 1); color_space beosformat = (content == CAIRO_CONTENT_COLOR_ALPHA) ? B_RGBA32 diff --git a/configure.ac b/configure.ac index d3ed703..346744d 100644 --- a/configure.ac +++ b/configure.ac -144,7 +144,7 @@ CAIRO_ENABLE_SURFACE_BACKEND(os2, OS/2, no, [ dnl =========================================================================== -CAIRO_ENABLE_SURFACE_BACKEND(beos, BeOS/Zeta, no, [ +CAIRO_ENABLE_SURFACE_BACKEND(beos, BeOS/Zeta/Haiku, no, [ case "$host" in *-*-beos) beos_LIBS="" -152,6 +152,11 @@ CAIRO_ENABLE_SURFACE_BACKEND(beos, BeOS/Zeta, no, [ AC_CHECK_LIB(be,main,beos_LIBS="$beos_LIBS -lbe") AC_CHECK_LIB(zeta,main,beos_LIBS="$beos_LIBS -lzeta") ;; + *-*-haiku) + beos_LIBS="" + AC_CHECK_LIB(be,main,beos_LIBS="$beos_LIBS -lbe") + AC_CHECK_LIB(network,main,beos_LIBS="$beos_LIBS -lnetwork") + ;; *) use_beos="no (requires a BeOS platform)" ;; diff --git a/src/Makefile.sources b/src/Makefile.sources index 174bb99..e87d32b 100644 --- a/src/Makefile.sources +++ b/src/Makefile.sources -242,7 +242,7 @@ cairo_os2_sources = cairo-os2-surface.c # automake is stupid enough to always use c++ linker if we enable the # following lines, even if beos surface is not enabled. Disable it for now. cairo_beos_headers = cairo-beos.h -#cairo_beos_sources = cairo-beos-surface.cpp +cairo_beos_sources = cairo-beos-surface.cpp cairo_glitz_headers = cairo-glitz.h cairo_glitz_private = cairo-glitz-private.h diff --git a/src/cairo-beos-surface.cpp b/src/cairo-beos-surface.cpp index e527272..23d2a5b 100644 --- a/src/cairo-beos-surface.cpp +++ b/src/cairo-beos-surface.cpp -36,7 +36,9 @@ // This is a C++ file in order to use the C++ BeOS API +extern "C" { #include "cairoint.h" +} #include "cairo-beos.h" -102,17 +104,17 @@ _cairo_beos_surface_create_internal (BView* view, bool owns_bitmap_view = false); static BRect -_cairo_rect_to_brect (const cairo_rectangle_int16_t* rect) +_cairo_rect_to_brect (const cairo_rectangle_int_t* rect) { // A BRect is one pixel wider than you'd think return BRect(rect->x, rect->y, rect->x + rect->width - 1, rect->y + rect->height - 1); } -static cairo_rectangle_int16_t +static cairo_rectangle_int_t _brect_to_cairo_rect (const BRect& rect) { - cairo_rectangle_int16_t retval; + cairo_rectangle_int_t retval; retval.x = int(rect.left + 0.5); retval.y = int(rect.top + 0.5); retval.width = rect.IntegerWidth() + 1; -551,9 +553,9 @@ _cairo_beos_surface_release_source_image (void *abstract_surfac static cairo_status_t _cairo_beos_surface_acquire_dest_image (void *abstract_surface, - cairo_rectangle_int16_t *interest_rect, + cairo_rectangle_int_t *interest_rect, cairo_image_surface_t **image_out, - cairo_rectangle_int16_t *image_rect, + cairo_rectangle_int_t *image_rect, void **image_extra) { cairo_beos_surface_t *surface = reinterpret_cast( -616,9 +618,9 @@ _cairo_beos_surface_acquire_dest_image (void *abstract_surface, static void _cairo_beos_surface_release_dest_image (void *abstract_surface, - cairo_rectangle_int16_t *intersect_rect, + cairo_rectangle_int_t *intersect_rect, cairo_image_surface_t *image, - cairo_rectangle_int16_t *image_rect, + cairo_rectangle_int_t *image_rect, void *image_extra) { fprintf(stderr, "Fallback drawing\n"); -646,8 +648,8 @@ _cairo_beos_surface_release_dest_image (void *abstract_surface, static cairo_int_status_t _cairo_beos_surface_composite (cairo_operator_t op, - cairo_pattern_t *src, - cairo_pattern_t *mask, + const cairo_pattern_t *src, + const cairo_pattern_t *mask, void *dst, int src_x, int src_y, -690,7 +692,7 @@ _cairo_beos_surface_composite (cairo_operator_t op, src_y + ity + height - 1); BRect dstRect(dst_x, dst_y, dst_x + width - 1, dst_y + height - 1); - cairo_surface_t* src_surface = reinterpret_cast(src)-> + cairo_surface_t* src_surface = reinterpret_cast(src)-> surface; // Get a bitmap -769,7 +771,7 @@ _cairo_beos_surface_composite (cairo_operator_t op, static void _cairo_beos_surface_fill_rectangle (cairo_beos_surface_t *surface, - cairo_rectangle_int16_t *rect) + cairo_rectangle_int_t *rect) { BRect brect(_cairo_rect_to_brect(rect)); surface->view->FillRect(brect); -779,7 +781,7 @@ static cairo_int_status_t _cairo_beos_surface_fill_rectangles (void *abstract_surface, cairo_operator_t op, const cairo_color_t *color, - cairo_rectangle_int16_t *rects, + cairo_rectangle_int_t *rects, int num_rects) { fprintf(stderr, "Drawing %i rectangles\n", num_rects); -835,7 +837,7 @@ _cairo_beos_surface_fill_rectangles (void *abstract_surface, static cairo_int_status_t _cairo_beos_surface_set_clip_region (void *abstract_surface, - pixman_region16_t *region) + cairo_region_t *region) { fprintf(stderr, "Setting clip region\n"); cairo_beos_surface_t *surface = reinterpret_cast( -850,8 +852,8 @@ _cairo_beos_surface_set_clip_region (void *abstract_surface, return CAIRO_INT_STATUS_SUCCESS; } - int count = pixman_region_num_rects(region); - pixman_box16_t* rects = pixman_region_rects(region); + int count = pixman_region32_n_rects(®ion->rgn); + pixman_box32_t* rects = pixman_region32_rectangles(®ion->rgn, &count); BRegion bregion; for (int i = 0; i < count; ++i) { // Have to substract one, because for pixman, the second coordinate -864,7 +866,7 @@ _cairo_beos_surface_set_clip_region (void *abstract_surface, static cairo_int_status_t _cairo_beos_surface_get_extents (void *abstract_surface, - cairo_rectangle_int16_t *rectangle) + cairo_rectangle_int_t *rectangle) { cairo_beos_surface_t *surface = reinterpret_cast( abstract_surface); -913,7 +915,16 @@ static const struct _cairo_surface_backend cairo_beos_surface_backend = { NULL, /* mask */ NULL, /* stroke */ NULL, /* fill */ - NULL /* show_glyphs */ + NULL, /* show_glyphs */ + NULL, /* snapshot */ + NULL, /* is_similar */ + NULL, /* reset */ + NULL, /* fill_stroke */ + NULL, /* create_solid_pattern_surface */ + NULL, /* can_repaint_solid_pattern_surface */ + NULL, /* has_show_text_glyphs */ + NULL /* show_text_glyphs */ + }; static cairo_surface_t * -925,8 +936,7 @@ _cairo_beos_surface_create_internal (BView* view, cairo_beos_surface_t *surface = static_cast( malloc(sizeof(cairo_beos_surface_t))); if (surface == NULL) { - _cairo_error (CAIRO_STATUS_NO_MEMORY); - return const_cast(&_cairo_surface_nil); + return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); } cairo_content_t content = CAIRO_CONTENT_COLOR; diff --git a/src/cairo-beos.h b/src/cairo-beos.h index f53be5a..4ca7af3 100644 --- a/src/cairo-beos.h +++ b/src/cairo-beos.h -36,7 +36,9 @@ #ifndef CAIRO_BEOS_H #define CAIRO_BEOS_H +extern "C" { #include "cairo.h" +} #if CAIRO_HAS_BEOS_SURFACE diff --git a/test/Makefile.am b/test/Makefile.am index 9c670ed..e178a9e 100644 --- a/test/Makefile.am +++ b/test/Makefile.am -304,10 +304,15 @@ if BUILD_ANY2PPM cairo_test_suite_DEPENDENCIES += \ any2ppm endif -if HAVE_PTHREAD -cairo_test_suite_LDADD += -lpthread + +if CAIRO_HAS_BEOS_SURFACE +cairo_test_suite_LDADD += -lnetwork endif +#if HAVE_PTHREAD +#cairo_test_suite_LDADD += -lpthread +#endif + if CAIRO_HAS_SDL_SURFACE cairo_test_suite_LDADD += $(sdl_LIBS) endif diff --git a/test/make-cairo-test-constructors.pl b/test/make-cairo-test-constructors.pl index 5e77175..bcd12b0 100755 --- a/test/make-cairo-test-constructors.pl +++ b/test/make-cairo-test-constructors.pl -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/boot/common/bin/perl -w while (<>) { next unless /CAIRO_TEST \((.*),/; # XXX Parse multi-line macro