diff options
Diffstat (limited to 'source/blender/blenlib/intern/scanfill.c')
-rw-r--r-- | source/blender/blenlib/intern/scanfill.c | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 92fd7f5937b..4145125c1d7 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -33,9 +33,9 @@ /* local types */ typedef struct PolyFill { - unsigned int edges, verts; + uint edges, verts; float min_xy[2], max_xy[2]; - unsigned short nr; + ushort nr; bool f; } PolyFill; @@ -44,7 +44,7 @@ typedef struct ScanFillVertLink { ScanFillEdge *edge_first, *edge_last; } ScanFillVertLink; -/* local funcs */ +/* Local functions. */ #define SF_EPSILON 0.00003f #define SF_EPSILON_SQ (SF_EPSILON * SF_EPSILON) @@ -304,9 +304,7 @@ static bool addedgetoscanvert(ScanFillVertLink *sc, ScanFillEdge *eed) return true; } -static ScanFillVertLink *addedgetoscanlist(ScanFillVertLink *scdata, - ScanFillEdge *eed, - unsigned int len) +static ScanFillVertLink *addedgetoscanlist(ScanFillVertLink *scdata, ScanFillEdge *eed, uint len) { /* inserts edge at correct location in ScanFillVertLink list */ /* returns sc when edge already exists */ @@ -428,10 +426,7 @@ static void testvertexnearedge(ScanFillContext *sf_ctx) } } -static void splitlist(ScanFillContext *sf_ctx, - ListBase *tempve, - ListBase *temped, - unsigned short nr) +static void splitlist(ScanFillContext *sf_ctx, ListBase *tempve, ListBase *temped, ushort nr) { /* Everything is in temp-list, write only poly nr to fill-list. */ ScanFillVert *eve, *eve_next; @@ -457,14 +452,14 @@ static void splitlist(ScanFillContext *sf_ctx, } } -static unsigned int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag) +static uint scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int flag) { ScanFillVertLink *scdata; ScanFillVertLink *sc = NULL, *sc1; ScanFillVert *eve, *v1, *v2, *v3; ScanFillEdge *eed, *eed_next, *ed1, *ed2, *ed3; - unsigned int a, b, verts, maxface, totface; - const unsigned short nr = pf->nr; + uint a, b, verts, maxface, totface; + const ushort nr = pf->nr; bool twoconnected = false; /* PRINTS */ @@ -810,7 +805,7 @@ void BLI_scanfill_end_arena(ScanFillContext *sf_ctx, MemArena *arena) BLI_listbase_clear(&sf_ctx->fillfacebase); } -unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float nor_proj[3]) +uint BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float nor_proj[3]) { /* * - fill works with its own lists, so create that first (no faces!) @@ -825,8 +820,8 @@ 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 totfaces = 0; /* total faces added */ - unsigned short a, c, poly = 0; + uint totfaces = 0; /* total faces added */ + ushort a, c, poly = 0; bool ok; float mat_2d[3][3]; @@ -895,7 +890,7 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const /* STEP 1: COUNT POLYS */ if (sf_ctx->poly_nr != SF_POLY_UNSET) { - poly = (unsigned short)(sf_ctx->poly_nr + 1); + poly = (ushort)(sf_ctx->poly_nr + 1); sf_ctx->poly_nr = SF_POLY_UNSET; } @@ -905,7 +900,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 == SF_POLY_UNSET) { - unsigned int toggle = 0; + uint toggle = 0; /* now a sort of select connected */ ok = true; eve->poly_nr = poly; @@ -962,7 +957,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; + uint toggle = 0; for (eed = sf_ctx->filledgebase.first; eed; eed = eed->next) { if (eed->v1->edge_count++ > 250) { break; @@ -1069,7 +1064,7 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const * WATCH IT: ONLY WORKS WITH SORTED POLYS!!! */ if ((flag & BLI_SCANFILL_CALC_HOLES) && (poly > 1)) { - unsigned short *polycache, *pc; + ushort *polycache, *pc; /* so, sort first */ qsort(pflist, (size_t)poly, sizeof(PolyFill), vergpoly); @@ -1086,7 +1081,7 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const polycache = pc = MEM_callocN(sizeof(*polycache) * (size_t)poly, "polycache"); pf = pflist; for (a = 0; a < poly; a++, pf++) { - for (c = (unsigned short)(a + 1); c < poly; c++) { + for (c = (ushort)(a + 1); c < poly; c++) { /* if 'a' inside 'c': join (bbox too) * Careful: 'a' can also be inside another poly. @@ -1142,7 +1137,7 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const return totfaces; } -unsigned int BLI_scanfill_calc(ScanFillContext *sf_ctx, const int flag) +uint BLI_scanfill_calc(ScanFillContext *sf_ctx, const int flag) { return BLI_scanfill_calc_ex(sf_ctx, flag, NULL); } |