未验证 提交 f5de7144 编写于 作者: Z zcx 提交者: GitHub

Merge pull request #20987 from zcx-xxx:master

* Update drawing.cpp

optimize FillEdgeCollection function

* Update drawing.cpp

optimize FillEdgeCollection,remove sort_flag
上级 091461ce
......@@ -1369,7 +1369,6 @@ FillEdgeCollection( Mat& img, std::vector<PolyEdge>& edges, const void* color )
for( y = e->y0; y < y_max; y++ )
{
PolyEdge *last, *prelast, *keep_prelast;
int sort_flag = 0;
int draw = 0;
int clipline = y < 0;
......@@ -1444,6 +1443,7 @@ FillEdgeCollection( Mat& img, std::vector<PolyEdge>& edges, const void* color )
{
prelast = &tmp;
last = tmp.next;
PolyEdge *last_exchange = 0;
while( last != keep_prelast && last->next != 0 )
{
......@@ -1456,7 +1456,7 @@ FillEdgeCollection( Mat& img, std::vector<PolyEdge>& edges, const void* color )
last->next = te->next;
te->next = last;
prelast = te;
sort_flag = 1;
last_exchange = prelast;
}
else
{
......@@ -1464,9 +1464,10 @@ FillEdgeCollection( Mat& img, std::vector<PolyEdge>& edges, const void* color )
last = te;
}
}
keep_prelast = prelast;
}
while( sort_flag && keep_prelast != tmp.next && keep_prelast != &tmp );
if (last_exchange == NULL)
break;
keep_prelast = last_exchange;
} while( keep_prelast != tmp.next && keep_prelast != &tmp );
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册