Fix a crash in the draw tool. The resulting bline should approximate the drawn curve...
[synfig.git] / synfig-studio / trunk / src / synfigapp / blineconvert.cpp
index 1f6e3a7..b3942cf 100644 (file)
@@ -361,8 +361,12 @@ int tessellate_curves(const std::vector<cpindex> &inds, const std::vector<Point>
                        //build hermite curve, it's easier
                        curve.p1() = f[i0];
                        curve.p2() = f[i3];
-                       curve.t1() = df[i0]*(df[i0].mag_squared() > 1e-4 ? j2->tangentscale/df[i0].mag() : j2->tangentscale);
-                       curve.t2() = df[i3]*(df[i3].mag_squared() > 1e-4 ? j->tangentscale/df[i3].mag() : j->tangentscale);
+                       curve.t1() = df[i0-ibase] * (df[i0-ibase].mag_squared() > 1e-4
+                                                                                ? j2->tangentscale/df[i0-ibase].mag()
+                                                                                : j2->tangentscale);
+                       curve.t2() = df[i3-ibase] * (df[i3-ibase].mag_squared() > 1e-4
+                                                                                ? j->tangentscale/df[i3-ibase].mag()
+                                                                                : j->tangentscale);
                        curve.sync();
 
                        //MUST include the end point (since we are ignoring left one)
@@ -629,7 +633,7 @@ synfigapp::BLineConverter::operator () (std::list<synfig::BLinePoint> &out, cons
                        //preproceval += timer();
                        //numpre++;
 
-                       work.resize(size*2-1); //guarantee that all points will be tessellated correctly (one point inbetween every 2 adjacent points)
+                       work.resize(size*2-1); //guarantee that all points will be tessellated correctly (one point in between every 2 adjacent points)
 
                        //if size of work is size*2-1, the step size should be 1/(size*2 - 2)
                        //Real step = 1/(Real)(size*2 - 1);