From 2ec0237051cd4f756a8205cb9ecafc7bfe285a06 Mon Sep 17 00:00:00 2001 From: Christian Biesinger Date: Fri, 27 Oct 2006 23:47:15 +0200 Subject: [PATCH] [beos] make tests compile again --- boilerplate/cairo-test-beos.cpp | 44 ++++++++++++++++++++++++--------- boilerplate/cairo-test-beos.h | 16 +++++++++--- 2 files changed, 45 insertions(+), 15 deletions(-) diff --git a/boilerplate/cairo-test-beos.cpp b/boilerplate/cairo-test-beos.cpp index 2e4ab2524..78831e8e1 100644 --- a/boilerplate/cairo-test-beos.cpp +++ b/boilerplate/cairo-test-beos.cpp @@ -46,13 +46,26 @@ #include #include +// BeOS's C++ compiler does not support varargs in macros +// So, define CAIRO_BOILERPLATE_LOG here +#define CAIRO_BOILERPLATE_LOG cairo_beos_boilerplate_log + extern "C" { -#include "cairo-test.h" +#include "cairo-boilerplate.h" } #include "cairo-test-beos.h" #include "cairo-beos.h" +static int cairo_beos_boilerplate_log(const char* format, ...) { + va_list args; + int rv; + va_start(args, format); + rv = vfprintf(stderr, format, args); + va_end(args); + return rv; +} + class CairoTestWindow : public BWindow { public: @@ -129,18 +142,18 @@ AppRunner::AppRunner() sem_id initsem = create_sem(0, "Cairo BApplication init"); if (initsem < B_OK) { - cairo_test_log("Error creating BeOS initialization semaphore\n"); + CAIRO_BOILERPLATE_LOG("Error creating BeOS initialization semaphore\n"); return; } thread_id tid = spawn_thread(nsBeOSApp::Main, "Cairo/BeOS test", B_NORMAL_PRIORITY, (void *)initsem); if (tid < B_OK || B_OK != resume_thread(tid)) { - cairo_test_log("Error spawning thread\n"); + CAIRO_BOILERPLATE_LOG("Error spawning thread\n"); return; } if (B_OK != acquire_sem(initsem)) { - cairo_test_log("Error acquiring semaphore\n"); + CAIRO_BOILERPLATE_LOG("Error acquiring semaphore\n"); return; } @@ -170,12 +183,17 @@ struct beos_test_closure // Test a real window cairo_surface_t * -create_beos_surface (cairo_test_t* test, cairo_content_t content, void **closure) +create_beos_surface (const char *name, + cairo_content_t content, + int width, + int height, + cairo_boilerplate_mode_t mode, + void **closure) { - float right = test->width ? test->width - 1 : 0; - float bottom = test->height ? test->height - 1 : 0; + float right = width ? width - 1 : 0; + float bottom = height ? height - 1 : 0; BRect rect(0.0, 0.0, right, bottom); - CairoTestWindow* wnd = new CairoTestWindow(rect, test->name); + CairoTestWindow* wnd = new CairoTestWindow(rect, name); beos_test_closure* bclosure = new beos_test_closure; bclosure->view = wnd->View(); @@ -200,10 +218,14 @@ cleanup_beos (void* closure) // Test a bitmap cairo_surface_t * -create_beos_bitmap_surface (cairo_test_t* test, cairo_content_t content, - void **closure) +create_beos_bitmap_surface (const char *name, + cairo_content_t content, + int width, + int height, + cairo_boilerplate_mode_t mode, + void **closure) { - BRect rect(0.0, 0.0, test->width - 1, test->height - 1); + BRect rect(0.0, 0.0, width - 1, height - 1); color_space beosformat = (content == CAIRO_CONTENT_COLOR_ALPHA) ? B_RGBA32 : B_RGB32; BBitmap* bmp = new BBitmap(rect, beosformat, true); diff --git a/boilerplate/cairo-test-beos.h b/boilerplate/cairo-test-beos.h index da58fff4a..1e562cc3d 100644 --- a/boilerplate/cairo-test-beos.h +++ b/boilerplate/cairo-test-beos.h @@ -8,15 +8,23 @@ CAIRO_BEGIN_DECLS extern cairo_surface_t * -create_beos_surface (cairo_test_t* test, cairo_content_t content, - void **closure); +create_beos_surface (const char *name, + cairo_content_t content, + int width, + int height, + cairo_boilerplate_mode_t mode, + void **closure); extern void cleanup_beos (void* closure); extern cairo_surface_t * -create_beos_bitmap_surface (cairo_test_t* test, cairo_content_t content, - void **closure); +create_beos_bitmap_surface (const char *name, + cairo_content_t content, + int width, + int height, + cairo_boilerplate_mode_t mode, + void **closure); extern void cleanup_beos_bitmap (void* closure);