From 98c574e41a8c2cd9ecb0d25afef8578c3e79289b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 11 Aug 2013 05:40:35 +0000 Subject: use 'greater/less then or equal to' operators rather then adding 1. --- source/blender/freestyle/intern/geometry/FitCurve.cpp | 2 +- source/blender/freestyle/intern/stroke/StrokeRep.cpp | 8 ++++---- source/blender/freestyle/intern/view_map/SteerableViewMap.cpp | 2 +- source/blender/freestyle/intern/view_map/ViewMapIO.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'source/blender/freestyle') diff --git a/source/blender/freestyle/intern/geometry/FitCurve.cpp b/source/blender/freestyle/intern/geometry/FitCurve.cpp index a5701ea05e5..e517bf4f196 100644 --- a/source/blender/freestyle/intern/geometry/FitCurve.cpp +++ b/source/blender/freestyle/intern/geometry/FitCurve.cpp @@ -478,7 +478,7 @@ FitCurveWrapper::~FitCurveWrapper() void FitCurveWrapper::DrawBezierCurve(int n, Vector2 *curve) { - for (int i = 0; i < n + 1; ++i) + for (int i = 0; i <= n; ++i) _vertices.push_back(curve[i]); } diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.cpp b/source/blender/freestyle/intern/stroke/StrokeRep.cpp index c2811895147..2615df0a124 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRep.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeRep.cpp @@ -414,10 +414,10 @@ void Strip::cleanUpSingularities (const vector& iStrokeVertices) cerr << "Stephane dit \"Toto\"" << endl; //traverse all the vertices of the singularity and average them Vec2r avP(0.0, 0.0); - for (j = i - timeSinceSingu1; j < i + 1; j++) + for (j = i - timeSinceSingu1; j <= i; j++) avP = Vec2r(avP + _vertices[2 * j]->point2d()); avP = Vec2r( 1.0 / float(timeSinceSingu1 + 1) * avP); - for (j = i - timeSinceSingu1; j < i + 1; j++) + for (j = i - timeSinceSingu1; j <= i; j++) _vertices[2 * j]->setPoint2d(avP); //_vertex[2 * j] = _vertex[2 * i]; singu1 = false; @@ -435,10 +435,10 @@ void Strip::cleanUpSingularities (const vector& iStrokeVertices) cerr << "Stephane dit \"Toto\"" << endl; //traverse all the vertices of the singularity and average them Vec2r avP(0.0, 0.0); - for (j = i - timeSinceSingu2; j < i + 1; j++) + for (j = i - timeSinceSingu2; j <= i; j++) avP = Vec2r(avP + _vertices[2 * j + 1]->point2d()); avP = Vec2r(1.0 / float(timeSinceSingu2 + 1) * avP); - for (j = i - timeSinceSingu2; j < i + 1; j++) + for (j = i - timeSinceSingu2; j <= i; j++) _vertices[2 * j + 1]->setPoint2d(avP); //_vertex[2 * j + 1] = _vertex[2 * i + 1]; singu2 = false; diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp index 7693afdce07..c777db6249f 100644 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp @@ -74,7 +74,7 @@ SteerableViewMap::SteerableViewMap(const SteerableViewMap& iBrother) _directions = iBrother._directions; _mapping = iBrother._mapping; _imagesPyramids = new ImagePyramid *[_nbOrientations + 1]; // one more map to store the complete visible VM - for (i = 0; i < _nbOrientations + 1; ++i) + for (i = 0; i <= _nbOrientations; ++i) _imagesPyramids[i] = new GaussianPyramid(*(dynamic_cast(iBrother._imagesPyramids[i]))); } diff --git a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp index 5df3e4e0d8f..e78fb894be0 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp @@ -982,7 +982,7 @@ int load(istream& in, ViewMap *vm, ProgressBar *pb) if (fe_s) { bool b; READ(b); - for (READ(fe_rle1), fe_rle2 = 0; fe_rle1 < fe_s + 1; fe_rle2 = fe_rle1, READ(fe_rle1)) { + for (READ(fe_rle1), fe_rle2 = 0; fe_rle1 <= fe_s; fe_rle2 = fe_rle1, READ(fe_rle1)) { if (b) { for (unsigned int i = fe_rle2; i < fe_rle1; i++) { FEdgeSmooth *fes = new FEdgeSmooth; @@ -1007,7 +1007,7 @@ int load(istream& in, ViewMap *vm, ProgressBar *pb) if (vv_s) { Nature::VertexNature nature; READ(nature); - for (READ(vv_rle1), vv_rle2 = 0; vv_rle1 < vv_s + 1; vv_rle2 = vv_rle1, READ(vv_rle1)) { + for (READ(vv_rle1), vv_rle2 = 0; vv_rle1 <= vv_s; vv_rle2 = vv_rle1, READ(vv_rle1)) { if (nature & Nature::T_VERTEX) { for (unsigned int i = vv_rle2; i < vv_rle1; i++) { TVertex *tv = new TVertex(); -- cgit v1.2.3