diff src/event.c @ 450:a417fd980228

Replace cairo_format_t with mb_img_fmt_t. - Replace all CAIRO_FORAMT_* with MB_IFMT_* - wrap functions return or are argumented with image format.
author Thinker K.F. Li <thinker@branda.to>
date Wed, 05 Aug 2009 15:54:44 +0800
parents 16116d84bc5e
children 5c9e2a8a4bd8
line wrap: on
line diff
--- a/src/event.c	Tue Aug 04 23:47:34 2009 +0800
+++ b/src/event.c	Wed Aug 05 15:54:44 2009 +0800
@@ -28,17 +28,17 @@
 typedef float co_aix;
 
 typedef struct shape shape_t;
-typedef struct cairo_surface mbe_surface_t;
+typedef struct _mbe_surface mbe_surface_t;
 typedef struct coord coord_t;
 
-typedef struct cairo mbe_t;
-struct cairo {
+typedef struct _mbe mbe_t;
+struct _mbe {
     STAILQ(shape_t) drawed;
     STAILQ(shape_t) clip_pathes;
     mbe_surface_t *tgt;
 };
 
-struct cairo_surface {
+struct _mbe_surface {
     mbe_t *cr;
     int w, h;
     unsigned char *data;
@@ -85,7 +85,8 @@
 #define mbe_surface_destroy(surface)		\
     do { free((surface)->data); free(surface); } while(0)
 #define mbe_image_surface_get_stride(surface) 1
-#define CAIRO_FORMAT_A1 1
+#undef MB_IFMT_A1
+#define MB_IFMT_A1 1
 
 
 typedef struct _area area_t;
@@ -676,7 +677,7 @@
     w = mbe_image_surface_get_width(rdman_surface);
     h = mbe_image_surface_get_height(rdman_surface);
     
-    surface = mbe_image_surface_create(CAIRO_FORMAT_A1, w, h);
+    surface = mbe_image_surface_create(MB_IFMT_A1, w, h);
     if(surface == NULL)
 	return NULL;
 
@@ -876,7 +877,7 @@
     mbe_t *cr, *backend;
     mbe_surface_t *surf;
 
-    surf = mbe_image_surface_create(CAIRO_FORMAT_A1, 100, 100);
+    surf = mbe_image_surface_create(MB_IFMT_A1, 100, 100);
     cr = mbe_create(surf);
     backend = mbe_create(surf);
     rdman = redraw_man_new(cr, backend);
@@ -962,7 +963,7 @@
     shape_add_point(shape2, 5, 5);
     shape_add_point(shape3, 4, 3);
     
-    surf = mbe_image_surface_create(CAIRO_FORMAT_A1, 100, 100);
+    surf = mbe_image_surface_create(MB_IFMT_A1, 100, 100);
     cr = mbe_create(surf);
     r = _is_obj_objs_overlay((mb_obj_t *)coord1, (mb_obj_t *)coord2, cr);
     CU_ASSERT(!r);
@@ -970,7 +971,7 @@
     mbe_surface_destroy(surf);
     sh_clear_flags(coord2, GEF_OV_DRAW);
 
-    surf = mbe_image_surface_create(CAIRO_FORMAT_A1, 100, 100);
+    surf = mbe_image_surface_create(MB_IFMT_A1, 100, 100);
     cr = mbe_create(surf);
     r = _is_obj_objs_overlay((mb_obj_t *)shape1, (mb_obj_t *)coord2, cr);
     CU_ASSERT(!r);
@@ -978,7 +979,7 @@
     mbe_surface_destroy(surf);
     sh_clear_flags(coord2, GEF_OV_DRAW);
 
-    surf = mbe_image_surface_create(CAIRO_FORMAT_A1, 100, 100);
+    surf = mbe_image_surface_create(MB_IFMT_A1, 100, 100);
     cr = mbe_create(surf);
     r = _is_obj_objs_overlay((mb_obj_t *)coord1, (mb_obj_t *)shape2, cr);
     CU_ASSERT(!r);
@@ -986,7 +987,7 @@
     mbe_surface_destroy(surf);
     sh_clear_flags(shape2, GEF_OV_DRAW);
 
-    surf = mbe_image_surface_create(CAIRO_FORMAT_A1, 100, 100);
+    surf = mbe_image_surface_create(MB_IFMT_A1, 100, 100);
     cr = mbe_create(surf);
     r = _is_obj_objs_overlay((mb_obj_t *)shape1, (mb_obj_t *)shape2, cr);
     CU_ASSERT(!r);
@@ -994,7 +995,7 @@
     mbe_surface_destroy(surf);
     sh_clear_flags(shape2, GEF_OV_DRAW);
 
-    surf = mbe_image_surface_create(CAIRO_FORMAT_A1, 100, 100);
+    surf = mbe_image_surface_create(MB_IFMT_A1, 100, 100);
     cr = mbe_create(surf);
     r = _is_obj_objs_overlay((mb_obj_t *)shape1, (mb_obj_t *)shape3, cr);
     CU_ASSERT(!r);
@@ -1002,7 +1003,7 @@
     mbe_surface_destroy(surf);
     sh_clear_flags(shape3, GEF_OV_DRAW);
 
-    surf = mbe_image_surface_create(CAIRO_FORMAT_A1, 100, 100);
+    surf = mbe_image_surface_create(MB_IFMT_A1, 100, 100);
     cr = mbe_create(surf);
     r = _is_obj_objs_overlay((mb_obj_t *)coord1, (mb_obj_t *)shape3, cr);
     CU_ASSERT(!r);
@@ -1012,7 +1013,7 @@
     
     shape_add_point(shape1, 5, 5);
 
-    surf = mbe_image_surface_create(CAIRO_FORMAT_A1, 100, 100);
+    surf = mbe_image_surface_create(MB_IFMT_A1, 100, 100);
     cr = mbe_create(surf);
     r = _is_obj_objs_overlay((mb_obj_t *)coord1, (mb_obj_t *)coord2, cr);
     CU_ASSERT(r);
@@ -1020,7 +1021,7 @@
     mbe_surface_destroy(surf);
     sh_clear_flags(coord2, GEF_OV_DRAW);
 
-    surf = mbe_image_surface_create(CAIRO_FORMAT_A1, 100, 100);
+    surf = mbe_image_surface_create(MB_IFMT_A1, 100, 100);
     cr = mbe_create(surf);
     r = _is_obj_objs_overlay((mb_obj_t *)shape1, (mb_obj_t *)coord2, cr);
     CU_ASSERT(r);
@@ -1028,7 +1029,7 @@
     mbe_surface_destroy(surf);
     sh_clear_flags(coord2, GEF_OV_DRAW);
 
-    surf = mbe_image_surface_create(CAIRO_FORMAT_A1, 100, 100);
+    surf = mbe_image_surface_create(MB_IFMT_A1, 100, 100);
     cr = mbe_create(surf);
     r = _is_obj_objs_overlay((mb_obj_t *)coord1, (mb_obj_t *)shape2, cr);
     CU_ASSERT(r);
@@ -1036,7 +1037,7 @@
     mbe_surface_destroy(surf);
     sh_clear_flags(shape2, GEF_OV_DRAW);
 
-    surf = mbe_image_surface_create(CAIRO_FORMAT_A1, 100, 100);
+    surf = mbe_image_surface_create(MB_IFMT_A1, 100, 100);
     cr = mbe_create(surf);
     r = _is_obj_objs_overlay((mb_obj_t *)shape1, (mb_obj_t *)shape2, cr);
     CU_ASSERT(r);
@@ -1044,7 +1045,7 @@
     mbe_surface_destroy(surf);
     sh_clear_flags(shape2, GEF_OV_DRAW);
 
-    surf = mbe_image_surface_create(CAIRO_FORMAT_A1, 100, 100);
+    surf = mbe_image_surface_create(MB_IFMT_A1, 100, 100);
     cr = mbe_create(surf);
     r = _is_obj_objs_overlay((mb_obj_t *)shape1, (mb_obj_t *)shape3, cr);
     CU_ASSERT(!r);
@@ -1052,7 +1053,7 @@
     mbe_surface_destroy(surf);
     sh_clear_flags(shape3, GEF_OV_DRAW);
 
-    surf = mbe_image_surface_create(CAIRO_FORMAT_A1, 100, 100);
+    surf = mbe_image_surface_create(MB_IFMT_A1, 100, 100);
     cr = mbe_create(surf);
     r = _is_obj_objs_overlay((mb_obj_t *)coord1, (mb_obj_t *)shape3, cr);
     CU_ASSERT(r);