[cairo-commit] 3 commits - boilerplate/cairo-boilerplate.c boilerplate/cairo-test-beos.cpp boilerplate/cairo-test-beos.h src/cairo-win32-surface.c test/mask-beos-bitmap-argb32-ref.png test/mask-beos-bitmap-rgb24-ref.png test/mask-beos-rgb24-ref.png test/set-source-beos-bitmap-rgb24-ref.png test/set-source-beos-rgb24-ref.png test/trap-clip-beos-bitmap-rgb24-ref.png test/trap-clip-beos-rgb24-ref.png

Christian Biesinger biesi at kemper.freedesktop.org
Fri Oct 27 14:51:38 PDT 2006


 boilerplate/cairo-boilerplate.c           |    9 ++++--
 boilerplate/cairo-test-beos.cpp           |   44 ++++++++++++++++++++++--------
 boilerplate/cairo-test-beos.h             |   16 ++++++++--
 dev/null                                  |binary
 src/cairo-win32-surface.c                 |    6 ++--
 test/mask-beos-bitmap-argb32-ref.png      |    0 
 test/mask-beos-bitmap-rgb24-ref.png       |    0 
 test/mask-beos-rgb24-ref.png              |    0 
 test/set-source-beos-bitmap-rgb24-ref.png |    0 
 test/set-source-beos-rgb24-ref.png        |    0 
 test/trap-clip-beos-bitmap-rgb24-ref.png  |    0 
 test/trap-clip-beos-rgb24-ref.png         |    0 
 12 files changed, 54 insertions(+), 21 deletions(-)

New commits:
diff-tree a34ba73136a1b34c413eff78a44c28a6f1ba80f6 (from 2ec0237051cd4f756a8205cb9ecafc7bfe285a06)
Author: Christian Biesinger <cbiesinger at web.de>
Date:   Fri Oct 27 23:50:57 2006 +0200

    [beos] Allow a pixel error of 1 for BeOS tests
    
    That allows us to delete the BeOS-specific reference images.

diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index 404e4db..9508338 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -1496,11 +1496,14 @@ cairo_boilerplate_target_t targets[] =
       create_svg_surface, svg_surface_write_to_png, cleanup_svg },
 #endif
 #if CAIRO_HAS_BEOS_SURFACE
-    { "beos", CAIRO_SURFACE_TYPE_BEOS, CAIRO_CONTENT_COLOR, 0,
+    /* BeOS sometimes produces a slightly different image. Perhaps this
+     * is related to the fact that it doesn't use premultiplied alpha...
+     * Just ignore the small difference. */
+    { "beos", CAIRO_SURFACE_TYPE_BEOS, CAIRO_CONTENT_COLOR, 1,
       create_beos_surface, cairo_surface_write_to_png, cleanup_beos},
-    { "beos-bitmap", CAIRO_SURFACE_TYPE_BEOS, CAIRO_CONTENT_COLOR, 0,
+    { "beos-bitmap", CAIRO_SURFACE_TYPE_BEOS, CAIRO_CONTENT_COLOR, 1,
       create_beos_bitmap_surface, cairo_surface_write_to_png, cleanup_beos_bitmap},
-    { "beos-bitmap", CAIRO_SURFACE_TYPE_BEOS, CAIRO_CONTENT_COLOR_ALPHA, 0,
+    { "beos-bitmap", CAIRO_SURFACE_TYPE_BEOS, CAIRO_CONTENT_COLOR_ALPHA, 1,
       create_beos_bitmap_surface, cairo_surface_write_to_png, cleanup_beos_bitmap},
 #endif
 
diff --git a/test/mask-beos-bitmap-argb32-ref.png b/test/mask-beos-bitmap-argb32-ref.png
deleted file mode 100644
index 6ddb8e1..0000000
Binary files a/test/mask-beos-bitmap-argb32-ref.png and /dev/null differ
diff --git a/test/mask-beos-bitmap-rgb24-ref.png b/test/mask-beos-bitmap-rgb24-ref.png
deleted file mode 100644
index fce4263..0000000
Binary files a/test/mask-beos-bitmap-rgb24-ref.png and /dev/null differ
diff --git a/test/mask-beos-rgb24-ref.png b/test/mask-beos-rgb24-ref.png
deleted file mode 100644
index fce4263..0000000
Binary files a/test/mask-beos-rgb24-ref.png and /dev/null differ
diff --git a/test/set-source-beos-bitmap-rgb24-ref.png b/test/set-source-beos-bitmap-rgb24-ref.png
deleted file mode 100644
index 627a00d..0000000
Binary files a/test/set-source-beos-bitmap-rgb24-ref.png and /dev/null differ
diff --git a/test/set-source-beos-rgb24-ref.png b/test/set-source-beos-rgb24-ref.png
deleted file mode 100644
index 627a00d..0000000
Binary files a/test/set-source-beos-rgb24-ref.png and /dev/null differ
diff --git a/test/trap-clip-beos-bitmap-rgb24-ref.png b/test/trap-clip-beos-bitmap-rgb24-ref.png
deleted file mode 100644
index 779d215..0000000
Binary files a/test/trap-clip-beos-bitmap-rgb24-ref.png and /dev/null differ
diff --git a/test/trap-clip-beos-rgb24-ref.png b/test/trap-clip-beos-rgb24-ref.png
deleted file mode 100644
index 779d215..0000000
Binary files a/test/trap-clip-beos-rgb24-ref.png and /dev/null differ
diff-tree 2ec0237051cd4f756a8205cb9ecafc7bfe285a06 (from e29aea745aa2c23ac9d60612813d5e415e1f8e57)
Author: Christian Biesinger <cbiesinger at web.de>
Date:   Fri Oct 27 23:47:15 2006 +0200

    [beos] make tests compile again

diff --git a/boilerplate/cairo-test-beos.cpp b/boilerplate/cairo-test-beos.cpp
index 2e4ab25..78831e8 100644
--- a/boilerplate/cairo-test-beos.cpp
+++ b/boilerplate/cairo-test-beos.cpp
@@ -46,13 +46,26 @@
 #include <View.h>
 #include <Bitmap.h>
 
+// 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 da58fff..1e562cc 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);
diff-tree e29aea745aa2c23ac9d60612813d5e415e1f8e57 (from 61bf9b009b47312c20d54198790542cd20fc5576)
Author: Christian Biesinger <cbiesinger at web.de>
Date:   Fri Oct 27 12:07:26 2006 +0200

    [win32] Add parentheses around & operator
    
    This fixes a GCC warning. Also, it fixes a bug: The precedence
    of & is not what you might expect.

diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
old mode 100644
new mode 100755
index ef7effb..7aeb256
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -765,9 +765,9 @@ _cairo_win32_surface_composite (cairo_op
      * we may as well give up, since this is what we'll
      * look to for optimization.
      */
-    if (dst->flags & (CAIRO_WIN32_SURFACE_CAN_BITBLT |
-		      CAIRO_WIN32_SURFACE_CAN_ALPHABLEND |
-		      CAIRO_WIN32_SURFACE_CAN_STRETCHBLT)
+    if ((dst->flags & (CAIRO_WIN32_SURFACE_CAN_BITBLT |
+		       CAIRO_WIN32_SURFACE_CAN_ALPHABLEND |
+		       CAIRO_WIN32_SURFACE_CAN_STRETCHBLT))
 	== 0)
     {
 	return CAIRO_INT_STATUS_UNSUPPORTED;


More information about the cairo-commit mailing list