Commit 4a2830e4 authored by dickelbeck's avatar dickelbeck

compiler warning

parent 4b94704e
...@@ -68,7 +68,7 @@ Copyright: (C) Advanced Interfaces Group, ...@@ -68,7 +68,7 @@ Copyright: (C) Advanced Interfaces Group,
/* /*
=========================================================================== ===========================================================================
Macros Macros
=========================================================================== ===========================================================================
*/ */
...@@ -234,7 +234,7 @@ typedef struct bbox_shape /* Contour axis-aligned bounding box */ ...@@ -234,7 +234,7 @@ typedef struct bbox_shape /* Contour axis-aligned bounding box */
const h_state next_h_state[3][6]= const h_state next_h_state[3][6]=
{ {
/* ABOVE BELOW CROSS */ /* ABOVE BELOW CROSS */
/* L R L R L R */ /* L R L R L R */
/* NH */ {BH, TH, TH, BH, NH, NH}, /* NH */ {BH, TH, TH, BH, NH, NH},
/* BH */ {NH, NH, NH, NH, TH, TH}, /* BH */ {NH, NH, NH, NH, TH, TH},
/* TH */ {NH, NH, NH, NH, BH, BH} /* TH */ {NH, NH, NH, NH, BH, BH}
...@@ -671,7 +671,7 @@ static void add_st_edge(st_node **st, it_node **it, edge_node *edge, ...@@ -671,7 +671,7 @@ static void add_st_edge(st_node **st, it_node **it, edge_node *edge,
den= ((*st)->xt - (*st)->xb) - (edge->xt - edge->xb); den= ((*st)->xt - (*st)->xb) - (edge->xt - edge->xb);
/* If new edge and ST edge don't cross */ /* If new edge and ST edge don't cross */
if ((edge->xt >= (*st)->xt) || (edge->dx == (*st)->dx) || if ((edge->xt >= (*st)->xt) || (edge->dx == (*st)->dx) ||
(fabs(den) <= DBL_EPSILON)) (fabs(den) <= DBL_EPSILON))
{ {
/* No intersection - insert edge here (before the ST edge) */ /* No intersection - insert edge here (before the ST edge) */
...@@ -791,7 +791,7 @@ static void merge_left(polygon_node *p, polygon_node *q, polygon_node *list) ...@@ -791,7 +791,7 @@ static void merge_left(polygon_node *p, polygon_node *q, polygon_node *list)
q->proxy->v[LEFT]= p->proxy->v[LEFT]; q->proxy->v[LEFT]= p->proxy->v[LEFT];
/* Redirect any p->proxy references to q->proxy */ /* Redirect any p->proxy references to q->proxy */
for (target= p->proxy; list; list= list->next) for (target= p->proxy; list; list= list->next)
{ {
if (list->proxy == target) if (list->proxy == target)
...@@ -914,7 +914,7 @@ static void new_tristrip(polygon_node **tn, edge_node *edge, ...@@ -914,7 +914,7 @@ static void new_tristrip(polygon_node **tn, edge_node *edge,
(*tn)->v[LEFT]= NULL; (*tn)->v[LEFT]= NULL;
(*tn)->v[RIGHT]= NULL; (*tn)->v[RIGHT]= NULL;
(*tn)->active= 1; (*tn)->active= 1;
add_vertex(&((*tn)->v[LEFT]), x, y); add_vertex(&((*tn)->v[LEFT]), x, y);
edge->outp[ABOVE]= *tn; edge->outp[ABOVE]= *tn;
} }
else else
...@@ -952,7 +952,7 @@ static bbox *create_contour_bboxes(gpc_polygon *p) ...@@ -952,7 +952,7 @@ static bbox *create_contour_bboxes(gpc_polygon *p)
box[c].ymax= p->contour[c].vertex[v].y; box[c].ymax= p->contour[c].vertex[v].y;
} }
} }
return box; return box;
} }
...@@ -986,10 +986,10 @@ static void minimax_test(gpc_polygon *subj, gpc_polygon *clip, gpc_op op) ...@@ -986,10 +986,10 @@ static void minimax_test(gpc_polygon *subj, gpc_polygon *clip, gpc_op op)
if (!overlap) if (!overlap)
/* Flag non contributing status by negating vertex count */ /* Flag non contributing status by negating vertex count */
clip->contour[c].num_vertices = -clip->contour[c].num_vertices; clip->contour[c].num_vertices = -clip->contour[c].num_vertices;
} }
if (op == GPC_INT) if (op == GPC_INT)
{ {
/* For each subject contour, search for any clip contour overlaps */ /* For each subject contour, search for any clip contour overlaps */
for (s= 0; s < subj->num_contours; s++) for (s= 0; s < subj->num_contours; s++)
{ {
...@@ -1000,7 +1000,7 @@ static void minimax_test(gpc_polygon *subj, gpc_polygon *clip, gpc_op op) ...@@ -1000,7 +1000,7 @@ static void minimax_test(gpc_polygon *subj, gpc_polygon *clip, gpc_op op)
if (!overlap) if (!overlap)
/* Flag non contributing status by negating vertex count */ /* Flag non contributing status by negating vertex count */
subj->contour[s].num_vertices = -subj->contour[s].num_vertices; subj->contour[s].num_vertices = -subj->contour[s].num_vertices;
} }
} }
FREE(s_bbox); FREE(s_bbox);
...@@ -1065,7 +1065,7 @@ void gpc_write_polygon(FILE *fp, int write_hole_flags, gpc_polygon *p) ...@@ -1065,7 +1065,7 @@ void gpc_write_polygon(FILE *fp, int write_hole_flags, gpc_polygon *p)
if (write_hole_flags) if (write_hole_flags)
fprintf(fp, "%d\n", p->hole[c]); fprintf(fp, "%d\n", p->hole[c]);
for (v= 0; v < p->contour[c].num_vertices; v++) for (v= 0; v < p->contour[c].num_vertices; v++)
fprintf(fp, "% .*lf % .*lf\n", fprintf(fp, "% .*lf % .*lf\n",
DBL_DIG, p->contour[c].vertex[v].x, DBL_DIG, p->contour[c].vertex[v].x,
...@@ -1234,11 +1234,11 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1234,11 +1234,11 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
if (next_edge->bundle[ABOVE][next_edge->type]) if (next_edge->bundle[ABOVE][next_edge->type])
{ {
if (EQ(e0->xb, next_edge->xb) && EQ(e0->dx, next_edge->dx) if (EQ(e0->xb, next_edge->xb) && EQ(e0->dx, next_edge->dx)
&& (e0->top.y != yb)) && (e0->top.y != yb))
{ {
next_edge->bundle[ABOVE][ next_edge->type]^= next_edge->bundle[ABOVE][ next_edge->type]^=
e0->bundle[ABOVE][ next_edge->type]; e0->bundle[ABOVE][ next_edge->type];
next_edge->bundle[ABOVE][!next_edge->type]= next_edge->bundle[ABOVE][!next_edge->type]=
e0->bundle[ABOVE][!next_edge->type]; e0->bundle[ABOVE][!next_edge->type];
next_edge->bstate[ABOVE]= BUNDLE_HEAD; next_edge->bstate[ABOVE]= BUNDLE_HEAD;
e0->bundle[ABOVE][CLIP]= FALSE; e0->bundle[ABOVE][CLIP]= FALSE;
...@@ -1248,16 +1248,16 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1248,16 +1248,16 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
e0= next_edge; e0= next_edge;
} }
} }
horiz[CLIP]= NH; horiz[CLIP]= NH;
horiz[SUBJ]= NH; horiz[SUBJ]= NH;
/* Process each edge at this scanbeam boundary */ /* Process each edge at this scanbeam boundary */
for (edge= aet; edge; edge= edge->next) for (edge= aet; edge; edge= edge->next)
{ {
exists[CLIP]= edge->bundle[ABOVE][CLIP] + exists[CLIP]= edge->bundle[ABOVE][CLIP] +
(edge->bundle[BELOW][CLIP] << 1); (edge->bundle[BELOW][CLIP] << 1);
exists[SUBJ]= edge->bundle[ABOVE][SUBJ] + exists[SUBJ]= edge->bundle[ABOVE][SUBJ] +
(edge->bundle[BELOW][SUBJ] << 1); (edge->bundle[BELOW][SUBJ] << 1);
if (exists[CLIP] || exists[SUBJ]) if (exists[CLIP] || exists[SUBJ])
...@@ -1281,7 +1281,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1281,7 +1281,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
&& (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); && (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]);
tr= (parity[CLIP] ^ (horiz[CLIP]!=NH)) tr= (parity[CLIP] ^ (horiz[CLIP]!=NH))
&& (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); && (parity[SUBJ] ^ (horiz[SUBJ]!=NH));
tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP])
&& (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); && (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]);
break; break;
case GPC_XOR: case GPC_XOR:
...@@ -1292,7 +1292,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1292,7 +1292,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
^ (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); ^ (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]);
tr= (parity[CLIP] ^ (horiz[CLIP]!=NH)) tr= (parity[CLIP] ^ (horiz[CLIP]!=NH))
^ (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); ^ (parity[SUBJ] ^ (horiz[SUBJ]!=NH));
tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP])
^ (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); ^ (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]);
break; break;
case GPC_UNION: case GPC_UNION:
...@@ -1306,7 +1306,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1306,7 +1306,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
|| (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); || (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]);
tr= (parity[CLIP] ^ (horiz[CLIP]!=NH)) tr= (parity[CLIP] ^ (horiz[CLIP]!=NH))
|| (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); || (parity[SUBJ] ^ (horiz[SUBJ]!=NH));
tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP])
|| (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); || (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]);
break; break;
} }
...@@ -1316,11 +1316,11 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1316,11 +1316,11 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
parity[SUBJ]^= edge->bundle[ABOVE][SUBJ]; parity[SUBJ]^= edge->bundle[ABOVE][SUBJ];
/* Update horizontal state */ /* Update horizontal state */
if (exists[CLIP]) if (exists[CLIP])
horiz[CLIP]= horiz[CLIP]=
next_h_state[horiz[CLIP]] next_h_state[horiz[CLIP]]
[((exists[CLIP] - 1) << 1) + parity[CLIP]]; [((exists[CLIP] - 1) << 1) + parity[CLIP]];
if (exists[SUBJ]) if (exists[SUBJ])
horiz[SUBJ]= horiz[SUBJ]=
next_h_state[horiz[SUBJ]] next_h_state[horiz[SUBJ]]
[((exists[SUBJ] - 1) << 1) + parity[SUBJ]]; [((exists[SUBJ] - 1) << 1) + parity[SUBJ]];
...@@ -1389,10 +1389,10 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1389,10 +1389,10 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
break; break;
case IMM: case IMM:
if (xb != px) if (xb != px)
{ {
add_right(cf, xb, yb); add_right(cf, xb, yb);
px= xb; px= xb;
} }
merge_left(cf, edge->outp[BELOW], out_poly); merge_left(cf, edge->outp[BELOW], out_poly);
edge->outp[BELOW]= NULL; edge->outp[BELOW]= NULL;
add_local_min(&out_poly, edge, xb, yb); add_local_min(&out_poly, edge, xb, yb);
...@@ -1400,10 +1400,10 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1400,10 +1400,10 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
break; break;
case EMM: case EMM:
if (xb != px) if (xb != px)
{ {
add_left(cf, xb, yb); add_left(cf, xb, yb);
px= xb; px= xb;
} }
merge_right(cf, edge->outp[BELOW], out_poly); merge_right(cf, edge->outp[BELOW], out_poly);
edge->outp[BELOW]= NULL; edge->outp[BELOW]= NULL;
add_local_min(&out_poly, edge, xb, yb); add_local_min(&out_poly, edge, xb, yb);
...@@ -1444,7 +1444,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1444,7 +1444,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
/* Copy bundle head state to the adjacent tail edge if required */ /* Copy bundle head state to the adjacent tail edge if required */
if ((edge->bstate[BELOW] == BUNDLE_HEAD) && prev_edge) if ((edge->bstate[BELOW] == BUNDLE_HEAD) && prev_edge)
{ {
if (prev_edge->bstate[BELOW] == BUNDLE_TAIL) if (prev_edge->bstate[BELOW] == BUNDLE_TAIL)
{ {
prev_edge->outp[BELOW]= edge->outp[BELOW]; prev_edge->outp[BELOW]= edge->outp[BELOW];
...@@ -1452,8 +1452,8 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1452,8 +1452,8 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
if (prev_edge->prev) if (prev_edge->prev)
if (prev_edge->prev->bstate[BELOW] == BUNDLE_TAIL) if (prev_edge->prev->bstate[BELOW] == BUNDLE_TAIL)
prev_edge->bstate[BELOW]= BUNDLE_HEAD; prev_edge->bstate[BELOW]= BUNDLE_HEAD;
} }
} }
} }
else else
{ {
...@@ -1479,12 +1479,12 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1479,12 +1479,12 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
/* Only generate output for contributing intersections */ /* Only generate output for contributing intersections */
if ((e0->bundle[ABOVE][CLIP] || e0->bundle[ABOVE][SUBJ]) if ((e0->bundle[ABOVE][CLIP] || e0->bundle[ABOVE][SUBJ])
&& (e1->bundle[ABOVE][CLIP] || e1->bundle[ABOVE][SUBJ])) && (e1->bundle[ABOVE][CLIP] || e1->bundle[ABOVE][SUBJ]))
{ {
p= e0->outp[ABOVE]; p= e0->outp[ABOVE];
q= e1->outp[ABOVE]; q= e1->outp[ABOVE];
ix= intersect->point.x; ix= intersect->point.x;
iy= intersect->point.y + yb; iy= intersect->point.y + yb;
in[CLIP]= ( e0->bundle[ABOVE][CLIP] && !e0->bside[CLIP]) in[CLIP]= ( e0->bundle[ABOVE][CLIP] && !e0->bside[CLIP])
|| ( e1->bundle[ABOVE][CLIP] && e1->bside[CLIP]) || ( e1->bundle[ABOVE][CLIP] && e1->bside[CLIP])
|| (!e0->bundle[ABOVE][CLIP] && !e1->bundle[ABOVE][CLIP] || (!e0->bundle[ABOVE][CLIP] && !e1->bundle[ABOVE][CLIP]
...@@ -1493,7 +1493,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1493,7 +1493,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
|| ( e1->bundle[ABOVE][SUBJ] && e1->bside[SUBJ]) || ( e1->bundle[ABOVE][SUBJ] && e1->bside[SUBJ])
|| (!e0->bundle[ABOVE][SUBJ] && !e1->bundle[ABOVE][SUBJ] || (!e0->bundle[ABOVE][SUBJ] && !e1->bundle[ABOVE][SUBJ]
&& e0->bside[SUBJ] && e1->bside[SUBJ]); && e0->bside[SUBJ] && e1->bside[SUBJ]);
/* Determine quadrant occupancies */ /* Determine quadrant occupancies */
switch (op) switch (op)
{ {
...@@ -1529,7 +1529,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1529,7 +1529,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
|| (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ] ^ e0->bundle[ABOVE][SUBJ]); || (in[SUBJ] ^ e1->bundle[ABOVE][SUBJ] ^ e0->bundle[ABOVE][SUBJ]);
break; break;
} }
vclass= tr + (tl << 1) + (br << 2) + (bl << 3); vclass= tr + (tl << 1) + (br << 2) + (bl << 3);
switch (vclass) switch (vclass)
...@@ -1613,17 +1613,17 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1613,17 +1613,17 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
default: default:
break; break;
} /* End of switch */ } /* End of switch */
} /* End of contributing intersection conditional */ } /* End of contributing intersection conditional */
/* Swap bundle sides in response to edge crossing */ /* Swap bundle sides in response to edge crossing */
if (e0->bundle[ABOVE][CLIP]) if (e0->bundle[ABOVE][CLIP])
e1->bside[CLIP]= !e1->bside[CLIP]; e1->bside[CLIP]= !e1->bside[CLIP];
if (e1->bundle[ABOVE][CLIP]) if (e1->bundle[ABOVE][CLIP])
e0->bside[CLIP]= !e0->bside[CLIP]; e0->bside[CLIP]= !e0->bside[CLIP];
if (e0->bundle[ABOVE][SUBJ]) if (e0->bundle[ABOVE][SUBJ])
e1->bside[SUBJ]= !e1->bside[SUBJ]; e1->bside[SUBJ]= !e1->bside[SUBJ];
if (e1->bundle[ABOVE][SUBJ]) if (e1->bundle[ABOVE][SUBJ])
e0->bside[SUBJ]= !e0->bside[SUBJ]; e0->bside[SUBJ]= !e0->bside[SUBJ];
/* Swap e0 and e1 bundles in the AET */ /* Swap e0 and e1 bundles in the AET */
prev_edge= e0->prev; prev_edge= e0->prev;
...@@ -1694,7 +1694,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1694,7 +1694,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
edge->bundle[BELOW][CLIP]= edge->bundle[ABOVE][CLIP]; edge->bundle[BELOW][CLIP]= edge->bundle[ABOVE][CLIP];
edge->bundle[BELOW][SUBJ]= edge->bundle[ABOVE][SUBJ]; edge->bundle[BELOW][SUBJ]= edge->bundle[ABOVE][SUBJ];
edge->xb= edge->xt; edge->xb= edge->xt;
} }
edge->outp[ABOVE]= NULL; edge->outp[ABOVE]= NULL;
} }
} }
...@@ -1722,7 +1722,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1722,7 +1722,7 @@ void gpc_polygon_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
MALLOC(result->contour[c].vertex, MALLOC(result->contour[c].vertex,
result->contour[c].num_vertices * sizeof(gpc_vertex), result->contour[c].num_vertices * sizeof(gpc_vertex),
"vertex creation", gpc_vertex); "vertex creation", gpc_vertex);
v= result->contour[c].num_vertices - 1; v= result->contour[c].num_vertices - 1;
for (vtx= poly->proxy->v[LEFT]; vtx; vtx= nv) for (vtx= poly->proxy->v[LEFT]; vtx; vtx= nv)
{ {
...@@ -1788,7 +1788,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1788,7 +1788,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
polygon_node *tlist= NULL, *tn, *tnn, *p, *q; polygon_node *tlist= NULL, *tn, *tnn, *p, *q;
vertex_node *lt, *ltn, *rt, *rtn; vertex_node *lt, *ltn, *rt, *rtn;
h_state horiz[2]; h_state horiz[2];
vertex_type cft; vertex_type cft = vertex_type(-1);
int in[2], exists[2], parity[2]= {LEFT, LEFT}; int in[2], exists[2], parity[2]= {LEFT, LEFT};
int s, v, contributing, search, scanbeam= 0, sbt_entries= 0; int s, v, contributing, search, scanbeam= 0, sbt_entries= 0;
int vclass, bl, br, tl, tr; int vclass, bl, br, tl, tr;
...@@ -1891,12 +1891,12 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1891,12 +1891,12 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
if (next_edge->bundle[ABOVE][next_edge->type]) if (next_edge->bundle[ABOVE][next_edge->type])
{ {
if (EQ(e0->xb, next_edge->xb) && EQ(e0->dx, next_edge->dx) if (EQ(e0->xb, next_edge->xb) && EQ(e0->dx, next_edge->dx)
&& (e0->top.y != yb)) && (e0->top.y != yb))
{ {
next_edge->bundle[ABOVE][ next_edge->type]^= next_edge->bundle[ABOVE][ next_edge->type]^=
e0->bundle[ABOVE][ next_edge->type]; e0->bundle[ABOVE][ next_edge->type];
next_edge->bundle[ABOVE][!next_edge->type]= next_edge->bundle[ABOVE][!next_edge->type]=
e0->bundle[ABOVE][!next_edge->type]; e0->bundle[ABOVE][!next_edge->type];
next_edge->bstate[ABOVE]= BUNDLE_HEAD; next_edge->bstate[ABOVE]= BUNDLE_HEAD;
e0->bundle[ABOVE][CLIP]= FALSE; e0->bundle[ABOVE][CLIP]= FALSE;
e0->bundle[ABOVE][SUBJ]= FALSE; e0->bundle[ABOVE][SUBJ]= FALSE;
...@@ -1912,9 +1912,9 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1912,9 +1912,9 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
/* Process each edge at this scanbeam boundary */ /* Process each edge at this scanbeam boundary */
for (edge= aet; edge; edge= edge->next) for (edge= aet; edge; edge= edge->next)
{ {
exists[CLIP]= edge->bundle[ABOVE][CLIP] + exists[CLIP]= edge->bundle[ABOVE][CLIP] +
(edge->bundle[BELOW][CLIP] << 1); (edge->bundle[BELOW][CLIP] << 1);
exists[SUBJ]= edge->bundle[ABOVE][SUBJ] + exists[SUBJ]= edge->bundle[ABOVE][SUBJ] +
(edge->bundle[BELOW][SUBJ] << 1); (edge->bundle[BELOW][SUBJ] << 1);
if (exists[CLIP] || exists[SUBJ]) if (exists[CLIP] || exists[SUBJ])
...@@ -1938,7 +1938,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1938,7 +1938,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
&& (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]); && (parity[SUBJ] ^ edge->bundle[ABOVE][SUBJ]);
tr= (parity[CLIP] ^ (horiz[CLIP]!=NH)) tr= (parity[CLIP] ^ (horiz[CLIP]!=NH))
&& (parity[SUBJ] ^ (horiz[SUBJ]!=NH)); && (parity[SUBJ] ^ (horiz[SUBJ]!=NH));
tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP]) tl= (parity[CLIP] ^ (horiz[CLIP]!=NH) ^ edge->bundle[BELOW][CLIP])
&& (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]); && (parity[SUBJ] ^ (horiz[SUBJ]!=NH) ^ edge->bundle[BELOW][SUBJ]);
break; break;
case GPC_XOR: case GPC_XOR:
...@@ -1973,15 +1973,15 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -1973,15 +1973,15 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
parity[SUBJ]^= edge->bundle[ABOVE][SUBJ]; parity[SUBJ]^= edge->bundle[ABOVE][SUBJ];
/* Update horizontal state */ /* Update horizontal state */
if (exists[CLIP]) if (exists[CLIP])
horiz[CLIP]= horiz[CLIP]=
next_h_state[horiz[CLIP]] next_h_state[horiz[CLIP]]
[((exists[CLIP] - 1) << 1) + parity[CLIP]]; [((exists[CLIP] - 1) << 1) + parity[CLIP]];
if (exists[SUBJ]) if (exists[SUBJ])
horiz[SUBJ]= horiz[SUBJ]=
next_h_state[horiz[SUBJ]] next_h_state[horiz[SUBJ]]
[((exists[SUBJ] - 1) << 1) + parity[SUBJ]]; [((exists[SUBJ] - 1) << 1) + parity[SUBJ]];
vclass= tr + (tl << 1) + (br << 2) + (bl << 3); vclass= tr + (tl << 1) + (br << 2) + (bl << 3);
if (contributing) if (contributing)
...@@ -2013,11 +2013,11 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -2013,11 +2013,11 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
break; break;
case IMN: case IMN:
if (cft == LED) if (cft == LED)
{ {
if (cf->bot.y != yb) if (cf->bot.y != yb)
VERTEX(cf, BELOW, LEFT, cf->xb, yb); VERTEX(cf, BELOW, LEFT, cf->xb, yb);
new_tristrip(&tlist, cf, cf->xb, yb); new_tristrip(&tlist, cf, cf->xb, yb);
} }
edge->outp[ABOVE]= cf->outp[ABOVE]; edge->outp[ABOVE]= cf->outp[ABOVE];
VERTEX(edge, ABOVE, RIGHT, xb, yb); VERTEX(edge, ABOVE, RIGHT, xb, yb);
break; break;
...@@ -2028,11 +2028,11 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -2028,11 +2028,11 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
break; break;
case IRI: case IRI:
if (cft == LED) if (cft == LED)
{ {
if (cf->bot.y != yb) if (cf->bot.y != yb)
VERTEX(cf, BELOW, LEFT, cf->xb, yb); VERTEX(cf, BELOW, LEFT, cf->xb, yb);
new_tristrip(&tlist, cf, cf->xb, yb); new_tristrip(&tlist, cf, cf->xb, yb);
} }
VERTEX(edge, BELOW, RIGHT, xb, yb); VERTEX(edge, BELOW, RIGHT, xb, yb);
edge->outp[ABOVE]= NULL; edge->outp[ABOVE]= NULL;
break; break;
...@@ -2041,7 +2041,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -2041,7 +2041,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
edge->outp[ABOVE]= NULL; edge->outp[ABOVE]= NULL;
cft= IMX; cft= IMX;
break; break;
case IMM: case IMM:
VERTEX(edge, BELOW, LEFT, xb, yb); VERTEX(edge, BELOW, LEFT, xb, yb);
edge->outp[ABOVE]= cf->outp[ABOVE]; edge->outp[ABOVE]= cf->outp[ABOVE];
if (xb != cf->xb) if (xb != cf->xb)
...@@ -2064,25 +2064,25 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -2064,25 +2064,25 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
case RED: case RED:
edge->outp[ABOVE]= cf->outp[ABOVE]; edge->outp[ABOVE]= cf->outp[ABOVE];
if (cft == LED) if (cft == LED)
{ {
if (cf->bot.y == yb) if (cf->bot.y == yb)
{ {
VERTEX(edge, BELOW, RIGHT, xb, yb); VERTEX(edge, BELOW, RIGHT, xb, yb);
} }
else else
{ {
if (edge->bot.y == yb) if (edge->bot.y == yb)
{ {
VERTEX(cf, BELOW, LEFT, cf->xb, yb); VERTEX(cf, BELOW, LEFT, cf->xb, yb);
VERTEX(edge, BELOW, RIGHT, xb, yb); VERTEX(edge, BELOW, RIGHT, xb, yb);
} }
} }
} }
else else
{ {
VERTEX(edge, BELOW, RIGHT, xb, yb); VERTEX(edge, BELOW, RIGHT, xb, yb);
VERTEX(edge, ABOVE, RIGHT, xb, yb); VERTEX(edge, ABOVE, RIGHT, xb, yb);
} }
cf= NULL; cf= NULL;
break; break;
default: default:
...@@ -2108,7 +2108,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -2108,7 +2108,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
/* Copy bundle head state to the adjacent tail edge if required */ /* Copy bundle head state to the adjacent tail edge if required */
if ((edge->bstate[BELOW] == BUNDLE_HEAD) && prev_edge) if ((edge->bstate[BELOW] == BUNDLE_HEAD) && prev_edge)
{ {
if (prev_edge->bstate[BELOW] == BUNDLE_TAIL) if (prev_edge->bstate[BELOW] == BUNDLE_TAIL)
{ {
prev_edge->outp[BELOW]= edge->outp[BELOW]; prev_edge->outp[BELOW]= edge->outp[BELOW];
...@@ -2116,8 +2116,8 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -2116,8 +2116,8 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
if (prev_edge->prev) if (prev_edge->prev)
if (prev_edge->prev->bstate[BELOW] == BUNDLE_TAIL) if (prev_edge->prev->bstate[BELOW] == BUNDLE_TAIL)
prev_edge->bstate[BELOW]= BUNDLE_HEAD; prev_edge->bstate[BELOW]= BUNDLE_HEAD;
} }
} }
} }
else else
{ {
...@@ -2131,7 +2131,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -2131,7 +2131,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
if (scanbeam < sbt_entries) if (scanbeam < sbt_entries)
{ {
/* === SCANBEAM INTERIOR PROCESSING ============================== */ /* === SCANBEAM INTERIOR PROCESSING ============================== */
build_intersection_table(&it, aet, dy); build_intersection_table(&it, aet, dy);
/* Process each node in the intersection table */ /* Process each node in the intersection table */
...@@ -2143,7 +2143,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -2143,7 +2143,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
/* Only generate output for contributing intersections */ /* Only generate output for contributing intersections */
if ((e0->bundle[ABOVE][CLIP] || e0->bundle[ABOVE][SUBJ]) if ((e0->bundle[ABOVE][CLIP] || e0->bundle[ABOVE][SUBJ])
&& (e1->bundle[ABOVE][CLIP] || e1->bundle[ABOVE][SUBJ])) && (e1->bundle[ABOVE][CLIP] || e1->bundle[ABOVE][SUBJ]))
{ {
p= e0->outp[ABOVE]; p= e0->outp[ABOVE];
q= e1->outp[ABOVE]; q= e1->outp[ABOVE];
ix= intersect->point.x; ix= intersect->point.x;
...@@ -2235,7 +2235,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -2235,7 +2235,7 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
VERTEX(prev_edge, ABOVE, LEFT, px, iy); VERTEX(prev_edge, ABOVE, LEFT, px, iy);
N_EDGE(next_edge, e1, ABOVE, nx, iy); N_EDGE(next_edge, e1, ABOVE, nx, iy);
VERTEX(next_edge, ABOVE, RIGHT, nx, iy); VERTEX(next_edge, ABOVE, RIGHT, nx, iy);
new_tristrip(&tlist, prev_edge, px, iy); new_tristrip(&tlist, prev_edge, px, iy);
e1->outp[ABOVE]= prev_edge->outp[ABOVE]; e1->outp[ABOVE]= prev_edge->outp[ABOVE];
VERTEX(e1, ABOVE, RIGHT, ix, iy); VERTEX(e1, ABOVE, RIGHT, ix, iy);
new_tristrip(&tlist, e0, ix, iy); new_tristrip(&tlist, e0, ix, iy);
...@@ -2306,17 +2306,17 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip, ...@@ -2306,17 +2306,17 @@ void gpc_tristrip_clip(gpc_op op, gpc_polygon *subj, gpc_polygon *clip,
default: default:
break; break;
} /* End of switch */ } /* End of switch */
} /* End of contributing intersection conditional */ } /* End of contributing intersection conditional */
/* Swap bundle sides in response to edge crossing */ /* Swap bundle sides in response to edge crossing */
if (e0->bundle[ABOVE][CLIP]) if (e0->bundle[ABOVE][CLIP])
e1->bside[CLIP]= !e1->bside[CLIP]; e1->bside[CLIP]= !e1->bside[CLIP];
if (e1->bundle[ABOVE][CLIP]) if (e1->bundle[ABOVE][CLIP])
e0->bside[CLIP]= !e0->bside[CLIP]; e0->bside[CLIP]= !e0->bside[CLIP];
if (e0->bundle[ABOVE][SUBJ]) if (e0->bundle[ABOVE][SUBJ])
e1->bside[SUBJ]= !e1->bside[SUBJ]; e1->bside[SUBJ]= !e1->bside[SUBJ];
if (e1->bundle[ABOVE][SUBJ]) if (e1->bundle[ABOVE][SUBJ])
e0->bside[SUBJ]= !e0->bside[SUBJ]; e0->bside[SUBJ]= !e0->bside[SUBJ];
/* Swap e0 and e1 bundles in the AET */ /* Swap e0 and e1 bundles in the AET */
prev_edge= e0->prev; prev_edge= e0->prev;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment