diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2009-01-02 20:19:44 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2009-01-02 20:19:44 +0000 |
| commit | 9d50d1f772eb8b9664e1921ef08b75eaf3a893a9 (patch) | |
| tree | 43f75c927381424cde6c932b5e8b90355e33e011 /src/splivarot.cpp | |
| parent | improve cairo path drawing (diff) | |
| download | inkscape-9d50d1f772eb8b9664e1921ef08b75eaf3a893a9.tar.gz inkscape-9d50d1f772eb8b9664e1921ef08b75eaf3a893a9.zip | |
make 'marker' property work (shorthand for start, mid and end markers); inkscape now passes svg testsuite painting-marker-03-f.svg
(bzr r7061)
Diffstat (limited to 'src/splivarot.cpp')
| -rw-r--r-- | src/splivarot.cpp | 74 |
1 files changed, 40 insertions, 34 deletions
diff --git a/src/splivarot.cpp b/src/splivarot.cpp index c57c58a14..f6ae9baa0 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -858,46 +858,52 @@ sp_selected_path_outline(SPDesktop *desktop) Geom::PathVector const & pathv = curve->get_pathvector(); for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { - if ( SPObject *marker_obj = shape->marker[SP_MARKER_LOC_START] ) { - Geom::Matrix const m (sp_shape_marker_get_transform_at_start(path_it->front())); - sp_selected_path_outline_add_marker( marker_obj, m, - Geom::Scale(i_style->stroke_width.computed), transform, - g_repr, xml_doc, doc ); + for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START + if ( SPObject *marker_obj = shape->marker[i] ) { + Geom::Matrix const m (sp_shape_marker_get_transform_at_start(path_it->front())); + sp_selected_path_outline_add_marker( marker_obj, m, + Geom::Scale(i_style->stroke_width.computed), transform, + g_repr, xml_doc, doc ); + } } - SPObject *midmarker_obj = shape->marker[SP_MARKER_LOC_MID]; - if ( midmarker_obj && (path_it->size_default() > 1) ) { - Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve - Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); // outgoing curve - while (curve_it2 != path_it->end_default()) - { - /* Put marker between curve_it1 and curve_it2. - * Loop to end_default (so including closing segment), because when a path is closed, - * there should be a midpoint marker between last segment and closing straight line segment - */ - Geom::Matrix const m (sp_shape_marker_get_transform(*curve_it1, *curve_it2)); - sp_selected_path_outline_add_marker(midmarker_obj, m, - Geom::Scale(i_style->stroke_width.computed), transform, - g_repr, xml_doc, doc); - - ++curve_it1; - ++curve_it2; + for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID + SPObject *midmarker_obj = shape->marker[i]; + if ( midmarker_obj && (path_it->size_default() > 1) ) { + Geom::Path::const_iterator curve_it1 = path_it->begin(); // incoming curve + Geom::Path::const_iterator curve_it2 = ++(path_it->begin()); // outgoing curve + while (curve_it2 != path_it->end_default()) + { + /* Put marker between curve_it1 and curve_it2. + * Loop to end_default (so including closing segment), because when a path is closed, + * there should be a midpoint marker between last segment and closing straight line segment + */ + Geom::Matrix const m (sp_shape_marker_get_transform(*curve_it1, *curve_it2)); + sp_selected_path_outline_add_marker(midmarker_obj, m, + Geom::Scale(i_style->stroke_width.computed), transform, + g_repr, xml_doc, doc); + + ++curve_it1; + ++curve_it2; + } } } - if ( SPObject *marker_obj = shape->marker[SP_MARKER_LOC_END] ) { - /* Get reference to last curve in the path. - * For moveto-only path, this returns the "closing line segment". */ - unsigned int index = path_it->size_default(); - if (index > 0) { - index--; - } - Geom::Curve const &lastcurve = (*path_it)[index]; + for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END + if ( SPObject *marker_obj = shape->marker[i] ) { + /* Get reference to last curve in the path. + * For moveto-only path, this returns the "closing line segment". */ + unsigned int index = path_it->size_default(); + if (index > 0) { + index--; + } + Geom::Curve const &lastcurve = (*path_it)[index]; - Geom::Matrix const m = sp_shape_marker_get_transform_at_end(lastcurve); - sp_selected_path_outline_add_marker( marker_obj, m, - Geom::Scale(i_style->stroke_width.computed), transform, - g_repr, xml_doc, doc ); + Geom::Matrix const m = sp_shape_marker_get_transform_at_end(lastcurve); + sp_selected_path_outline_add_marker( marker_obj, m, + Geom::Scale(i_style->stroke_width.computed), transform, + g_repr, xml_doc, doc ); + } } } |
