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>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/freestyle/intern/system
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/freestyle/intern/system')
-rw-r--r--source/blender/freestyle/intern/system/BaseIterator.h95
-rw-r--r--source/blender/freestyle/intern/system/BaseObject.h65
-rw-r--r--source/blender/freestyle/intern/system/Cast.h18
-rw-r--r--source/blender/freestyle/intern/system/Exception.h53
-rw-r--r--source/blender/freestyle/intern/system/FreestyleConfig.h14
-rw-r--r--source/blender/freestyle/intern/system/Id.h195
-rw-r--r--source/blender/freestyle/intern/system/Interpreter.h39
-rw-r--r--source/blender/freestyle/intern/system/Iterator.h63
-rw-r--r--source/blender/freestyle/intern/system/PointerSequence.h42
-rw-r--r--source/blender/freestyle/intern/system/Precision.h6
-rw-r--r--source/blender/freestyle/intern/system/ProgressBar.h111
-rw-r--r--source/blender/freestyle/intern/system/PseudoNoise.cpp112
-rw-r--r--source/blender/freestyle/intern/system/PseudoNoise.h33
-rw-r--r--source/blender/freestyle/intern/system/PythonInterpreter.h157
-rw-r--r--source/blender/freestyle/intern/system/RandGen.cpp132
-rw-r--r--source/blender/freestyle/intern/system/RandGen.h19
-rw-r--r--source/blender/freestyle/intern/system/RenderMonitor.h61
-rw-r--r--source/blender/freestyle/intern/system/StringUtils.cpp40
-rw-r--r--source/blender/freestyle/intern/system/StringUtils.h17
-rw-r--r--source/blender/freestyle/intern/system/TimeStamp.h63
-rw-r--r--source/blender/freestyle/intern/system/TimeUtils.h43
21 files changed, 688 insertions, 690 deletions
diff --git a/source/blender/freestyle/intern/system/BaseIterator.h b/source/blender/freestyle/intern/system/BaseIterator.h
index b01fac96267..3826a129a1c 100644
--- a/source/blender/freestyle/intern/system/BaseIterator.h
+++ b/source/blender/freestyle/intern/system/BaseIterator.h
@@ -25,88 +25,83 @@
#include <iterator>
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
namespace Freestyle {
// use for iterators defintions
-template <class Element>
-class Nonconst_traits;
-
-template <class Element>
-class Const_traits
-{
-public:
- typedef Element value_type;
- typedef const Element& reference;
- typedef const Element *pointer;
- typedef ptrdiff_t difference_type;
- typedef Nonconst_traits<Element> Non_const_traits;
+template<class Element> class Nonconst_traits;
+
+template<class Element> class Const_traits {
+ public:
+ typedef Element value_type;
+ typedef const Element &reference;
+ typedef const Element *pointer;
+ typedef ptrdiff_t difference_type;
+ typedef Nonconst_traits<Element> Non_const_traits;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Const_traits")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Const_traits")
#endif
};
-template <class Element>
-class Nonconst_traits
-{
-public:
- typedef Element value_type;
- typedef Element& reference;
- typedef Element *pointer;
- typedef ptrdiff_t difference_type;
- typedef Nonconst_traits<Element> Non_const_traits;
+template<class Element> class Nonconst_traits {
+ public:
+ typedef Element value_type;
+ typedef Element &reference;
+ typedef Element *pointer;
+ typedef ptrdiff_t difference_type;
+ typedef Nonconst_traits<Element> Non_const_traits;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Nonconst_traits")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Nonconst_traits")
#endif
};
-class InputIteratorTag_Traits
-{
-public:
- typedef std::input_iterator_tag iterator_category;
+class InputIteratorTag_Traits {
+ public:
+ typedef std::input_iterator_tag iterator_category;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:InputIteratorTag_Traits")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:InputIteratorTag_Traits")
#endif
};
-class BidirectionalIteratorTag_Traits
-{
-public:
- typedef std::bidirectional_iterator_tag iterator_category;
+class BidirectionalIteratorTag_Traits {
+ public:
+ typedef std::bidirectional_iterator_tag iterator_category;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BidirectionalIteratorTag_Traits")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BidirectionalIteratorTag_Traits")
#endif
};
-template<class Traits, class IteratorTagTraits>
-class IteratorBase
-{
-public:
- virtual ~IteratorBase() {}
+template<class Traits, class IteratorTagTraits> class IteratorBase {
+ public:
+ virtual ~IteratorBase()
+ {
+ }
- virtual bool begin() const = 0;
- virtual bool end() const = 0;
+ virtual bool begin() const = 0;
+ virtual bool end() const = 0;
- typedef typename IteratorTagTraits::iterator_category iterator_category;
- typedef typename Traits::value_type value_type;
- typedef typename Traits::difference_type difference_type;
- typedef typename Traits::pointer pointer;
- typedef typename Traits::reference reference;
+ typedef typename IteratorTagTraits::iterator_category iterator_category;
+ typedef typename Traits::value_type value_type;
+ typedef typename Traits::difference_type difference_type;
+ typedef typename Traits::pointer pointer;
+ typedef typename Traits::reference reference;
-protected:
- IteratorBase() {}
+ protected:
+ IteratorBase()
+ {
+ }
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:IteratorBase")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:IteratorBase")
#endif
};
} /* namespace Freestyle */
-#endif // BASEITERATOR_H
+#endif // BASEITERATOR_H
diff --git a/source/blender/freestyle/intern/system/BaseObject.h b/source/blender/freestyle/intern/system/BaseObject.h
index 01099c7724a..d64c47b2445 100644
--- a/source/blender/freestyle/intern/system/BaseObject.h
+++ b/source/blender/freestyle/intern/system/BaseObject.h
@@ -24,51 +24,52 @@
*/
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
namespace Freestyle {
-class BaseObject
-{
-public:
- inline BaseObject()
- {
- _ref_counter = 0;
- }
+class BaseObject {
+ public:
+ inline BaseObject()
+ {
+ _ref_counter = 0;
+ }
- virtual ~BaseObject() {}
+ virtual ~BaseObject()
+ {
+ }
- /*! At least makes a release on this.
- * The BaseObject::destroy method must be explicitly called at the end of any overloaded destroy
- */
- virtual int destroy()
- {
- return release();
- }
+ /*! At least makes a release on this.
+ * The BaseObject::destroy method must be explicitly called at the end of any overloaded destroy
+ */
+ virtual int destroy()
+ {
+ return release();
+ }
- /*! Increments the reference counter */
- inline int addRef()
- {
- return ++_ref_counter;
- }
+ /*! Increments the reference counter */
+ inline int addRef()
+ {
+ return ++_ref_counter;
+ }
- /*! Decrements the reference counter */
- inline int release()
- {
- if (_ref_counter)
- _ref_counter--;
- return _ref_counter;
- }
+ /*! Decrements the reference counter */
+ inline int release()
+ {
+ if (_ref_counter)
+ _ref_counter--;
+ return _ref_counter;
+ }
-private:
- unsigned _ref_counter;
+ private:
+ unsigned _ref_counter;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BaseObject")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:BaseObject")
#endif
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_BASE_OBJECT_H__
+#endif // __FREESTYLE_BASE_OBJECT_H__
diff --git a/source/blender/freestyle/intern/system/Cast.h b/source/blender/freestyle/intern/system/Cast.h
index f3efcc462bf..8318633c4b5 100644
--- a/source/blender/freestyle/intern/system/Cast.h
+++ b/source/blender/freestyle/intern/system/Cast.h
@@ -24,17 +24,15 @@
namespace Freestyle {
-namespace Cast
+namespace Cast {
+template<class T, class U> U *cast(T *in)
{
- template <class T, class U>
- U *cast(T *in)
- {
- if (!in)
- return NULL;
- return dynamic_cast<U*>(in);
- }
-} // end of namespace Cast
+ if (!in)
+ return NULL;
+ return dynamic_cast<U *>(in);
+}
+} // end of namespace Cast
} /* namespace Freestyle */
-#endif // __FREESTYLE_CAST_H__
+#endif // __FREESTYLE_CAST_H__
diff --git a/source/blender/freestyle/intern/system/Exception.h b/source/blender/freestyle/intern/system/Exception.h
index f334ca040ef..0efd136af8f 100644
--- a/source/blender/freestyle/intern/system/Exception.h
+++ b/source/blender/freestyle/intern/system/Exception.h
@@ -23,45 +23,44 @@
*/
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
namespace Freestyle {
-class Exception
-{
-public:
- typedef enum {
- NO_EXCEPTION,
- UNDEFINED,
- } exception_type;
+class Exception {
+ public:
+ typedef enum {
+ NO_EXCEPTION,
+ UNDEFINED,
+ } exception_type;
- static int getException()
- {
- exception_type e = _exception;
- _exception = NO_EXCEPTION;
- return e;
- }
+ static int getException()
+ {
+ exception_type e = _exception;
+ _exception = NO_EXCEPTION;
+ return e;
+ }
- static int raiseException(exception_type exception = UNDEFINED)
- {
- _exception = exception;
- return _exception;
- }
+ static int raiseException(exception_type exception = UNDEFINED)
+ {
+ _exception = exception;
+ return _exception;
+ }
- static void reset()
- {
- _exception = NO_EXCEPTION;
- }
+ static void reset()
+ {
+ _exception = NO_EXCEPTION;
+ }
-private:
- static exception_type _exception;
+ private:
+ static exception_type _exception;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Exception")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Exception")
#endif
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_EXCEPTION_H__
+#endif // __FREESTYLE_EXCEPTION_H__
diff --git a/source/blender/freestyle/intern/system/FreestyleConfig.h b/source/blender/freestyle/intern/system/FreestyleConfig.h
index 9603ad8190d..34db7121eaf 100644
--- a/source/blender/freestyle/intern/system/FreestyleConfig.h
+++ b/source/blender/freestyle/intern/system/FreestyleConfig.h
@@ -33,15 +33,15 @@ namespace Config {
// Directory separators
// TODO Use Blender's stuff for such things!
#ifdef WIN32
- static const string DIR_SEP("\\");
- static const string PATH_SEP(";");
+static const string DIR_SEP("\\");
+static const string PATH_SEP(";");
#else
- static const string DIR_SEP("/");
- static const string PATH_SEP(":");
-#endif // WIN32
+static const string DIR_SEP("/");
+static const string PATH_SEP(":");
+#endif // WIN32
-} // end of namespace Config
+} // end of namespace Config
} /* namespace Freestyle */
-#endif // __FREESTYLE_CONFIG_H__
+#endif // __FREESTYLE_CONFIG_H__
diff --git a/source/blender/freestyle/intern/system/Id.h b/source/blender/freestyle/intern/system/Id.h
index 5e8e9ba82bd..9a83ae27767 100644
--- a/source/blender/freestyle/intern/system/Id.h
+++ b/source/blender/freestyle/intern/system/Id.h
@@ -23,7 +23,7 @@
*/
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
namespace Freestyle {
@@ -31,111 +31,110 @@ namespace Freestyle {
/*! Class used to tag any object by an id.
* It is made of two unsigned integers.
*/
-class Id
-{
-public:
- typedef unsigned id_type;
-
- /*! Default constructor */
- Id()
- {
- _first = 0;
- _second = 0;
- }
-
- /*! Builds an Id from an integer.
- * The second number is set to 0.
- */
- Id(id_type id)
- {
- _first = id;
- _second = 0;
- }
-
- /*! Builds the Id from the two numbers */
- Id(id_type ifirst, id_type isecond)
- {
- _first = ifirst;
- _second = isecond;
- }
-
- /*! Copy constructor */
- Id(const Id& iBrother)
- {
- _first = iBrother._first;
- _second = iBrother._second;
- }
-
- /*! Operator= */
- Id& operator=(const Id& iBrother)
- {
- _first = iBrother._first;
- _second = iBrother._second;
- return *this;
- }
-
- /*! Returns the first Id number */
- id_type getFirst() const
- {
- return _first;
- }
-
- /*! Returns the second Id number */
- id_type getSecond() const
- {
- return _second;
- }
-
- /*! Sets the first number constituting the Id */
- void setFirst(id_type first)
- {
- _first = first;
- }
-
- /*! Sets the second number constituting the Id */
- void setSecond(id_type second)
- {
- _second = second;
- }
-
- /*! Operator== */
- bool operator==(const Id& id) const
- {
- return ((_first == id._first) && (_second == id._second));
- }
-
- /*! Operator!= */
- bool operator!=(const Id& id) const
- {
- return !((*this) == id);
- }
-
- /*! Operator< */
- bool operator<(const Id& id) const
- {
- if (_first < id._first)
- return true;
- if (_first == id._first && _second < id._second)
- return true;
- return false;
- }
-
-private:
- id_type _first;
- id_type _second;
+class Id {
+ public:
+ typedef unsigned id_type;
+
+ /*! Default constructor */
+ Id()
+ {
+ _first = 0;
+ _second = 0;
+ }
+
+ /*! Builds an Id from an integer.
+ * The second number is set to 0.
+ */
+ Id(id_type id)
+ {
+ _first = id;
+ _second = 0;
+ }
+
+ /*! Builds the Id from the two numbers */
+ Id(id_type ifirst, id_type isecond)
+ {
+ _first = ifirst;
+ _second = isecond;
+ }
+
+ /*! Copy constructor */
+ Id(const Id &iBrother)
+ {
+ _first = iBrother._first;
+ _second = iBrother._second;
+ }
+
+ /*! Operator= */
+ Id &operator=(const Id &iBrother)
+ {
+ _first = iBrother._first;
+ _second = iBrother._second;
+ return *this;
+ }
+
+ /*! Returns the first Id number */
+ id_type getFirst() const
+ {
+ return _first;
+ }
+
+ /*! Returns the second Id number */
+ id_type getSecond() const
+ {
+ return _second;
+ }
+
+ /*! Sets the first number constituting the Id */
+ void setFirst(id_type first)
+ {
+ _first = first;
+ }
+
+ /*! Sets the second number constituting the Id */
+ void setSecond(id_type second)
+ {
+ _second = second;
+ }
+
+ /*! Operator== */
+ bool operator==(const Id &id) const
+ {
+ return ((_first == id._first) && (_second == id._second));
+ }
+
+ /*! Operator!= */
+ bool operator!=(const Id &id) const
+ {
+ return !((*this) == id);
+ }
+
+ /*! Operator< */
+ bool operator<(const Id &id) const
+ {
+ if (_first < id._first)
+ return true;
+ if (_first == id._first && _second < id._second)
+ return true;
+ return false;
+ }
+
+ private:
+ id_type _first;
+ id_type _second;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Id")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Id")
#endif
};
// stream operator
-inline std::ostream& operator<<(std::ostream& s, const Id& id)
+inline std::ostream &operator<<(std::ostream &s, const Id &id)
{
- s << "[" << id.getFirst() << ", " << id.getSecond() << "]";
- return s;
+ s << "[" << id.getFirst() << ", " << id.getSecond() << "]";
+ return s;
}
} /* namespace Freestyle */
-# endif // __FREESTYLE_ID_H__
+#endif // __FREESTYLE_ID_H__
diff --git a/source/blender/freestyle/intern/system/Interpreter.h b/source/blender/freestyle/intern/system/Interpreter.h
index 3bc7fa75141..911d03318e5 100644
--- a/source/blender/freestyle/intern/system/Interpreter.h
+++ b/source/blender/freestyle/intern/system/Interpreter.h
@@ -25,40 +25,41 @@
#include <string>
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
using namespace std;
namespace Freestyle {
-class Interpreter
-{
-public:
- Interpreter()
- {
- _language = "Unknown";
- }
+class Interpreter {
+ public:
+ Interpreter()
+ {
+ _language = "Unknown";
+ }
- virtual ~Interpreter() {}
+ virtual ~Interpreter()
+ {
+ }
- virtual int interpretFile(const string& filename) = 0;
+ virtual int interpretFile(const string &filename) = 0;
- virtual string getLanguage() const
- {
- return _language;
- }
+ virtual string getLanguage() const
+ {
+ return _language;
+ }
- virtual void reset() = 0;
+ virtual void reset() = 0;
-protected:
- string _language;
+ protected:
+ string _language;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Interpreter")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Interpreter")
#endif
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_INTERPRETER_H__
+#endif // __FREESTYLE_INTERPRETER_H__
diff --git a/source/blender/freestyle/intern/system/Iterator.h b/source/blender/freestyle/intern/system/Iterator.h
index c38dc09fd2e..75d49521f96 100644
--- a/source/blender/freestyle/intern/system/Iterator.h
+++ b/source/blender/freestyle/intern/system/Iterator.h
@@ -25,52 +25,53 @@
#include <string>
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
using namespace std;
namespace Freestyle {
-class Iterator
-{
-public:
- virtual ~Iterator() {}
+class Iterator {
+ public:
+ virtual ~Iterator()
+ {
+ }
- virtual string getExactTypeName() const
- {
- return "Iterator";
- }
+ virtual string getExactTypeName() const
+ {
+ return "Iterator";
+ }
- virtual int increment()
- {
- cerr << "Warning: increment() not implemented" << endl;
- return 0;
- }
+ virtual int increment()
+ {
+ cerr << "Warning: increment() not implemented" << endl;
+ return 0;
+ }
- virtual int decrement()
- {
- cerr << "Warning: decrement() not implemented" << endl;
- return 0;
- }
+ virtual int decrement()
+ {
+ cerr << "Warning: decrement() not implemented" << endl;
+ return 0;
+ }
- virtual bool isBegin() const
- {
- cerr << "Warning: isBegin() not implemented" << endl;
- return false;
- }
+ virtual bool isBegin() const
+ {
+ cerr << "Warning: isBegin() not implemented" << endl;
+ return false;
+ }
- virtual bool isEnd() const
- {
- cerr << "Warning: isEnd() not implemented" << endl;
- return false;
- }
+ virtual bool isEnd() const
+ {
+ cerr << "Warning: isEnd() not implemented" << endl;
+ return false;
+ }
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Iterator")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Iterator")
#endif
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_ITERATOR_H__
+#endif // __FREESTYLE_ITERATOR_H__
diff --git a/source/blender/freestyle/intern/system/PointerSequence.h b/source/blender/freestyle/intern/system/PointerSequence.h
index b4fc73d6e93..015033beeb4 100644
--- a/source/blender/freestyle/intern/system/PointerSequence.h
+++ b/source/blender/freestyle/intern/system/PointerSequence.h
@@ -56,40 +56,38 @@
#include <algorithm>
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
namespace Freestyle {
-template <typename C, typename T>
-class PointerSequence : public C
-{
- PointerSequence (PointerSequence& other);
- PointerSequence& operator=(PointerSequence& other);
+template<typename C, typename T> class PointerSequence : public C {
+ PointerSequence(PointerSequence &other);
+ PointerSequence &operator=(PointerSequence &other);
- static void destroyer(T t)
- {
- delete t;
- }
+ static void destroyer(T t)
+ {
+ delete t;
+ }
-public:
- PointerSequence () {};
+ public:
+ PointerSequence(){};
- ~PointerSequence ()
- {
- destroy();
- }
+ ~PointerSequence()
+ {
+ destroy();
+ }
- void destroy ()
- {
- for_each(this->begin(), this->end(), destroyer);
- }
+ void destroy()
+ {
+ for_each(this->begin(), this->end(), destroyer);
+ }
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:PointerSequence")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:PointerSequence")
#endif
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_POINTER_SEQUENCE_H__
+#endif // __FREESTYLE_POINTER_SEQUENCE_H__
diff --git a/source/blender/freestyle/intern/system/Precision.h b/source/blender/freestyle/intern/system/Precision.h
index a03730433e5..c6695f207cc 100644
--- a/source/blender/freestyle/intern/system/Precision.h
+++ b/source/blender/freestyle/intern/system/Precision.h
@@ -27,9 +27,9 @@ namespace Freestyle {
typedef double real;
#ifndef SWIG
- static const real M_EPSILON = 0.00000001;
-#endif // SWIG
+static const real M_EPSILON = 0.00000001;
+#endif // SWIG
} /* namespace Freestyle */
-#endif // __FREESTYLE_PRECISION_H__
+#endif // __FREESTYLE_PRECISION_H__
diff --git a/source/blender/freestyle/intern/system/ProgressBar.h b/source/blender/freestyle/intern/system/ProgressBar.h
index d3589987202..b3a1f98f15e 100644
--- a/source/blender/freestyle/intern/system/ProgressBar.h
+++ b/source/blender/freestyle/intern/system/ProgressBar.h
@@ -25,71 +25,72 @@
#include <string>
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
using namespace std;
namespace Freestyle {
-class ProgressBar
-{
-public:
- inline ProgressBar()
- {
- _numtotalsteps = 0;
- _progress = 0;
- }
-
- virtual ~ProgressBar() {}
-
- virtual void reset()
- {
- _numtotalsteps = 0;
- _progress = 0;
- }
-
- virtual void setTotalSteps(unsigned n)
- {
- _numtotalsteps = n;
- }
-
- virtual void setProgress(unsigned i)
- {
- _progress = i;
- }
-
- virtual void setLabelText(const string& s)
- {
- _label = s;
- }
-
- /*! accessors */
- inline unsigned int getTotalSteps() const
- {
- return _numtotalsteps;
- }
-
- inline unsigned int getProgress() const
- {
- return _progress;
- }
-
- inline string getLabelText() const
- {
- return _label;
- }
-
-protected:
- unsigned _numtotalsteps;
- unsigned _progress;
- string _label;
+class ProgressBar {
+ public:
+ inline ProgressBar()
+ {
+ _numtotalsteps = 0;
+ _progress = 0;
+ }
+
+ virtual ~ProgressBar()
+ {
+ }
+
+ virtual void reset()
+ {
+ _numtotalsteps = 0;
+ _progress = 0;
+ }
+
+ virtual void setTotalSteps(unsigned n)
+ {
+ _numtotalsteps = n;
+ }
+
+ virtual void setProgress(unsigned i)
+ {
+ _progress = i;
+ }
+
+ virtual void setLabelText(const string &s)
+ {
+ _label = s;
+ }
+
+ /*! accessors */
+ inline unsigned int getTotalSteps() const
+ {
+ return _numtotalsteps;
+ }
+
+ inline unsigned int getProgress() const
+ {
+ return _progress;
+ }
+
+ inline string getLabelText() const
+ {
+ return _label;
+ }
+
+ protected:
+ unsigned _numtotalsteps;
+ unsigned _progress;
+ string _label;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:ProgressBar")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:ProgressBar")
#endif
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_PROGRESS_BAR_H__
+#endif // __FREESTYLE_PROGRESS_BAR_H__
diff --git a/source/blender/freestyle/intern/system/PseudoNoise.cpp b/source/blender/freestyle/intern/system/PseudoNoise.cpp
index 789583591ab..877cdee0814 100644
--- a/source/blender/freestyle/intern/system/PseudoNoise.cpp
+++ b/source/blender/freestyle/intern/system/PseudoNoise.cpp
@@ -27,92 +27,94 @@
static int modf_to_index(Freestyle::real x, unsigned int range)
{
- if (isfinite(x)) {
- Freestyle::real tmp;
- int i = abs((int)(modf(x, &tmp) * range));
- BLI_assert(i >= 0 && i < range);
- return i;
- }
- else {
- return 0;
- }
+ if (isfinite(x)) {
+ Freestyle::real tmp;
+ int i = abs((int)(modf(x, &tmp) * range));
+ BLI_assert(i >= 0 && i < range);
+ return i;
+ }
+ else {
+ return 0;
+ }
}
namespace Freestyle {
real PseudoNoise::_values[];
-PseudoNoise::PseudoNoise() {}
+PseudoNoise::PseudoNoise()
+{
+}
void PseudoNoise::init(long seed)
{
- RandGen::srand48(seed);
- for (unsigned int i = 0; i < NB_VALUE_NOISE; i++)
- _values[i] = -1.0 + 2.0 * RandGen::drand48();
+ RandGen::srand48(seed);
+ for (unsigned int i = 0; i < NB_VALUE_NOISE; i++)
+ _values[i] = -1.0 + 2.0 * RandGen::drand48();
}
real PseudoNoise::linearNoise(real x)
{
- real tmp;
- int i = modf_to_index(x, NB_VALUE_NOISE);
- real x1 = _values[i], x2 = _values[(i + 1) % NB_VALUE_NOISE];
- real t = modf(x * NB_VALUE_NOISE, &tmp);
- return x1 * (1 - t) + x2 * t;
+ real tmp;
+ int i = modf_to_index(x, NB_VALUE_NOISE);
+ real x1 = _values[i], x2 = _values[(i + 1) % NB_VALUE_NOISE];
+ real t = modf(x * NB_VALUE_NOISE, &tmp);
+ return x1 * (1 - t) + x2 * t;
}
static real LanczosWindowed(real t)
{
- if (fabs(t) > 2)
- return 0;
- if (fabs(t) < M_EPSILON)
- return 1.0;
- return sin(M_PI * t) / (M_PI * t) * sin(M_PI * t / 2.0) / (M_PI * t / 2.0);
+ if (fabs(t) > 2)
+ return 0;
+ if (fabs(t) < M_EPSILON)
+ return 1.0;
+ return sin(M_PI * t) / (M_PI * t) * sin(M_PI * t / 2.0) / (M_PI * t / 2.0);
}
real PseudoNoise::smoothNoise(real x)
{
- real tmp;
- int i = modf_to_index(x, NB_VALUE_NOISE);
- int h = i - 1;
- if (UNLIKELY(h < 0)) {
- h = NB_VALUE_NOISE + h;
- }
-
- real x1 = _values[i], x2 = _values[(i + 1) % NB_VALUE_NOISE];
- real x0 = _values[h], x3 = _values[(i + 2) % NB_VALUE_NOISE];
-
- real t = modf(x * NB_VALUE_NOISE, &tmp);
- real y0 = LanczosWindowed(-1 -t);
- real y1 = LanczosWindowed(-t);
- real y2 = LanczosWindowed(1 - t);
- real y3 = LanczosWindowed(2 - t);
+ real tmp;
+ int i = modf_to_index(x, NB_VALUE_NOISE);
+ int h = i - 1;
+ if (UNLIKELY(h < 0)) {
+ h = NB_VALUE_NOISE + h;
+ }
+
+ real x1 = _values[i], x2 = _values[(i + 1) % NB_VALUE_NOISE];
+ real x0 = _values[h], x3 = _values[(i + 2) % NB_VALUE_NOISE];
+
+ real t = modf(x * NB_VALUE_NOISE, &tmp);
+ real y0 = LanczosWindowed(-1 - t);
+ real y1 = LanczosWindowed(-t);
+ real y2 = LanczosWindowed(1 - t);
+ real y3 = LanczosWindowed(2 - t);
#if 0
- cerr << "x0=" << x0 << " x1=" << x1 << " x2=" << x2 << " x3=" << x3 << endl;
- cerr << "y0=" << y0 << " y1=" << y1 << " y2=" << y2 << " y3=" << y3 << " :" << endl;
+ cerr << "x0=" << x0 << " x1=" << x1 << " x2=" << x2 << " x3=" << x3 << endl;
+ cerr << "y0=" << y0 << " y1=" << y1 << " y2=" << y2 << " y3=" << y3 << " :" << endl;
#endif
- return (x0 * y0 + x1 * y1 + x2 * y2 + x3 * y3) / (y0 + y1 + y2 + y3);
+ return (x0 * y0 + x1 * y1 + x2 * y2 + x3 * y3) / (y0 + y1 + y2 + y3);
}
real PseudoNoise::turbulenceSmooth(real x, unsigned nbOctave)
{
- real y = 0;
- real k = 1.0;
- for (unsigned int i = 0; i < nbOctave; i++) {
- y = y + k * smoothNoise(x * k);
- k = k / 2.0;
- }
- return y;
+ real y = 0;
+ real k = 1.0;
+ for (unsigned int i = 0; i < nbOctave; i++) {
+ y = y + k * smoothNoise(x * k);
+ k = k / 2.0;
+ }
+ return y;
}
real PseudoNoise::turbulenceLinear(real x, unsigned nbOctave)
{
- real y = 0;
- real k = 1.0;
- for (unsigned int i = 0; i < nbOctave; i++) {
- y = y + k * linearNoise(x * k);
- k = k / 2.0;
- }
- return y;
+ real y = 0;
+ real k = 1.0;
+ for (unsigned int i = 0; i < nbOctave; i++) {
+ y = y + k * linearNoise(x * k);
+ k = k / 2.0;
+ }
+ return y;
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/system/PseudoNoise.h b/source/blender/freestyle/intern/system/PseudoNoise.h
index dbcc2a477a2..53fe54754c8 100644
--- a/source/blender/freestyle/intern/system/PseudoNoise.h
+++ b/source/blender/freestyle/intern/system/PseudoNoise.h
@@ -25,35 +25,36 @@
#include "Precision.h"
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
namespace Freestyle {
-class PseudoNoise
-{
-public:
- PseudoNoise();
+class PseudoNoise {
+ public:
+ PseudoNoise();
- virtual ~PseudoNoise() {}
+ virtual ~PseudoNoise()
+ {
+ }
- real smoothNoise(real x);
- real linearNoise(real x);
+ real smoothNoise(real x);
+ real linearNoise(real x);
- real turbulenceSmooth(real x, unsigned nbOctave = 8);
- real turbulenceLinear(real x, unsigned nbOctave = 8);
+ real turbulenceSmooth(real x, unsigned nbOctave = 8);
+ real turbulenceLinear(real x, unsigned nbOctave = 8);
- static void init(long seed);
+ static void init(long seed);
-protected:
- static const unsigned NB_VALUE_NOISE = 512;
- static real _values[NB_VALUE_NOISE];
+ protected:
+ static const unsigned NB_VALUE_NOISE = 512;
+ static real _values[NB_VALUE_NOISE];
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:PseudoNoise")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:PseudoNoise")
#endif
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_PSEUDO_NOISE_H__
+#endif // __FREESTYLE_PSEUDO_NOISE_H__
diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.h b/source/blender/freestyle/intern/system/PythonInterpreter.h
index d829f4f87c4..bcb36d8d6b5 100644
--- a/source/blender/freestyle/intern/system/PythonInterpreter.h
+++ b/source/blender/freestyle/intern/system/PythonInterpreter.h
@@ -51,104 +51,103 @@ extern "C" {
namespace Freestyle {
-class PythonInterpreter : public Interpreter
-{
-public:
- PythonInterpreter()
- {
- _language = "Python";
- _context = 0;
- memset(&_freestyle_bmain, 0, sizeof(Main));
- }
-
- void setContext(bContext *C)
- {
- _context = C;
- }
-
- int interpretFile(const string& filename)
- {
- ReportList *reports = CTX_wm_reports(_context);
- BKE_reports_clear(reports);
- char *fn = const_cast<char*>(filename.c_str());
+class PythonInterpreter : public Interpreter {
+ public:
+ PythonInterpreter()
+ {
+ _language = "Python";
+ _context = 0;
+ memset(&_freestyle_bmain, 0, sizeof(Main));
+ }
+
+ void setContext(bContext *C)
+ {
+ _context = C;
+ }
+
+ int interpretFile(const string &filename)
+ {
+ ReportList *reports = CTX_wm_reports(_context);
+ BKE_reports_clear(reports);
+ char *fn = const_cast<char *>(filename.c_str());
#if 0
- bool ok = BPY_execute_filepath(_context, fn, reports);
+ bool ok = BPY_execute_filepath(_context, fn, reports);
#else
- bool ok;
- Text *text = BKE_text_load(&_freestyle_bmain, fn, G_MAIN->name);
- if (text) {
- ok = BPY_execute_text(_context, text, reports, false);
- BKE_id_delete(&_freestyle_bmain, text);
- }
- else {
- BKE_reportf(reports, RPT_ERROR, "Cannot open file: %s", fn);
- ok = false;
- }
+ bool ok;
+ Text *text = BKE_text_load(&_freestyle_bmain, fn, G_MAIN->name);
+ if (text) {
+ ok = BPY_execute_text(_context, text, reports, false);
+ BKE_id_delete(&_freestyle_bmain, text);
+ }
+ else {
+ BKE_reportf(reports, RPT_ERROR, "Cannot open file: %s", fn);
+ ok = false;
+ }
#endif
- if (ok == false) {
- cerr << "\nError executing Python script from PythonInterpreter::interpretFile" << endl;
- cerr << "File: " << fn << endl;
- cerr << "Errors: " << endl;
- BKE_reports_print(reports, RPT_ERROR);
- return 1;
- }
+ if (ok == false) {
+ cerr << "\nError executing Python script from PythonInterpreter::interpretFile" << endl;
+ cerr << "File: " << fn << endl;
+ cerr << "Errors: " << endl;
+ BKE_reports_print(reports, RPT_ERROR);
+ return 1;
+ }
- // cleaning up
- BKE_reports_clear(reports);
+ // cleaning up
+ BKE_reports_clear(reports);
- return 0;
- }
+ return 0;
+ }
- int interpretString(const string& str, const string& name)
- {
- ReportList *reports = CTX_wm_reports(_context);
+ int interpretString(const string &str, const string &name)
+ {
+ ReportList *reports = CTX_wm_reports(_context);
- BKE_reports_clear(reports);
+ BKE_reports_clear(reports);
- if (!BPY_execute_string(_context, NULL, str.c_str())) {
- BPy_errors_to_report(reports);
- cerr << "\nError executing Python script from PythonInterpreter::interpretString" << endl;
- cerr << "Name: " << name << endl;
- cerr << "Errors: " << endl;
- BKE_reports_print(reports, RPT_ERROR);
- return 1;
- }
+ if (!BPY_execute_string(_context, NULL, str.c_str())) {
+ BPy_errors_to_report(reports);
+ cerr << "\nError executing Python script from PythonInterpreter::interpretString" << endl;
+ cerr << "Name: " << name << endl;
+ cerr << "Errors: " << endl;
+ BKE_reports_print(reports, RPT_ERROR);
+ return 1;
+ }
- BKE_reports_clear(reports);
+ BKE_reports_clear(reports);
- return 0;
- }
+ return 0;
+ }
- int interpretText(struct Text *text, const string& name)
- {
- ReportList *reports = CTX_wm_reports(_context);
+ int interpretText(struct Text *text, const string &name)
+ {
+ ReportList *reports = CTX_wm_reports(_context);
- BKE_reports_clear(reports);
+ BKE_reports_clear(reports);
- if (!BPY_execute_text(_context, text, reports, false)) {
- cerr << "\nError executing Python script from PythonInterpreter::interpretText" << endl;
- cerr << "Name: " << name << endl;
- cerr << "Errors: " << endl;
- BKE_reports_print(reports, RPT_ERROR);
- return 1;
- }
+ if (!BPY_execute_text(_context, text, reports, false)) {
+ cerr << "\nError executing Python script from PythonInterpreter::interpretText" << endl;
+ cerr << "Name: " << name << endl;
+ cerr << "Errors: " << endl;
+ BKE_reports_print(reports, RPT_ERROR);
+ return 1;
+ }
- BKE_reports_clear(reports);
+ BKE_reports_clear(reports);
- return 0;
- }
+ return 0;
+ }
- void reset()
- {
- // nothing to do
- }
+ void reset()
+ {
+ // nothing to do
+ }
-private:
- bContext *_context;
- Main _freestyle_bmain;
+ private:
+ bContext *_context;
+ Main _freestyle_bmain;
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_PYTHON_INTERPRETER_H__
+#endif // __FREESTYLE_PYTHON_INTERPRETER_H__
diff --git a/source/blender/freestyle/intern/system/RandGen.cpp b/source/blender/freestyle/intern/system/RandGen.cpp
index 49a9df14f22..77eb9a8c10a 100644
--- a/source/blender/freestyle/intern/system/RandGen.cpp
+++ b/source/blender/freestyle/intern/system/RandGen.cpp
@@ -28,69 +28,70 @@ namespace Freestyle {
//
///////////////////////////////////////////////////////////////////////////////
-#define N 16
-#define MASK ((unsigned)(1 << (N - 1)) + (1 << (N - 1)) - 1)
-#define X0 0x330E
-#define X1 0xABCD
-#define X2 0x1234
-#define A0 0xE66D
-#define A1 0xDEEC
-#define A2 0x5
-#define C 0xB
+#define N 16
+#define MASK ((unsigned)(1 << (N - 1)) + (1 << (N - 1)) - 1)
+#define X0 0x330E
+#define X1 0xABCD
+#define X2 0x1234
+#define A0 0xE66D
+#define A1 0xDEEC
+#define A2 0x5
+#define C 0xB
#if 0 // XXX Unused
-#define HI_BIT (1L << (2 * N - 1))
+# define HI_BIT (1L << (2 * N - 1))
#endif
-#define LOW(x) ((unsigned)(x) & MASK)
+#define LOW(x) ((unsigned)(x)&MASK)
#define HIGH(x) LOW((x) >> N)
-#define MUL(x, y, z) \
- { \
- long l = (long)(x) * (long)(y); \
- (z)[0] = LOW(l); \
- (z)[1] = HIGH(l); \
- }
+#define MUL(x, y, z) \
+ { \
+ long l = (long)(x) * (long)(y); \
+ (z)[0] = LOW(l); \
+ (z)[1] = HIGH(l); \
+ }
-#define CARRY(x, y) ((unsigned long)((long)(x) + (long)(y)) > MASK)
-#define ADDEQU(x, y, z) (z = CARRY(x, (y)), x = LOW(x + (y)))
+#define CARRY(x, y) ((unsigned long)((long)(x) + (long)(y)) > MASK)
+#define ADDEQU(x, y, z) (z = CARRY(x, (y)), x = LOW(x + (y)))
#define SET3(x, x0, x1, x2) ((x)[0] = (x0), (x)[1] = (x1), (x)[2] = (x2))
-#if 0 // XXX, unused
-#define SETLOW(x, y, n) SET3(x, LOW((y)[n]), LOW((y)[(n)+1]), LOW((y)[(n)+2]))
+#if 0 // XXX, unused
+# define SETLOW(x, y, n) SET3(x, LOW((y)[n]), LOW((y)[(n) + 1]), LOW((y)[(n) + 2]))
#endif
-#define SEED(x0, x1, x2) (SET3(x, x0, x1, x2), SET3(a, A0, A1, A2), c = C)
-
-#if 0 // XXX, unused
-#define REST(v) \
- for (i = 0; i < 3; i++) { \
- xsubi[i] = x[i]; \
- x[i] = temp[i]; \
- } \
- return (v); \
- (void) 0
-
-#define NEST(TYPE, f, F) \
- TYPE f(register unsigned short *xsubi) { \
- register int i; \
- register TYPE v; \
- unsigned temp[3]; \
- for (i = 0; i < 3; i++) { \
- temp[i] = x[i]; \
- x[i] = LOW(xsubi[i]); \
- } \
- v = F(); \
- REST(v); \
- }
+#define SEED(x0, x1, x2) (SET3(x, x0, x1, x2), SET3(a, A0, A1, A2), c = C)
+
+#if 0 // XXX, unused
+# define REST(v) \
+ for (i = 0; i < 3; i++) { \
+ xsubi[i] = x[i]; \
+ x[i] = temp[i]; \
+ } \
+ return (v); \
+ (void)0
+
+# define NEST(TYPE, f, F) \
+ TYPE f(register unsigned short *xsubi) \
+ { \
+ register int i; \
+ register TYPE v; \
+ unsigned temp[3]; \
+ for (i = 0; i < 3; i++) { \
+ temp[i] = x[i]; \
+ x[i] = LOW(xsubi[i]); \
+ } \
+ v = F(); \
+ REST(v); \
+ }
#endif
static unsigned x[3] = {
- X0,
- X1,
- X2,
+ X0,
+ X1,
+ X2,
};
static unsigned a[3] = {
- A0,
- A1,
- A2,
+ A0,
+ A1,
+ A2,
};
static unsigned c = C;
@@ -101,29 +102,30 @@ static unsigned c = C;
real RandGen::drand48()
{
- static real two16m = 1.0 / (1L << N);
- next();
- return (two16m * (two16m * (two16m * x[0] + x[1]) + x[2]));
+ static real two16m = 1.0 / (1L << N);
+ next();
+ return (two16m * (two16m * (two16m * x[0] + x[1]) + x[2]));
}
void RandGen::srand48(long seedval)
{
- SEED(X0, LOW(seedval), HIGH(seedval));
+ SEED(X0, LOW(seedval), HIGH(seedval));
}
void RandGen::next()
{
- unsigned p[2], q[2], r[2], carry0, carry1;
-
- MUL(a[0], x[0], p);
- ADDEQU(p[0], c, carry0);
- ADDEQU(p[1], carry0, carry1);
- MUL(a[0], x[1], q);
- ADDEQU(p[1], q[0], carry0);
- MUL(a[1], x[0], r);
- x[2] = LOW(carry0 + carry1 + CARRY(p[1], r[0]) + q[1] + r[1] + a[0] * x[2] + a[1] * x[1] + a[2] * x[0]);
- x[1] = LOW(p[1] + r[0]);
- x[0] = LOW(p[0]);
+ unsigned p[2], q[2], r[2], carry0, carry1;
+
+ MUL(a[0], x[0], p);
+ ADDEQU(p[0], c, carry0);
+ ADDEQU(p[1], carry0, carry1);
+ MUL(a[0], x[1], q);
+ ADDEQU(p[1], q[0], carry0);
+ MUL(a[1], x[0], r);
+ x[2] = LOW(carry0 + carry1 + CARRY(p[1], r[0]) + q[1] + r[1] + a[0] * x[2] + a[1] * x[1] +
+ a[2] * x[0]);
+ x[1] = LOW(p[1] + r[0]);
+ x[0] = LOW(p[0]);
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/system/RandGen.h b/source/blender/freestyle/intern/system/RandGen.h
index de3c834be55..43f36b0a2fd 100644
--- a/source/blender/freestyle/intern/system/RandGen.h
+++ b/source/blender/freestyle/intern/system/RandGen.h
@@ -27,25 +27,24 @@
#include "../system/Precision.h"
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
namespace Freestyle {
-class RandGen
-{
-public:
- static real drand48();
- static void srand48(long value);
+class RandGen {
+ public:
+ static real drand48();
+ static void srand48(long value);
-private:
- static void next();
+ private:
+ static void next();
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:RandGen")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:RandGen")
#endif
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_RAND_GEN_H__
+#endif // __FREESTYLE_RAND_GEN_H__
diff --git a/source/blender/freestyle/intern/system/RenderMonitor.h b/source/blender/freestyle/intern/system/RenderMonitor.h
index 6d8414337c5..8058ab1b7ff 100644
--- a/source/blender/freestyle/intern/system/RenderMonitor.h
+++ b/source/blender/freestyle/intern/system/RenderMonitor.h
@@ -27,49 +27,50 @@ extern "C" {
}
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
namespace Freestyle {
-class RenderMonitor
-{
-public:
- inline RenderMonitor(Render *re)
- {
- _re = re;
- }
+class RenderMonitor {
+ public:
+ inline RenderMonitor(Render *re)
+ {
+ _re = re;
+ }
- virtual ~RenderMonitor() {}
+ virtual ~RenderMonitor()
+ {
+ }
- inline void setInfo(string info)
- {
- if (_re && !info.empty()) {
- _re->i.infostr = info.c_str();
- _re->stats_draw(_re->sdh, &_re->i);
- _re->i.infostr = NULL;
- }
- }
+ inline void setInfo(string info)
+ {
+ if (_re && !info.empty()) {
+ _re->i.infostr = info.c_str();
+ _re->stats_draw(_re->sdh, &_re->i);
+ _re->i.infostr = NULL;
+ }
+ }
- inline void progress(float i)
- {
- if (_re)
- _re->progress(_re->prh, i);
- }
+ inline void progress(float i)
+ {
+ if (_re)
+ _re->progress(_re->prh, i);
+ }
- inline bool testBreak()
- {
- return _re && _re->test_break(_re->tbh);
- }
+ inline bool testBreak()
+ {
+ return _re && _re->test_break(_re->tbh);
+ }
-protected:
- Render *_re;
+ protected:
+ Render *_re;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:RenderMonitor")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:RenderMonitor")
#endif
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_RENDER_MONITOR_H__
+#endif // __FREESTYLE_RENDER_MONITOR_H__
diff --git a/source/blender/freestyle/intern/system/StringUtils.cpp b/source/blender/freestyle/intern/system/StringUtils.cpp
index e8c3dad5d85..027491a790f 100644
--- a/source/blender/freestyle/intern/system/StringUtils.cpp
+++ b/source/blender/freestyle/intern/system/StringUtils.cpp
@@ -28,35 +28,33 @@ namespace Freestyle {
namespace StringUtils {
-void getPathName(const string& path, const string& base, vector<string>& pathnames)
+void getPathName(const string &path, const string &base, vector<string> &pathnames)
{
- string dir;
- string res;
- char cleaned[FILE_MAX];
- unsigned size = path.size();
+ string dir;
+ string res;
+ char cleaned[FILE_MAX];
+ unsigned size = path.size();
- pathnames.push_back(base);
+ pathnames.push_back(base);
- for (unsigned int pos = 0, sep = path.find(Config::PATH_SEP, pos);
- pos < size;
- pos = sep + 1, sep = path.find(Config::PATH_SEP, pos))
- {
- if (sep == (unsigned)string::npos)
- sep = size;
+ for (unsigned int pos = 0, sep = path.find(Config::PATH_SEP, pos); pos < size;
+ pos = sep + 1, sep = path.find(Config::PATH_SEP, pos)) {
+ if (sep == (unsigned)string::npos)
+ sep = size;
- dir = path.substr(pos, sep - pos);
+ dir = path.substr(pos, sep - pos);
- BLI_strncpy(cleaned, dir.c_str(), FILE_MAX);
- BLI_cleanup_file(NULL, cleaned);
- res = string(cleaned);
+ BLI_strncpy(cleaned, dir.c_str(), FILE_MAX);
+ BLI_cleanup_file(NULL, cleaned);
+ res = string(cleaned);
- if (!base.empty())
- res += Config::DIR_SEP + base;
+ if (!base.empty())
+ res += Config::DIR_SEP + base;
- pathnames.push_back(res);
- }
+ pathnames.push_back(res);
+ }
}
-} // end of namespace StringUtils
+} // end of namespace StringUtils
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/system/StringUtils.h b/source/blender/freestyle/intern/system/StringUtils.h
index 8329f071a51..575d26597ee 100644
--- a/source/blender/freestyle/intern/system/StringUtils.h
+++ b/source/blender/freestyle/intern/system/StringUtils.h
@@ -39,19 +39,18 @@ namespace Freestyle {
namespace StringUtils {
-void getPathName(const string& path, const string& base, vector<string>& pathnames);
+void getPathName(const string &path, const string &base, vector<string> &pathnames);
// STL related
-struct ltstr
-{
- bool operator()(const char *s1, const char *s2) const
- {
- return strcmp(s1, s2) < 0;
- }
+struct ltstr {
+ bool operator()(const char *s1, const char *s2) const
+ {
+ return strcmp(s1, s2) < 0;
+ }
};
-} // end of namespace StringUtils
+} // end of namespace StringUtils
} /* namespace Freestyle */
-#endif // __FREESTYLE_STRING_UTILS_H__
+#endif // __FREESTYLE_STRING_UTILS_H__
diff --git a/source/blender/freestyle/intern/system/TimeStamp.h b/source/blender/freestyle/intern/system/TimeStamp.h
index adf6083a16f..2fbf83d226d 100644
--- a/source/blender/freestyle/intern/system/TimeStamp.h
+++ b/source/blender/freestyle/intern/system/TimeStamp.h
@@ -23,51 +23,52 @@
*/
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
namespace Freestyle {
-class TimeStamp
-{
-public:
- static inline TimeStamp *instance()
- {
- return &_instance;
- }
+class TimeStamp {
+ public:
+ static inline TimeStamp *instance()
+ {
+ return &_instance;
+ }
- inline unsigned getTimeStamp() const
- {
- return _time_stamp;
- }
+ inline unsigned getTimeStamp() const
+ {
+ return _time_stamp;
+ }
- inline void increment()
- {
- ++_time_stamp;
- }
+ inline void increment()
+ {
+ ++_time_stamp;
+ }
- inline void reset()
- {
- _time_stamp = 1;
- }
+ inline void reset()
+ {
+ _time_stamp = 1;
+ }
-protected:
- TimeStamp()
- {
- _time_stamp = 1;
- }
+ protected:
+ TimeStamp()
+ {
+ _time_stamp = 1;
+ }
- TimeStamp(const TimeStamp&) {}
+ TimeStamp(const TimeStamp &)
+ {
+ }
-private:
- static TimeStamp _instance;
- unsigned _time_stamp;
+ private:
+ static TimeStamp _instance;
+ unsigned _time_stamp;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:TimeStamp")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:TimeStamp")
#endif
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_TIME_STAMP_H__
+#endif // __FREESTYLE_TIME_STAMP_H__
diff --git a/source/blender/freestyle/intern/system/TimeUtils.h b/source/blender/freestyle/intern/system/TimeUtils.h
index 1e3bd05c81d..6d4c56ab15e 100644
--- a/source/blender/freestyle/intern/system/TimeUtils.h
+++ b/source/blender/freestyle/intern/system/TimeUtils.h
@@ -25,37 +25,40 @@
#include <time.h>
#ifdef WITH_CXX_GUARDEDALLOC
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
#endif
namespace Freestyle {
-class Chronometer
-{
-public:
- inline Chronometer() {}
- inline ~Chronometer() {}
+class Chronometer {
+ public:
+ inline Chronometer()
+ {
+ }
+ inline ~Chronometer()
+ {
+ }
- inline clock_t start()
- {
- _start = clock();
- return _start;
- }
+ inline clock_t start()
+ {
+ _start = clock();
+ return _start;
+ }
- inline double stop()
- {
- clock_t stop = clock();
- return (double)(stop - _start) / CLOCKS_PER_SEC;
- }
+ inline double stop()
+ {
+ clock_t stop = clock();
+ return (double)(stop - _start) / CLOCKS_PER_SEC;
+ }
-private:
- clock_t _start;
+ private:
+ clock_t _start;
#ifdef WITH_CXX_GUARDEDALLOC
- MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Chronometer")
+ MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:Chronometer")
#endif
};
} /* namespace Freestyle */
-#endif // __FREESTYLE_TIME_UTILS_H__
+#endif // __FREESTYLE_TIME_UTILS_H__