summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2018-10-01 13:43:39 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2018-10-01 13:43:39 +0000
commit5c3843e6bfa85baf9fc807dc169f571da444fda2 (patch)
tree1fc0bc19c7cf711d212f03489348d9488c080e62 /src
parentImprovements to transforms in LPE (diff)
downloadinkscape-5c3843e6bfa85baf9fc807dc169f571da444fda2.tar.gz
inkscape-5c3843e6bfa85baf9fc807dc169f571da444fda2.zip
Fix for bug #263620 comment 5,
Duplicating LPE path more like clone
Diffstat (limited to 'src')
-rw-r--r--src/object/sp-ellipse.cpp11
-rwxr-xr-xsrc/object/sp-lpe-item.cpp1
-rw-r--r--src/object/sp-path.cpp16
-rw-r--r--src/object/sp-spiral.cpp14
-rw-r--r--src/object/sp-star.cpp14
-rw-r--r--src/seltrans.cpp6
6 files changed, 18 insertions, 44 deletions
diff --git a/src/object/sp-ellipse.cpp b/src/object/sp-ellipse.cpp
index 97bad1fdf..08be94f6f 100644
--- a/src/object/sp-ellipse.cpp
+++ b/src/object/sp-ellipse.cpp
@@ -502,15 +502,13 @@ void SPGenericEllipse::set_shape()
Geom::Affine SPGenericEllipse::set_transform(Geom::Affine const &xform)
{
- // TODO: try to remove CLONE_ORIGINAL from here
- if (hasPathEffect() && pathEffectsEnabled() &&
- this->hasPathEffectOfType(Inkscape::LivePathEffect::CLONE_ORIGINAL ))
+ if (hasPathEffect() && pathEffectsEnabled())
{
- // if path has this LPE applied, don't write the transform to the pathdata, but write it 'unoptimized'
- // also if the effect is type BEND PATH to fix bug #179842
+ // Inverse it to compensate
this->adjust_livepatheffect(xform.inverse());
return xform;
}
+
/* Calculate ellipse start in parent coords. */
Geom::Point pos(Geom::Point(this->cx.computed, this->cy.computed) * xform);
@@ -559,9 +557,6 @@ Geom::Affine SPGenericEllipse::set_transform(Geom::Affine const &xform)
// Adjust gradient fill
this->adjust_gradient(xform * ret.inverse());
-
- // Adjust livepatheffect
- this->adjust_livepatheffect(xform);
return ret;
}
diff --git a/src/object/sp-lpe-item.cpp b/src/object/sp-lpe-item.cpp
index d543c5c4c..d11249d1f 100755
--- a/src/object/sp-lpe-item.cpp
+++ b/src/object/sp-lpe-item.cpp
@@ -187,7 +187,6 @@ Inkscape::XML::Node* SPLPEItem::write(Inkscape::XML::Document *xml_doc, Inkscape
return repr;
}
-
/**
* returns true when LPE was successful.
*/
diff --git a/src/object/sp-path.cpp b/src/object/sp-path.cpp
index d951d1738..558b3b72e 100644
--- a/src/object/sp-path.cpp
+++ b/src/object/sp-path.cpp
@@ -326,14 +326,13 @@ Geom::Affine SPPath::set_transform(Geom::Affine const &transform) {
if (!_curve) { // 0 nodes, nothing to transform
return Geom::identity();
}
- // Only set transform with proportional scaling
- if (!transform.withoutTranslation().isUniformScale()) {
- // Adjust livepatheffect
- if (hasPathEffect() && pathEffectsEnabled()) {
- this->adjust_livepatheffect(transform.inverse());
- return transform;
- }
+ if (hasPathEffect() && pathEffectsEnabled())
+ {
+ // Inverse it to compensate
+ this->adjust_livepatheffect(transform.inverse());
+ return transform;
}
+
// TODO: try to remove CLONE_ORIGINAL from here
// Transform the original-d path if this is a valid LPE this, other else the (ordinary) path
if (_curve_before_lpe && hasPathEffectRecursive()) {
@@ -358,9 +357,6 @@ Geom::Affine SPPath::set_transform(Geom::Affine const &transform) {
// Adjust gradient fill
this->adjust_gradient(transform);
- // Adjust LPE
- this->adjust_livepatheffect(transform);
-
// nothing remains - we've written all of the transform, so return identity
return Geom::identity();
}
diff --git a/src/object/sp-spiral.cpp b/src/object/sp-spiral.cpp
index a34e7c6d8..83455dbe4 100644
--- a/src/object/sp-spiral.cpp
+++ b/src/object/sp-spiral.cpp
@@ -408,21 +408,14 @@ void SPSpiral::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape
*/
Geom::Affine SPSpiral::set_transform(Geom::Affine const &xform)
{
- // TODO: try to remove CLONE_ORIGINAL from here
- if (hasPathEffect() && pathEffectsEnabled() &&
- this->hasPathEffectOfType(Inkscape::LivePathEffect::CLONE_ORIGINAL) )
+ if (hasPathEffect() && pathEffectsEnabled())
{
- // if path has this LPE applied, don't write the transform to the pathdata, but write it 'unoptimized'
- // also if the effect is type BEND PATH to fix bug #179842
+ // Inverse it to compensate
this->adjust_livepatheffect(xform.inverse());
return xform;
}
// Only set transform with proportional scaling
if (!xform.withoutTranslation().isUniformScale()) {
- // Adjust livepatheffect
- if (hasPathEffect() && pathEffectsEnabled()) {
- this->adjust_livepatheffect(xform);
- }
return xform;
}
@@ -463,9 +456,6 @@ Geom::Affine SPSpiral::set_transform(Geom::Affine const &xform)
// Adjust gradient fill
this->adjust_gradient(xform * ret.inverse());
- // Adjust livepatheffect
- this->adjust_livepatheffect(xform);
-
return ret;
}
diff --git a/src/object/sp-star.cpp b/src/object/sp-star.cpp
index a960d2018..b0c9a8197 100644
--- a/src/object/sp-star.cpp
+++ b/src/object/sp-star.cpp
@@ -494,21 +494,14 @@ void SPStar::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::
Geom::Affine SPStar::set_transform(Geom::Affine const &xform)
{
bool opt_trans = (randomized == 0);
- // TODO: try to remove CLONE_ORIGINAL from here
- if (hasPathEffect() && pathEffectsEnabled() &&
- this->hasPathEffectOfType(Inkscape::LivePathEffect::CLONE_ORIGINAL))
+ if (hasPathEffect() && pathEffectsEnabled())
{
- // if path has this LPE applied, don't write the transform to the pathdata, but write it 'unoptimized'
- // also if the effect is type BEND PATH to fix bug #179842
+ // Inverse it to compensate
this->adjust_livepatheffect(xform.inverse());
return xform;
}
// Only set transform with proportional scaling
if (!xform.withoutTranslation().isUniformScale()) {
- // Adjust livepatheffect
- if (hasPathEffect() && pathEffectsEnabled()) {
- this->adjust_livepatheffect(xform.inverse());
- }
return xform;
}
@@ -549,9 +542,6 @@ Geom::Affine SPStar::set_transform(Geom::Affine const &xform)
// Adjust gradient fill
this->adjust_gradient(xform * ret.inverse());
- // Adjust livepatheffect
- this->adjust_livepatheffect(xform);
-
return ret;
}
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index a970d50ab..8b33a9ee2 100644
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -572,8 +572,12 @@ void Inkscape::SelTrans::stamp()
if ( copy_item->isCenterSet() && _center ) {
copy_item->setCenter(*_center * _current_relative_affine);
}
-
Inkscape::GC::release(copy_repr);
+ SPLPEItem * lpeitem = dynamic_cast<SPLPEItem *>(copy_item);
+ if(lpeitem && lpeitem->hasPathEffectRecursive()) {
+ lpeitem->forkPathEffectsIfNecessary(1);
+ sp_lpe_item_update_patheffect(lpeitem, true, true);
+ }
}
DocumentUndo::done(_desktop->getDocument(), SP_VERB_CONTEXT_SELECT,
_("Stamp"));