Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-02-25 03:02:46 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-02-25 03:02:46 +0300
commit837c4c5d476911e3d6b114aa587cb84a1e15e02a (patch)
tree58cc75095b1968b0b56a798124cc49caebb7f898
parent20b4477cff689e0218398d5d6556ca25021ed1fa (diff)
Cleanup: const args for curve handle calculation
-rw-r--r--source/blender/blenkernel/intern/colortools.c17
-rw-r--r--source/blender/blenkernel/intern/curve.c9
2 files changed, 15 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 32fb6af01b9..bac59c8c62d 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 79199f86fa9..3329d3a25ee 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;