~centralelyon2010/inkscape/imagelinks2

« back to all changes in this revision

Viewing changes to src/live_effects/lpe-curvestitch.cpp

  • Committer: Ted Gould
  • Date: 2008-11-21 05:24:08 UTC
  • Revision ID: ted@canonical.com-20081121052408-tilucis2pjrrpzxx
MergeĀ fromĀ fe-moved

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
        endpoint_spacing_variation.resetRandomizer();
80
80
 
81
81
        D2<Piecewise<SBasis> > stroke = make_cuts_independent(strokepath.get_pwd2());
82
 
        Interval bndsStroke = bounds_exact(stroke[0]);
83
 
        gdouble scaling = bndsStroke.max() - bndsStroke.min();
84
 
        Interval bndsStrokeY = bounds_exact(stroke[1]);
85
 
        Point stroke_origin(bndsStroke.min(), (bndsStrokeY.max()+bndsStrokeY.min())/2);
 
82
        OptInterval bndsStroke = bounds_exact(stroke[0]);
 
83
        OptInterval bndsStrokeY = bounds_exact(stroke[1]);
 
84
        if (!bndsStroke && !bndsStrokeY) {
 
85
            return path_in;
 
86
        }
 
87
        gdouble scaling = bndsStroke->max() - bndsStroke->min();
 
88
        Point stroke_origin(bndsStroke->min(), (bndsStrokeY->max()+bndsStrokeY->min())/2);
86
89
 
87
90
        std::vector<Geom::Path> path_out;
88
91
 
163
166
        pwd2.concat( temppath[i].toPwSb() );
164
167
    }
165
168
    D2<Piecewise<SBasis> > d2pw = make_cuts_independent(pwd2);
166
 
    Interval bndsX = bounds_exact(d2pw[0]);
167
 
    Interval bndsY = bounds_exact(d2pw[1]);
168
 
    Point start(bndsX.min(), (bndsY.max()+bndsY.min())/2);
169
 
    Point end(bndsX.max(), (bndsY.max()+bndsY.min())/2);
170
 
 
171
 
    if ( !Geom::are_near(start,end) ) {
172
 
        Geom::Path path;
173
 
        path.start( start );
174
 
        path.appendNew<Geom::LineSegment>( end );
175
 
        strokepath.set_new_value( path.toPwSb(), true );
 
169
    OptInterval bndsX = bounds_exact(d2pw[0]);
 
170
    OptInterval bndsY = bounds_exact(d2pw[1]);
 
171
    if (bndsX && bndsY) {
 
172
        Point start(bndsX->min(), (bndsY->max()+bndsY->min())/2);
 
173
        Point end(bndsX->max(), (bndsY->max()+bndsY->min())/2);
 
174
        if ( !Geom::are_near(start,end) ) {
 
175
            Geom::Path path;
 
176
            path.start( start );
 
177
            path.appendNew<Geom::LineSegment>( end );
 
178
            strokepath.set_new_value( path.toPwSb(), true );
 
179
        } else {
 
180
            // bounding box is too small to make decent path. set to default default. :-)
 
181
            strokepath.param_set_and_write_default();
 
182
        }
176
183
    } else {
177
 
        // bounding box is too small to make decent path. set to default default. :-)
 
184
        // bounding box is non-existent. set to default default. :-)
178
185
        strokepath.param_set_and_write_default();
179
186
    }
180
187
}