diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2015-05-08 17:16:19 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2015-05-08 17:16:19 +0000 |
| commit | 1caee668eff9e8afe58a7592eb78908c96b530ba (patch) | |
| tree | 2bcfa0d5ce87eaf036f61420cd9beb1825c047d5 /src | |
| parent | cmake: Bring cmake installation in line with autotools (bug #1451481) (diff) | |
| download | inkscape-1caee668eff9e8afe58a7592eb78908c96b530ba.tar.gz inkscape-1caee668eff9e8afe58a7592eb78908c96b530ba.zip | |
fix for bug 168013 and its mask counterpart
Fixed bugs:
- https://launchpad.net/bugs/168013
(bzr r14129)
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp-use.cpp | 62 |
1 files changed, 59 insertions, 3 deletions
diff --git a/src/sp-use.cpp b/src/sp-use.cpp index 239f487a4..c8a0830c1 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -22,6 +22,8 @@ #include "display/drawing-group.h" #include "attributes.h" #include "document.h" +#include "sp-clippath.h" +#include "sp-mask.h" #include "sp-factory.h" #include "sp-flowregion.h" #include "uri.h" @@ -426,16 +428,43 @@ void SPUse::move_compensate(Geom::Affine const *mp) { return; Geom::Affine m(*mp); + Geom::Affine t = this->get_parent_transform(); + Geom::Affine clone_move = t.inverse() * m * t; // this is not a simple move, do not try to compensate - if (!(m.isTranslation())) + if (!(m.isTranslation())){ + //BUT move clippaths accordingly. + //if clone has a clippath, move it accordingly + if(clip_ref->getObject()){ + SPObject *clip = clip_ref->getObject()->firstChild() ; + while(clip){ + SPItem *item = (SPItem*) clip; + if(item){ + item->transform *= m; + Geom::Affine identity; + item->doWriteTransform(clip->getRepr(),item->transform, &identity); + } + clip = clip->getNext(); + } + } + if(mask_ref->getObject()){ + SPObject *mask = mask_ref->getObject()->firstChild() ; + while(mask){ + SPItem *item = (SPItem*) mask; + if(item){ + item->transform *= m; + Geom::Affine identity; + item->doWriteTransform(mask->getRepr(),item->transform, &identity); + } + mask = mask->getNext(); + } + } return; + } // restore item->transform field from the repr, in case it was changed by seltrans this->readAttr ("transform"); - Geom::Affine t = this->get_parent_transform(); - Geom::Affine clone_move = t.inverse() * m * t; // calculate the compensation matrix and the advertized movement matrix Geom::Affine advertized_move; @@ -449,6 +478,33 @@ void SPUse::move_compensate(Geom::Affine const *mp) { g_assert_not_reached(); } + //if clone has a clippath, move it accordingly + if(clip_ref->getObject()){ + SPObject *clip = clip_ref->getObject()->firstChild() ; + while(clip){ + SPItem *item = (SPItem*) clip; + if(item){ + item->transform *= clone_move.inverse(); + Geom::Affine identity; + item->doWriteTransform(clip->getRepr(),item->transform, &identity); + } + clip = clip->getNext(); + } + } + if(mask_ref->getObject()){ + SPObject *mask = mask_ref->getObject()->firstChild() ; + while(mask){ + SPItem *item = (SPItem*) mask; + if(item){ + item->transform *= clone_move.inverse(); + Geom::Affine identity; + item->doWriteTransform(mask->getRepr(),item->transform, &identity); + } + mask = mask->getNext(); + } + } + + // commit the compensation this->transform *= clone_move; this->doWriteTransform(this->getRepr(), this->transform, &advertized_move); |
