diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-02-04 22:00:17 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-02-04 22:27:01 +0400 |
commit | db749684023176d00d7b1bdfe7f56527b72549e3 (patch) | |
tree | 8d09328065c9ba78f6f348c1a0ebebcc77bc7ad4 /source/blender/blenlib/intern/scanfill.c | |
parent | f18d8a5a6604c37848b7cb263c718b7140a2f55b (diff) |
Scanfill: minor optimization, comment unused code, avoid vert loop
Diffstat (limited to 'source/blender/blenlib/intern/scanfill.c')
-rw-r--r-- | source/blender/blenlib/intern/scanfill.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index b12e982c708..bbd15e16328 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -382,7 +382,6 @@ static void testvertexnearedge(ScanFillContext *sf_ctx) ed1 = BLI_scanfill_edge_add(sf_ctx, eed->v1, eve); /* printf("fill: vertex near edge %x\n", eve); */ - ed1->f = 0; ed1->poly_nr = eed->poly_nr; eed->v1 = eve; eve->edge_tot = 3; @@ -773,7 +772,6 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const ScanFillEdge *eed, *eed_next; PolyFill *pflist, *pf; float *min_xy_p, *max_xy_p; - unsigned int totverts = 0, toggle = 0; unsigned int totfaces = 0; /* total faces added */ unsigned short a, c, poly = 0; bool ok; @@ -781,16 +779,20 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const BLI_assert(!nor_proj || len_squared_v3(nor_proj) > FLT_EPSILON); +#ifdef DEBUG for (eve = sf_ctx->fillvertbase.first; eve; eve = eve->next) { /* these values used to be set, * however they should always be zero'd so check instead */ BLI_assert(eve->f == 0); BLI_assert(eve->poly_nr == 0); BLI_assert(eve->edge_tot == 0); - totverts++; } +#endif +#if 0 if (flag & BLI_SCANFILL_CALC_QUADTRI_FASTPATH) { + const int totverts = BLI_countlist(&sf_ctx->fillvertbase); + if (totverts == 3) { eve = sf_ctx->fillvertbase.first; @@ -817,6 +819,7 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const return 2; } } +#endif /* first test vertices if they are in edges */ /* including resetting of flags */ @@ -826,15 +829,13 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const eed->v2->f = SF_VERT_AVAILABLE; } - ok = false; for (eve = sf_ctx->fillvertbase.first; eve; eve = eve->next) { if (eve->f & SF_VERT_AVAILABLE) { - ok = true; break; } } - if (UNLIKELY(ok == false)) { + if (UNLIKELY(eve == NULL)) { return 0; } else { @@ -877,6 +878,7 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const /* get first vertex with no poly number */ if (eve->poly_nr == 0) { + unsigned int toggle = 0; poly++; /* now a sort of select connected */ ok = true; @@ -928,6 +930,7 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const /* STEP 2: remove loose edges and strings of edges */ if (flag & BLI_SCANFILL_CALC_LOOSE) { + unsigned int toggle = 0; for (eed = sf_ctx->filledgebase.first; eed; eed = eed->next) { if (eed->v1->edge_tot++ > 250) break; if (eed->v2->edge_tot++ > 250) break; |