]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/utils/bezier.cpp
skins2: typo
[vlc] / modules / gui / skins2 / utils / bezier.cpp
index defccf05aeb54d3ba28398da15aa559ba8b96327..ea4d8c370cff5141bde67ec53f27ce15f5935da4 100644 (file)
@@ -194,6 +194,23 @@ int Bezier::findNearestPoint( int x, int y ) const
 }
 
 
+inline float Bezier::power( float x, int n )
+{
+#if 0
+    return n <= 0 ? 1 : x * power( x, n - 1 );
+#else
+    return powf( x, n );
+#endif
+}
+
+
+inline float Bezier::computeCoeff( int i, int n, float t ) const
+{
+    return (power( t, i ) * power( 1 - t, (n - i) ) *
+        (m_ft[n] / m_ft[i] / m_ft[n - i]));
+}
+
+
 void Bezier::computePoint( float t, int &x, int &y ) const
 {
     // See http://astronomy.swin.edu.au/~pbourke/curves/bezier/ for a simple
@@ -212,18 +229,3 @@ void Bezier::computePoint( float t, int &x, int &y ) const
     y = lrintf(yPos);
 }
 
-
-inline float Bezier::computeCoeff( int i, int n, float t ) const
-{
-    return (power( t, i ) * power( 1 - t, (n - i) ) *
-        (m_ft[n] / m_ft[i] / m_ft[n - i]));
-}
-
-
-inline float Bezier::power( float x, int n ) const
-{
-    if( n > 0 )
-        return x * power( x, n - 1);
-    else
-        return 1;
-}