Code

Filters. New custom predefined cross-smooth filter (very experimental...).
[inkscape.git] / src / 2geom / sbasis.cpp
index b5c1a05a7bec28c6c6dfeb8f052466d154a65745..e313ad08da8e2c1654c9a09e3f141a250ac8c82c 100644 (file)
@@ -198,7 +198,7 @@ SBasis shift(SBasis const &a, int sh) {
     
     for(int i = 0; i < sh; i++)
         c[i] = Linear(0,0);
-    for(size_t i = m, j = 0; i < n; i++, j++)
+    for(size_t i = m, j = std::max(0,-sh); i < n; i++, j++)
         c[i] = a[j];
     return c;
 }
@@ -375,7 +375,7 @@ SBasis sqrt(SBasis const &a, int k) {
     c[0] = Linear(std::sqrt(a[0][0]), std::sqrt(a[0][1]));
     SBasis r = a - multiply(c, c); // remainder
 
-    for(unsigned i = 1; i <= (unsigned)k and i<r.size(); i++) {
+    for(unsigned i = 1; i <= (unsigned)k && i<r.size(); i++) {
         Linear ci(r[i][0]/(2*c[0][0]), r[i][1]/(2*c[0][1]));
         SBasis cisi = shift(ci, i);
         r -= multiply(shift((c*2 + cisi), i), SBasis(ci));
@@ -660,4 +660,4 @@ SBasis compose_inverse(SBasis const &f, SBasis const &g, unsigned order, double
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :