[cogl/wip/android: 12/12] debug: Allow to compile a debug Cogl without cairo



commit de6dfc2e4d596bbb3886be2bf66b68128d7e7e1e
Author: Damien Lespiau <damien lespiau intel com>
Date:   Mon May 16 17:50:49 2011 +0100

    debug: Allow to compile a debug Cogl without cairo
    
    For people still wanting the debugging code, but don't have or don't
    want to compile cairo for their platform.

 cogl/cogl-rectangle-map.c |   12 ++++++++----
 configure.ac              |   10 +++++++++-
 2 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/cogl/cogl-rectangle-map.c b/cogl/cogl-rectangle-map.c
index 5fa8ab6..60b6e79 100644
--- a/cogl/cogl-rectangle-map.c
+++ b/cogl/cogl-rectangle-map.c
@@ -40,7 +40,7 @@
    http://www.blackpawn.com/texts/lightmaps/default.html
 */
 
-#ifdef COGL_ENABLE_DEBUG
+#if defined (COGL_ENABLE_DEBUG) && defined (HAVE_CAIRO)
 
 /* The cairo header is only used for debugging to generate an image of
    the atlas */
@@ -48,7 +48,7 @@
 
 static void _cogl_rectangle_map_dump_image (CoglRectangleMap *map);
 
-#endif /* COGL_ENABLE_DEBUG */
+#endif /* COGL_ENABLE_DEBUG && HAVE_CAIRO */
 
 typedef struct _CoglRectangleMapNode       CoglRectangleMapNode;
 typedef struct _CoglRectangleMapStackEntry CoglRectangleMapStackEntry;
@@ -456,7 +456,9 @@ _cogl_rectangle_map_add (CoglRectangleMap *map,
 #ifdef COGL_ENABLE_DEBUG
       if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DUMP_ATLAS_IMAGE)))
         {
+#ifdef HAVE_CAIRO
           _cogl_rectangle_map_dump_image (map);
+#endif
           /* Dumping the rectangle map is really slow so we might as well
              verify the space remaining here as it is also quite slow */
           _cogl_rectangle_map_verify (map);
@@ -547,7 +549,9 @@ _cogl_rectangle_map_remove (CoglRectangleMap *map,
 #ifdef COGL_ENABLE_DEBUG
   if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DUMP_ATLAS_IMAGE)))
     {
+#ifdef HAVE_CAIRO
       _cogl_rectangle_map_dump_image (map);
+#endif
       /* Dumping the rectangle map is really slow so we might as well
          verify the space remaining here as it is also quite slow */
       _cogl_rectangle_map_verify (map);
@@ -694,7 +698,7 @@ _cogl_rectangle_map_free (CoglRectangleMap *map)
   g_free (map);
 }
 
-#ifdef COGL_ENABLE_DEBUG
+#if defined (COGL_ENABLE_DEBUG) && defined (HAVE_CAIRO)
 
 static void
 _cogl_rectangle_map_dump_image_cb (CoglRectangleMapNode *node, void *data)
@@ -749,4 +753,4 @@ _cogl_rectangle_map_dump_image (CoglRectangleMap *map)
   cairo_surface_destroy (surface);
 }
 
-#endif /* COGL_ENABLE_DEBUG */
+#endif /* COGL_ENABLE_DEBUG && HAVE_CAIRO */
diff --git a/configure.ac b/configure.ac
index 0ce5328..205b78f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -170,7 +170,15 @@ AS_CASE(
   [
     test "$cflags_set" = set || CFLAGS="$CFLAGS -g -O0"
     COGL_EXTRA_CFLAGS="$COGL_EXTRA_CFLAGS -DCOGL_GL_DEBUG -DCOGL_OBJECT_DEBUG -DCOGL_HANDLE_DEBUG -DCOGL_ENABLE_DEBUG"
-    COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES cairo"
+
+    # debugging code can use cairo to dump the atlas
+    PKG_CHECK_EXISTS([CAIRO], [cairo], [have_cairo=yes])
+    AS_IF([test "x$have_cairo" = "xyes"],
+          [
+            COGL_PKG_REQUIRES="$COGL_PKG_REQUIRES cairo"
+            AC_DEFINE([HAVE_CAIRO], [1], [Wether we have cairo])
+          ])
+
   ],
   [no],
   [



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]