diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-16 14:43:18 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-16 14:43:18 +0400 |
commit | b214ea3aa402fe8d377de38276a068456a5c5223 (patch) | |
tree | f49f05b9fe46ad503baa15098ef70cf9f93e4035 /source/blender/freestyle | |
parent | 66181332814f3128254622eada820a42a968c10b (diff) |
svn merge ^/trunk/blender -c56620 -c56639 -c56643 -c56647 -c56648 -c56650 -c56651 -c56653 -c56654 -c56661 -c56662 -c56663 -c56668 -c56670 -c56671 -c56672 -c56673 -c56674 -c56676 -c56678 -c56679 -c56680 -c56682 -c56688 -c56689 -c56698 -c56700 -c56707 -c56711 -c56735 -c56745 -c56747 -c56748 -c56749 -c56755 -c56756 -c56759 -c56760 -c56763 -c56766 -c56767 -c56773 -c56778 -c56783 -c56784 -c56785 -c56790 -c56791 -c56793 -c56800 -c56806 -c56807 -c56809 -c56815 -c56816 -c56820
Diffstat (limited to 'source/blender/freestyle')
11 files changed, 33 insertions, 18 deletions
diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index 7303ccc95f3..436cdbfe6b5 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -165,6 +165,11 @@ Controller::~Controller() _inter = NULL; } + if (_ProgressBar) { + delete _ProgressBar; + _ProgressBar = NULL; + } + //delete _current_dirs; } diff --git a/source/blender/freestyle/intern/geometry/Bezier.cpp b/source/blender/freestyle/intern/geometry/Bezier.cpp index e69830f3529..b9099df9a68 100644 --- a/source/blender/freestyle/intern/geometry/Bezier.cpp +++ b/source/blender/freestyle/intern/geometry/Bezier.cpp @@ -106,6 +106,11 @@ BezierCurve::BezierCurve(vector<Vec2d>& iPoints, double error) BezierCurve::~BezierCurve() { + if (!_Segments.empty()) { + vector<BezierCurveSegment*>::iterator v, vend; + for (v = _Segments.begin(), vend = _Segments.end(); v != vend; ++v) + delete *v; + } if (_currentSegment) delete _currentSegment; } diff --git a/source/blender/freestyle/intern/geometry/FitCurve.cpp b/source/blender/freestyle/intern/geometry/FitCurve.cpp index c043f2cb0b9..cc21ba05f3d 100644 --- a/source/blender/freestyle/intern/geometry/FitCurve.cpp +++ b/source/blender/freestyle/intern/geometry/FitCurve.cpp @@ -487,6 +487,8 @@ void FitCurveWrapper::FitCurve(vector<Vec2d>& data, vector<Vec2d>& oCurve, doubl FitCurve(d, size, error); + delete[] d; + // copy results for (vector<Vector2>::iterator v = _vertices.begin(), vend = _vertices.end(); v != vend; ++v) { oCurve.push_back(Vec2d(v->x(), v->y())) ; diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp index c684eaf483e..3b1232c51af 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.cpp +++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp @@ -704,7 +704,7 @@ int float_array_from_PyObject(PyObject *obj, float *v, int n) return float_array_from_PyList(obj, v, n); } else if (PyTuple_Check(obj) && PyTuple_Size(obj) == n) { - return float_array_from_PyList(obj, v, n); + return float_array_from_PyTuple(obj, v, n); } return 0; } diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp index c0372a10aef..e17f16a2fa7 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp @@ -526,12 +526,12 @@ static PyObject *StrokeAttribute_color_get(BPy_StrokeAttribute *self, void *UNUS static int StrokeAttribute_color_set(BPy_StrokeAttribute *self, PyObject *value, void *UNUSED(closure)) { - Vec3f *v = Vec3f_ptr_from_PyObject(value); - if (!v) { + float v[3]; + if (!float_array_from_PyObject(value, v, 3)) { PyErr_SetString(PyExc_ValueError, "value must be a 3-dimensional vector"); return -1; } - self->sa->setColor(v->x(), v->y(), v->z()); + self->sa->setColor(v[0], v[1], v[2]); return 0; } @@ -550,12 +550,12 @@ static PyObject *StrokeAttribute_thickness_get(BPy_StrokeAttribute *self, void * static int StrokeAttribute_thickness_set(BPy_StrokeAttribute *self, PyObject *value, void *UNUSED(closure)) { - Vec2f *v = Vec2f_ptr_from_PyObject(value); - if (!v) { + float v[2]; + if (!float_array_from_PyObject(value, v, 2)) { PyErr_SetString(PyExc_ValueError, "value must be a 2-dimensional vector"); return -1; } - self->sa->setThickness(v->x(), v->y()); + self->sa->setThickness(v[0], v[1]); return 0; } diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp index 1279d1824fb..2215bd9df02 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp @@ -214,6 +214,13 @@ Smoother::Smoother(Stroke &ioStroke) _safeTest = (_nbVertices > 4); } +Smoother::~Smoother() +{ + delete[] _vertex; + delete[] _curvature; + delete[] _normal; +} + void Smoother::smooth(int nbIteration, real iFactorPoint, real ifactorCurvature, real iFactorCurvatureDifference, real iAnisoPoint, real iAnisoNormal, real iAnisoCurvature, real iCarricatureFactor) { diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h index bd2b28059d8..18472ff2c2a 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h +++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h @@ -154,7 +154,7 @@ class LIB_STROKE_EXPORT Smoother public: Smoother(Stroke &ioStroke); - virtual ~Smoother() {} + virtual ~Smoother(); void smooth(int nbIterations, real iFactorPoint, real ifactorCurvature, real iFactorCurvatureDifference, real iAnisoPoint, real iAnisoNormal, real iAnisoCurvature, real icarricatureFactor); diff --git a/source/blender/freestyle/intern/system/PseudoNoise.cpp b/source/blender/freestyle/intern/system/PseudoNoise.cpp index 77b7c565279..b70564d147c 100644 --- a/source/blender/freestyle/intern/system/PseudoNoise.cpp +++ b/source/blender/freestyle/intern/system/PseudoNoise.cpp @@ -32,15 +32,12 @@ namespace Freestyle { -static const unsigned NB_VALUE_NOISE = 512; - -real *PseudoNoise::_values; +real PseudoNoise::_values[]; PseudoNoise::PseudoNoise() {} void PseudoNoise::init(long seed) { - _values = new real[NB_VALUE_NOISE]; RandGen::srand48(seed); for (unsigned int i = 0; i < NB_VALUE_NOISE; i++) _values[i] = -1.0 + 2.0 * RandGen::drand48(); diff --git a/source/blender/freestyle/intern/system/PseudoNoise.h b/source/blender/freestyle/intern/system/PseudoNoise.h index b190e8c8568..e98556026d0 100644 --- a/source/blender/freestyle/intern/system/PseudoNoise.h +++ b/source/blender/freestyle/intern/system/PseudoNoise.h @@ -49,7 +49,8 @@ public: static void init(long seed); protected: - static real *_values; + static const unsigned NB_VALUE_NOISE = 512; + static real _values[NB_VALUE_NOISE]; }; } /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/system/TimeStamp.cpp b/source/blender/freestyle/intern/system/TimeStamp.cpp index dc4e717486d..7c02095ad51 100644 --- a/source/blender/freestyle/intern/system/TimeStamp.cpp +++ b/source/blender/freestyle/intern/system/TimeStamp.cpp @@ -30,6 +30,6 @@ namespace Freestyle { LIB_SYSTEM_EXPORT -TimeStamp *TimeStamp::_instance = 0; +TimeStamp TimeStamp::_instance; } /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/system/TimeStamp.h b/source/blender/freestyle/intern/system/TimeStamp.h index 2ebfb359dd5..6322ab3fd65 100644 --- a/source/blender/freestyle/intern/system/TimeStamp.h +++ b/source/blender/freestyle/intern/system/TimeStamp.h @@ -37,9 +37,7 @@ class LIB_SYSTEM_EXPORT TimeStamp public: static inline TimeStamp *instance() { - if (_instance == NULL) - _instance = new TimeStamp; - return _instance; + return &_instance; } inline unsigned getTimeStamp() const @@ -66,7 +64,7 @@ protected: TimeStamp(const TimeStamp&) {} private: - static TimeStamp *_instance; + static TimeStamp _instance; unsigned _time_stamp; }; |