3 edgestyle_t edgestyle_default
;
5 windstate_t windstate_nonfilled
= {
10 // -------------------- even/odd ----------------------
12 windstate_t
evenodd_start(windcontext_t
*context
)
14 return windstate_nonfilled
;
16 windstate_t
evenodd_add(windcontext_t
*context
, windstate_t left
, edgestyle_t
*edge
, segment_dir_t dir
, int master
)
22 edgestyle_t
* evenodd_diff(windstate_t
*left
, windstate_t
*right
)
24 if(left
->is_filled
==right
->is_filled
)
27 return &edgestyle_default
;
30 windrule_t windrule_evenodd
= {
36 // -------------------- circular ----------------------
38 windstate_t
circular_start(windcontext_t
*context
)
40 return windstate_nonfilled
;
43 windstate_t
circular_add(windcontext_t
*context
, windstate_t left
, edgestyle_t
*edge
, segment_dir_t dir
, int master
)
46 /* which one is + and which one - doesn't actually make any difference */
52 left
.is_filled
= left
.wind_nr
!= 0;
56 edgestyle_t
* circular_diff(windstate_t
*left
, windstate_t
*right
)
58 if(left
->is_filled
==right
->is_filled
)
61 return &edgestyle_default
;
64 windrule_t windrule_circular
= {
65 start
: circular_start
,
70 // -------------------- intersect ----------------------
72 windstate_t
intersect_start(windcontext_t
*context
)
74 return windstate_nonfilled
;
77 windstate_t
intersect_add(windcontext_t
*context
, windstate_t left
, edgestyle_t
*edge
, segment_dir_t dir
, int master
)
79 assert(master
< context
->num_polygons
);
81 left
.wind_nr
^= 1<<master
;
82 left
.is_filled
= (left
.wind_nr
== (1<<context
->num_polygons
)-1);
86 edgestyle_t
* intersect_diff(windstate_t
*left
, windstate_t
*right
)
88 if(left
->is_filled
==right
->is_filled
)
91 return &edgestyle_default
;
94 windrule_t windrule_intersect
= {
95 start
: intersect_start
,
100 // -------------------- union ----------------------
102 windstate_t
union_start(windcontext_t
*context
)
104 return windstate_nonfilled
;
107 windstate_t
union_add(windcontext_t
*context
, windstate_t left
, edgestyle_t
*edge
, segment_dir_t dir
, int master
)
109 assert(master
<sizeof(left
.wind_nr
)*8); //up to 32/64 polygons max
110 left
.wind_nr
^= 1<<master
;
111 left
.is_filled
= (left
.wind_nr
!=0);
115 edgestyle_t
* union_diff(windstate_t
*left
, windstate_t
*right
)
117 if(left
->is_filled
==right
->is_filled
)
120 return &edgestyle_default
;
123 windrule_t windrule_union
= {
131 } else if (rule == WIND_NONZERO) {
133 } else if (rule == WIND_ODDEVEN) {
135 } else { // rule == WIND_POSITIVE