+ horiz->num = 0;
+}
+
+void horiz_destroy(horizdata_t*horiz)
+{
+ if(horiz->data) rfx_free(horiz->data);
+ horiz->data = 0;
+}
+
+static int compare_horizontals(const void *_h1, const void *_h2)
+{
+ horizontal_t*h1 = (horizontal_t*)_h1;
+ horizontal_t*h2 = (horizontal_t*)_h2;
+ return h1->x1 - h2->x1;
+}
+
+static void process_horizontals(status_t*status)
+{
+ horizdata_t*horiz = &status->horiz;
+ qsort(horiz->data, horiz->num, sizeof(horizontal_t), compare_horizontals);
+ int t;
+ int xstart = 0;
+ for(t=0;t<horiz->num;t++) {
+ horizontal_t*h = &horiz->data[t];
+#ifdef DEBUG
+ fprintf(stderr, "horizontal (y=%.2f): %.2f -> %.2f dir=%s fs=%p\n",
+ h->y * status->gridsize,
+ h->x1 * status->gridsize,
+ h->x2 * status->gridsize,
+ h->dir==DIR_UP?"up":"down", h->fs);
+#endif
+ assert(h->y == status->y);
+ assert(xrow_contains(status->xrow, h->x1));
+ assert(xrow_contains(status->xrow, h->x2));
+
+ int pos = xrow_find(status->xrow, h->x1);
+ int x = h->x1;
+ assert(pos <= status->xrow->num);
+ assert(pos == status->xrow->num || status->xrow->x[pos] > x);
+
+ while(x < h->x2) {
+ int next_x = pos < status->xrow->num ? status->xrow->x[pos] : h->x2;
+ pos++;
+
+ assert(next_x > x);
+
+ point_t p1 = {x,h->y};
+ point_t p2 = {next_x,h->y};
+ segment_t* left = actlist_find(status->actlist, p1, p2);
+ assert(!left || left->fs_out_ok);
+#ifdef DEBUG
+ fprintf(stderr, " fragment %.2f..%.2f\n",
+ x * status->gridsize,
+ next_x * status->gridsize);
+ if(left) {
+ fprintf(stderr, " segment [%d] (%.2f,%.2f -> %.2f,%2f, at %.2f,%.2f) is to the left\n",
+ SEGNR(left),
+ left->a.x * status->gridsize,
+ left->a.y * status->gridsize,
+ left->b.x * status->gridsize,
+ left->b.y * status->gridsize,
+ left->pos.x * status->gridsize,
+ left->pos.y * status->gridsize
+ );
+ /* this segment might be a distance away from the left point
+ of the horizontal line if the horizontal line belongs to a stroke
+ with segments that just ended (so this horizontal line appears to
+ be "floating in space" from our current point of view)
+ assert(left->pos.y == h->y && left->pos.x == h->x1);
+ */
+ }
+#endif
+ windstate_t below = left?left->wind:status->windrule->start(status->context);
+ windstate_t above = status->windrule->add(status->context, below, h->fs, h->dir, h->polygon_nr);
+ edgestyle_t*fs = status->windrule->diff(&above, &below);
+ if(fs) {