summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2015-05-08 17:16:19 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2015-05-08 17:16:19 +0000
commit1caee668eff9e8afe58a7592eb78908c96b530ba (patch)
tree2bcfa0d5ce87eaf036f61420cd9beb1825c047d5 /src
parentcmake: Bring cmake installation in line with autotools (bug #1451481) (diff)
downloadinkscape-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.cpp62
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);