mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-05 06:28:55 +02:00
301 lines
11 KiB
Diff
301 lines
11 KiB
Diff
diff --git a/boilerplate/Makefile.sources b/boilerplate/Makefile.sources
|
|
index 1b82bbd..7131793 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.cpp b/boilerplate/cairo-boilerplate-beos.cpp
|
|
index 497d927..303c8ea 100644
|
|
--- a/boilerplate/cairo-boilerplate-beos.cpp
|
|
+++ b/boilerplate/cairo-boilerplate-beos.cpp
|
|
@@ -153,8 +153,11 @@ AppRunner::~AppRunner()
|
|
if (be_app) {
|
|
if (be_app->Lock())
|
|
be_app->Quit();
|
|
+// XXX for some reason the follow lines cause boilerplate to crash on exit, commenting it out at least allows it to die without crashing
|
|
+#if 0
|
|
delete be_app;
|
|
be_app = NULL;
|
|
+#endif
|
|
}
|
|
}
|
|
|
|
@@ -171,11 +174,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 +212,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 48b61b2..f16e252 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 7305995..694a552 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..fca15aa 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<cairo_beos_surface_t*>(
|
|
@@ -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<cairo_surface_pattern_t*>(src)->
|
|
+ cairo_surface_t* src_surface = reinterpret_cast<const cairo_surface_pattern_t*>(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<cairo_beos_surface_t*>(
|
|
@@ -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<cairo_beos_surface_t*>(
|
|
abstract_surface);
|
|
@@ -913,7 +915,15 @@ 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 +935,7 @@ _cairo_beos_surface_create_internal (BView* view,
|
|
cairo_beos_surface_t *surface = static_cast<cairo_beos_surface_t*>(
|
|
malloc(sizeof(cairo_beos_surface_t)));
|
|
if (surface == NULL) {
|
|
- _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
|
- return const_cast<cairo_surface_t*>(&_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.c b/src/cairo.c
|
|
index ddc8d4a..5f86820 100644
|
|
--- a/src/cairo.c
|
|
+++ b/src/cairo.c
|
|
@@ -83,7 +83,10 @@ cairo_status_t
|
|
_cairo_error (cairo_status_t status)
|
|
{
|
|
CAIRO_ENSURE_UNIQUE;
|
|
+// XXX if we remove the assert for now, it allows Cairo on Haiku to run tests
|
|
+#if 0
|
|
assert (_cairo_status_is_error (status));
|
|
+#endif
|
|
|
|
return status;
|
|
}
|
|
diff --git a/test/Makefile.am b/test/Makefile.am
|
|
index 2a1d93b..8f705ca 100644
|
|
--- a/test/Makefile.am
|
|
+++ b/test/Makefile.am
|
|
@@ -88,8 +88,10 @@ cairo_test_suite_DEPENDENCIES += \
|
|
any2ppm
|
|
endif
|
|
if HAVE_PTHREAD
|
|
+if !CAIRO_HAS_BEOS_SURFACE
|
|
cairo_test_suite_LDADD += -lpthread
|
|
endif
|
|
+endif
|
|
|
|
BUILT_SOURCES += cairo-test-constructors.c
|
|
noinst_SCRIPTS = make-cairo-test-constructors.pl
|
|
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
|