summaryrefslogtreecommitdiffstats
path: root/src/sp-use.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2015-05-22 07:02:44 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2015-05-22 07:02:44 +0000
commit35d94a8e1c01cd60e4fcf4c15f46fee38c765fca (patch)
treed8366acd729a6a9d4bdc1001f050a43f30d8b7ad /src/sp-use.cpp
parentUndo changes to CMakeLists.txt in 2geom directory after syncs (diff)
parentminor tweaks to libUEMF and related code (diff)
downloadinkscape-35d94a8e1c01cd60e4fcf4c15f46fee38c765fca.tar.gz
inkscape-35d94a8e1c01cd60e4fcf4c15f46fee38c765fca.zip
Merge from trunk
(bzr r14059.2.15)
Diffstat (limited to 'src/sp-use.cpp')
-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);