コード例 #1
0
ファイル: draw_edge.c プロジェクト: DeepGopani/mupdf
static void
insert_active(fz_gel *gel, int y, int *e)
{
	/* insert edges that start here */
	while (*e < gel->len && gel->edges[*e].y == y) {
		if (gel->alen + 1 == gel->acap) {
			int newcap = gel->acap + 64;
			fz_edge **newactive = fz_realloc(gel->ctx, gel->active, newcap * sizeof(fz_edge*));
			gel->active = newactive;
			gel->acap = newcap;
		}
		gel->active[gel->alen++] = &gel->edges[(*e)++];
	}

	/* shell-sort the edges by increasing x */
	sort_active(gel->active, gel->alen);
}
コード例 #2
0
ファイル: draw-edge.c プロジェクト: HCLAC/mupdf
static int
insert_active(fz_context *ctx, fz_gel *gel, int y, int *e_)
{
	int h_min = INT_MAX;
	int e = *e_;

	/* insert edges that start here */
	if (e < gel->len && gel->edges[e].y == y)
	{
		do {
			if (gel->alen + 1 == gel->acap) {
				int newcap = gel->acap + 64;
				fz_edge **newactive = fz_resize_array(ctx, gel->active, newcap, sizeof(fz_edge*));
				gel->active = newactive;
				gel->acap = newcap;
			}
			gel->active[gel->alen++] = &gel->edges[e++];
		} while (e < gel->len && gel->edges[e].y == y);
		*e_ = e;
	}

	if (e < gel->len)
		h_min = gel->edges[e].y - y;

	for (e=0; e < gel->alen; e++)
	{
		if (gel->active[e]->xmove != 0 || gel->active[e]->adj_up != 0)
		{
			h_min = 1;
			break;
		}
		if (gel->active[e]->h < h_min)
		{
			h_min = gel->active[e]->h;
			if (h_min == 1)
				break;
		}
	}

	/* shell-sort the edges by increasing x */
	sort_active(gel->active, gel->alen);

	return h_min;
}