4 #ifndef tools_zb_polygon
5 #define tools_zb_polygon
15 static const int NUMPTSTOBUFFER = 200;
17 typedef struct _POINTBLOCK {
18 point pts[NUMPTSTOBUFFER];
19 struct _POINTBLOCK* next;
24 int m_numAllocPtBlocks;
25 POINTBLOCK m_FirstPtBlock;
27 polygon():m_pETEn(0),m_pETEs(NULL),m_numAllocPtBlocks(0){}
34 POINTBLOCK* curPtBlock;
37 for(curPtBlock = m_FirstPtBlock.next; --m_numAllocPtBlocks >= 0;){
38 POINTBLOCK* tmpPtBlock;
39 tmpPtBlock = curPtBlock->next;
41 curPtBlock = tmpPtBlock;
43 m_numAllocPtBlocks = 0;
68 POINTBLOCK* curPtBlock;
69 int numFullPtBlocks = 0;
71 if(a_proc==NULL)
return;
77 ((Count == 5) && (pts[4].x == pts[0].x) && (pts[4].y == pts[0].y))) &&
78 (((pts[0].
y == pts[1].
y) &&
79 (pts[1].x == pts[2].x) &&
80 (pts[2].
y == pts[3].
y) &&
81 (pts[3].x == pts[0].x)) ||
82 ((pts[0].x == pts[1].x) &&
83 (pts[1].
y == pts[2].
y) &&
84 (pts[2].x == pts[3].x) &&
85 (pts[3].
y == pts[0].
y))))
87 int xmin,xmax,ymin,ymax;
88 xmin = (int)
mn(pts[0].x, pts[2].x);
89 ymin = (int)
mn(pts[0].y, pts[2].y);
90 xmax = (int)
mx(pts[0].x, pts[2].x);
91 ymax = (int)
mx(pts[0].y, pts[2].y);
92 if ((xmin != xmax) && (ymin != ymax))
94 for(y=ymin;y<=ymax;y++) a_proc(a_tag,xmin ,xmax ,y);
103 m_pETEs = cmem_alloc<EdgeTableEntry>(m_pETEn);
115 curPtBlock = &m_FirstPtBlock;
116 pts = m_FirstPtBlock.pts;
124 for (y = ET.
ymin; y < ET.
ymax; y++) {
129 if (pSLL != NULL && y == pSLL->
scanline)
149 if (iPts == NUMPTSTOBUFFER)
151 if(numFullPtBlocks < m_numAllocPtBlocks)
153 curPtBlock = curPtBlock->next;
157 POINTBLOCK* tmpPtBlock = cmem_alloc<POINTBLOCK>(1);
163 tmpPtBlock->next = NULL;
164 curPtBlock->next = tmpPtBlock;
165 curPtBlock = tmpPtBlock;
166 m_numAllocPtBlocks++;
169 pts = curPtBlock->pts;
183 for (y = ET.
ymin; y < ET.
ymax; y++) {
188 if (pSLL != NULL && y == pSLL->
scanline)
215 if (iPts == NUMPTSTOBUFFER)
217 if(numFullPtBlocks < m_numAllocPtBlocks)
219 curPtBlock = curPtBlock->next;
223 POINTBLOCK* tmpPtBlock = cmem_alloc<POINTBLOCK>(1);
229 tmpPtBlock->next = NULL;
230 curPtBlock->next = tmpPtBlock;
231 curPtBlock = tmpPtBlock;
232 m_numAllocPtBlocks++;
235 pts = curPtBlock->pts;
256 ScanPoints (numFullPtBlocks, iPts, &m_FirstPtBlock,a_proc,a_tag);
262 POINTBLOCK* FirstPtBlock,
265 POINTBLOCK* CurPtBlock;
267 CurPtBlock = FirstPtBlock;
268 for ( ; numFullPtBlocks >= 0; numFullPtBlocks--)
271 i = numFullPtBlocks!=0 ? NUMPTSTOBUFFER >> 1 : iCurPtBlock >> 1 ;
272 for (pts = CurPtBlock->pts; i--; pts += 2)
274 a_proc (a_tag,(
int)(pts->
x),(
int)pts[1].
x,(
int)pts->y);
276 CurPtBlock = CurPtBlock->next;