diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-04-19 19:51:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-04-19 20:01:13 +0300 |
commit | 43a273616b1965dd6a6e1466f28cfb999b2744e3 (patch) | |
tree | ddf7c33ca6dae32ff8e39b3ca105d4f176a728dc /source/blender/editors/space_view3d/drawobject.c | |
parent | e28a92bacb94aaa011cd99f6709c63037f2d008f (diff) |
No need for while-loop counting curve-normals
Diffstat (limited to 'source/blender/editors/space_view3d/drawobject.c')
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 2c02de222d2..b80167ce676 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -7345,14 +7345,20 @@ static void draw_editnurb( glLineWidth(1.0f); int count = 0; + int count_used = 0; for (bl = ob->curve_cache->bev.first, nu = nurb; nu && bl; bl = bl->next, nu = nu->next) { int nr = bl->nr; int skip = nu->resolu / 16; - + +#if 0 while (nr-- > 0) { /* accounts for empty bevel lists */ count += 4; nr -= skip; } +#else + /* Same as loop above */ + count += 4 * max_ii((nr + max_ii(skip - 1, 0)) / (skip + 1), 0); +#endif } if (count > 2) { @@ -7361,7 +7367,7 @@ static void draw_editnurb( BevPoint *bevp = bl->bevpoints; int nr = bl->nr; int skip = nu->resolu / 16; - + while (nr-- > 0) { /* accounts for empty bevel lists */ const float fac = bevp->radius * ts->normalsize; float vec_a[3]; /* Offset perpendicular to the curve */ @@ -7390,8 +7396,12 @@ static void draw_editnurb( bevp += skip + 1; nr -= skip; + count_used += 4; } } + BLI_assert(count == count_used); + UNUSED_VARS_NDEBUG(count_used); + immEnd(); } immUnbindProgram(); |