summaryrefslogtreecommitdiffstats
path: root/src/sp-shape.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2014-08-20 11:51:41 +0000
committertavmjong-free <tavmjong@free.fr>2014-08-20 11:51:41 +0000
commit8c009ccdce90c5198260e12ffac837bfdf9b26b7 (patch)
tree15d06a894e294814d86521f10d164b77390d62c5 /src/sp-shape.cpp
parentFix gtk3 build (diff)
downloadinkscape-8c009ccdce90c5198260e12ffac837bfdf9b26b7.tar.gz
inkscape-8c009ccdce90c5198260e12ffac837bfdf9b26b7.zip
Implement SVG2 marker 'orient' attribute value 'auto-start-reverse' (rendering only).
(bzr r13341.1.148)
Diffstat (limited to '')
-rw-r--r--src/sp-shape.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index de9103dee..d76bd9780 100644
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
@@ -288,8 +288,13 @@ sp_shape_update_marker_view(SPShape *shape, Inkscape::DrawingItem *ai)
Geom::Affine const m (sp_shape_marker_get_transform_at_start(pathv.begin()->front()));
for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START
if ( shape->_marker[i] ) {
+ Geom::Affine m_auto = m;
+ // Reverse start marker if necessary.
+ if (SP_MARKER(shape->_marker[i])->orient_mode == MARKER_ORIENT_AUTO_START_REVERSE) {
+ m_auto = Geom::Rotate::from_degrees( 180.0 ) * m;
+ }
sp_marker_show_instance ((SPMarker* ) shape->_marker[i], ai,
- ai->key() + i, counter[i], m,
+ ai->key() + i, counter[i], m_auto,
shape->style->stroke_width.computed);
counter[i]++;
}
@@ -425,7 +430,10 @@ Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox
if (marker_item) {
Geom::Affine tr(sp_shape_marker_get_transform_at_start(pathv.begin()->front()));
- if (!marker->orient_auto) {
+ if (marker->orient_mode == MARKER_ORIENT_AUTO_START_REVERSE) {
+ // Reverse start marker if necessary
+ tr = Geom::Rotate::from_degrees( 180.0 ) * tr;
+ } else if (marker->orient_mode == MARKER_ORIENT_ANGLE) {
Geom::Point transl = tr.translation();
tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl);
}
@@ -463,7 +471,7 @@ Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox
{
Geom::Affine tr(sp_shape_marker_get_transform_at_start(path_it->front()));
- if (!marker->orient_auto) {
+ if (marker->orient_mode == MARKER_ORIENT_ANGLE) {
Geom::Point transl = tr.translation();
tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl);
}
@@ -493,7 +501,7 @@ Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox
if (marker_item) {
Geom::Affine tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2));
- if (!marker->orient_auto) {
+ if (marker->orient_mode == MARKER_ORIENT_ANGLE) {
Geom::Point transl = tr.translation();
tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl);
}
@@ -516,7 +524,7 @@ Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox
Geom::Curve const &lastcurve = path_it->back_default();
Geom::Affine tr = sp_shape_marker_get_transform_at_end(lastcurve);
- if (!marker->orient_auto) {
+ if (marker->orient_mode == MARKER_ORIENT_ANGLE) {
Geom::Point transl = tr.translation();
tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl);
}
@@ -551,7 +559,7 @@ Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bbox
Geom::Affine tr = sp_shape_marker_get_transform_at_end(lastcurve);
- if (!marker->orient_auto) {
+ if (marker->orient_mode == MARKER_ORIENT_ANGLE) {
Geom::Point transl = tr.translation();
tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl);
}