- if(l->tmp)
- s->nr = l->tmp;
- fprintf(stderr, "[%d] (%d,%d) -> (%d,%d) %s\n",
- s->nr, s->a.x, s->a.y, s->b.x, s->b.y,
- s->dir==DIR_UP?"up":"down");
+ /*if(l->tmp)
+ s->nr = l->tmp;*/
+ fprintf(stderr, "[%d] (%d,%d) -> (%d,%d) %s (stroke %08x, %d more to come)\n",
+ s->nr, s->a.x, s->a.y, s->b.x, s->b.y,
+ s->dir==DIR_UP?"up":"down", stroke, stroke->num_points - 1 - pos);
+#endif
+ event_t e = event_new();
+ e.type = s->delta.y ? EVENT_START : EVENT_HORIZONTAL;
+ e.p = s->a;
+ e.s1 = s;
+ e.s2 = 0;
+ heap_put(queue, &e);
+ if(e.type != EVENT_HORIZONTAL) {
+ break;
+ }
+ }
+ if(s) {
+#ifdef DEBUG
+ fprintf(stderr, "attaching contingency of stroke %08x to segment [%d] %s\n",
+ stroke, s, s->delta.y?"":"(horizontal)");
+#endif
+ s->stroke = stroke;
+ s->stroke_pos = pos;
+ }
+}
+
+static void gfxpoly_enqueue(gfxpoly_t*p, heap_t*queue, int polygon_nr)
+{
+ int t;
+ gfxpolystroke_t*stroke = p->strokes;
+ for(;stroke;stroke=stroke->next) {
+ assert(stroke->num_points > 1);
+
+#ifdef CHECKS
+ int s;
+ for(s=0;s<stroke->num_points-1;s++) {
+ assert(stroke->points[s].y <= stroke->points[s+1].y);
+ }