summaryrefslogtreecommitdiff
path: root/src/cairo-bentley-ottmann.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-09-19 16:15:55 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2008-09-19 16:59:51 +0100
commita6c0ebee7aa9298af24859c37d8005eba772c4c6 (patch)
tree1a31f095b31a41af30b355757fc103eef9620463 /src/cairo-bentley-ottmann.c
parent91f0b8b1eac967d4534201794c9ba7880ddfaa17 (diff)
downloadcairo-a6c0ebee7aa9298af24859c37d8005eba772c4c6.tar.gz
[tessellator] Only run sweep-line validator when debugging
The tessellator is well-proven now. However, the sweep-line validator consumes around 50% of the total time required to draw the fractal Pythagoras tree (the leaves are sub-pixel rectangles, so lots of edges to sweep through). So disable the validator, but keep it available for debugging.
Diffstat (limited to 'src/cairo-bentley-ottmann.c')
-rw-r--r--src/cairo-bentley-ottmann.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/cairo-bentley-ottmann.c b/src/cairo-bentley-ottmann.c
index e89e1fd73..b5c757e93 100644
--- a/src/cairo-bentley-ottmann.c
+++ b/src/cairo-bentley-ottmann.c
@@ -39,6 +39,9 @@
#include "cairo-skiplist-private.h"
#include "cairo-freelist-private.h"
+#define DEBUG_VALIDATE 0
+#define DEBUG_PRINT_STATE 0
+
typedef cairo_point_t cairo_bo_point32_t;
typedef struct _cairo_bo_point128 {
@@ -941,7 +944,6 @@ _cairo_bo_sweep_line_swap (cairo_bo_sweep_line_t *sweep_line,
left->prev = right;
}
-#define DEBUG_PRINT_STATE 0
#if DEBUG_PRINT_STATE
static void
_cairo_bo_edge_print (cairo_bo_edge_t *edge)
@@ -1177,6 +1179,7 @@ _cairo_bo_traps_fini (cairo_bo_traps_t *bo_traps)
_cairo_freelist_fini (&bo_traps->freelist);
}
+#if DEBUG_VALIDATE
static void
_cairo_bo_sweep_line_validate (cairo_bo_sweep_line_t *sweep_line)
{
@@ -1202,6 +1205,7 @@ _cairo_bo_sweep_line_validate (cairo_bo_sweep_line_t *sweep_line)
exit (1);
}
}
+#endif
static cairo_status_t
@@ -1324,9 +1328,8 @@ _cairo_bentley_ottmann_tessellate_bo_edges (cairo_bo_edge_t *edges,
#if DEBUG_PRINT_STATE
print_state ("After processing start", &event_queue, &sweep_line);
#endif
- _cairo_bo_sweep_line_validate (&sweep_line);
-
break;
+
case CAIRO_BO_EVENT_TYPE_STOP:
edge = event->e1;
@@ -1346,9 +1349,8 @@ _cairo_bentley_ottmann_tessellate_bo_edges (cairo_bo_edge_t *edges,
#if DEBUG_PRINT_STATE
print_state ("After processing stop", &event_queue, &sweep_line);
#endif
- _cairo_bo_sweep_line_validate (&sweep_line);
-
break;
+
case CAIRO_BO_EVENT_TYPE_INTERSECTION:
edge1 = event->e1;
edge2 = event->e2;
@@ -1382,10 +1384,11 @@ _cairo_bentley_ottmann_tessellate_bo_edges (cairo_bo_edge_t *edges,
#if DEBUG_PRINT_STATE
print_state ("After processing intersection", &event_queue, &sweep_line);
#endif
- _cairo_bo_sweep_line_validate (&sweep_line);
-
break;
}
+#if DEBUG_VALIDATE
+ _cairo_bo_sweep_line_validate (&sweep_line);
+#endif
}
*num_intersections = intersection_count;