bugfixes and speedups
[swftools.git] / lib / gfxpoly / xrow.h
1 #ifndef __xrow_h__
2 #define __xrow_h__
3
4 #include <stdint.h>
5
6 #include "poly.h"
7
8 typedef struct _xrow {
9     int32_t*x;
10     int num;
11     int size;
12     int32_t lastx;
13 } xrow_t;
14
15 xrow_t* xrow_new();
16
17 /* so the idea is this:
18    Before processing any events for a given y, store the list+tree of the current active
19    list (that might be useful anyway for adding xrow points to segments).
20    Then, for every starting segment and for every segment that receives a point, add a (x,segment)
21    tuple to a list which we later sort.
22    These segments will at that point have their *old* fill styles set.
23    Then, order that list, and also merge identical x values using left<->right comparisons on
24    the *old* active list, so that for every x coordinate we have the rightmost (old) segment. (For
25    small active lists, it might be faster to just mark the segments (and store the x in them), and
26    then walk the active list from left to right, collecting marked segments)
27    This list now gives us the information about what the fill areas look like above the scanline and to
28    the right of segments which received a point.
29    Now, apply fill style changes and resort the list, this time using the *new* active
30    list for merging identical x values. That gives us the information on what fill areas look like
31    *below* the scanline and to the right of segments which received a point.
32    Every time an "above" fillstyle differs from a "below" fillstyle, we need to draw a horizontal
33    line (from right to left, using the below fillstyle).
34 */
35
36 void xrow_add(xrow_t*xrow, int32_t x);
37
38 void xrow_sort(xrow_t*xrow);
39 void xrow_dump(xrow_t*xrow);
40 void xrow_reset(xrow_t*xrow);
41 void xrow_destroy(xrow_t*xrow);
42
43 #endif