[Bf-blender-cvs] [837c4c5] master: Cleanup: const args for curve handle calculation
Campbell Barton
noreply at git.blender.org
Thu Feb 25 01:11:54 CET 2016
Commit: 837c4c5d476911e3d6b114aa587cb84a1e15e02a
Author: Campbell Barton
Date: Thu Feb 25 11:02:46 2016 +1100
Branches: master
https://developer.blender.org/rB837c4c5d476911e3d6b114aa587cb84a1e15e02a
Cleanup: const args for curve handle calculation
===================================================================
M source/blender/blenkernel/intern/colortools.c
M source/blender/blenkernel/intern/curve.c
===================================================================
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 32fb6af..bac59c8 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -412,13 +412,16 @@ void curvemap_sethandle(CurveMap *cuma, int type)
/**
* reduced copy of #calchandleNurb_intern code in curve.c
*/
-static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *next, int UNUSED(mode))
+static void calchandle_curvemap(
+ BezTriple *bezt, const BezTriple *prev, const BezTriple *next)
{
/* defines to avoid confusion */
#define p2_h1 ((p2) - 3)
#define p2_h2 ((p2) + 3)
- float *p1, *p2, *p3, pt[3];
+ const float *p1, *p3;
+ float *p2;
+ float pt[3];
float len, len_a, len_b;
float dvec_a[2], dvec_b[2];
@@ -546,13 +549,11 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr)
bezt[a].h1 = bezt[a].h2 = HD_AUTO;
}
+ const BezTriple *bezt_prev = NULL;
for (a = 0; a < cuma->totpoint; a++) {
- if (a == 0)
- calchandle_curvemap(bezt, NULL, bezt + 1, 0);
- else if (a == cuma->totpoint - 1)
- calchandle_curvemap(bezt + a, bezt + a - 1, NULL, 0);
- else
- calchandle_curvemap(bezt + a, bezt + a - 1, bezt + a + 1, 0);
+ const BezTriple *bezt_next = (a != cuma->totpoint - 1) ? &bezt[a + 1] : NULL;
+ calchandle_curvemap(&bezt[a], bezt_prev, bezt_next);
+ bezt_prev = &bezt[a];
}
/* first and last handle need correction, instead of pointing to center of next/prev,
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 79199f8..3329d3a 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -3120,14 +3120,17 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render)
/* ****************** HANDLES ************** */
-static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *next,
- bool is_fcurve, bool skip_align)
+static void calchandleNurb_intern(
+ BezTriple *bezt, const BezTriple *prev, const BezTriple *next,
+ bool is_fcurve, bool skip_align)
{
/* defines to avoid confusion */
#define p2_h1 ((p2) - 3)
#define p2_h2 ((p2) + 3)
- float *p1, *p2, *p3, pt[3];
+ const float *p1, *p3;
+ float *p2;
+ float pt[3];
float dvec_a[3], dvec_b[3];
float len, len_a, len_b;
float len_ratio;
More information about the Bf-blender-cvs
mailing list