summaryrefslogtreecommitdiffstats
path: root/src/object
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2018-04-23 21:34:58 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2018-04-23 21:37:56 +0000
commite254e5c6ced93403c125592237b43215bde7b0ff (patch)
tree765903f16cd02454f1c63f421e0ce2f299dacc55 /src/object
parentFix warings on updates (diff)
downloadinkscape-e254e5c6ced93403c125592237b43215bde7b0ff.tar.gz
inkscape-e254e5c6ced93403c125592237b43215bde7b0ff.zip
Fixing LPE recalculations warnings on update
Diffstat (limited to 'src/object')
-rw-r--r--src/object/box3d-side.cpp7
-rw-r--r--src/object/sp-ellipse.cpp12
-rw-r--r--src/object/sp-item.cpp2
-rw-r--r--src/object/sp-lpe-item.cpp6
-rw-r--r--src/object/sp-path.cpp2
-rw-r--r--src/object/sp-shape.cpp3
-rw-r--r--src/object/sp-spiral.cpp18
-rw-r--r--src/object/sp-star.cpp30
8 files changed, 64 insertions, 16 deletions
diff --git a/src/object/box3d-side.cpp b/src/object/box3d-side.cpp
index c88c7a7b9..b6b9bbbf7 100644
--- a/src/object/box3d-side.cpp
+++ b/src/object/box3d-side.cpp
@@ -196,7 +196,12 @@ void Box3DSide::set_shape() {
* This is very important for LPEs to work properly! (the bbox might be recalculated depending on the curve in shape)*/
SPCurve * before = this->getCurveBeforeLPE();
if (before || this->hasPathEffectRecursive()) {
- this->setCurveBeforeLPE(c);
+ if (c && before && before->get_pathvector() != c->get_pathvector()){
+ this->setCurveBeforeLPE(c);
+ sp_lpe_item_update_patheffect(this, true, false);
+ } else {
+ this->setCurveBeforeLPE(c);
+ }
} else {
this->setCurveInsync(c);
}
diff --git a/src/object/sp-ellipse.cpp b/src/object/sp-ellipse.cpp
index 76145c603..74ade912c 100644
--- a/src/object/sp-ellipse.cpp
+++ b/src/object/sp-ellipse.cpp
@@ -481,10 +481,16 @@ void SPGenericEllipse::set_shape()
* This is very important for LPEs to work properly! (the bbox might be recalculated depending on the curve in shape)*/
SPCurve * before = this->getCurveBeforeLPE();
if (before || this->hasPathEffectRecursive()) {
- this->setCurveBeforeLPE(c);
+ if (c && before && before->get_pathvector() != c->get_pathvector()){
+ this->setCurveBeforeLPE(c);
+ sp_lpe_item_update_patheffect(this, true, false);
+ } else {
+ this->setCurveBeforeLPE(c);
+ }
} else {
this->setCurveInsync(c);
}
+
if (before) {
before->unref();
}
@@ -555,7 +561,7 @@ Geom::Affine SPGenericEllipse::set_transform(Geom::Affine const &xform)
// Adjust livepatheffect
this->adjust_livepatheffect(xform);
-
+
return ret;
}
@@ -650,7 +656,7 @@ bool SPGenericEllipse::set_elliptical_path_attribute(Inkscape::XML::Node *repr)
// Make sure our pathvector is up to date.
this->set_shape();
- if (_curve != NULL) {
+ if (_curve) {
gchar* d = sp_svg_write_path(_curve->get_pathvector());
repr->setAttribute("d", d);
diff --git a/src/object/sp-item.cpp b/src/object/sp-item.cpp
index accf110ad..5ca22cabd 100644
--- a/src/object/sp-item.cpp
+++ b/src/object/sp-item.cpp
@@ -1542,7 +1542,7 @@ void SPItem::doWriteTransform(Geom::Affine const &transform, Geom::Affine const
updateRepr();
if (lpeitem && lpeitem->hasPathEffectRecursive()) {
- sp_lpe_item_update_patheffect(lpeitem, false, false);
+ sp_lpe_item_update_patheffect(lpeitem, true, false);
}
// send the relative transform with a _transformed_signal
diff --git a/src/object/sp-lpe-item.cpp b/src/object/sp-lpe-item.cpp
index 7b90319ab..27ea45ca6 100644
--- a/src/object/sp-lpe-item.cpp
+++ b/src/object/sp-lpe-item.cpp
@@ -171,9 +171,9 @@ void SPLPEItem::update(SPCtx* ctx, unsigned int flags) {
void SPLPEItem::modified(unsigned int flags) {
//stop update when modified and make the effect update on the LPE transform method if the effect require it
- if (SP_IS_GROUP(this) && (flags & SP_OBJECT_MODIFIED_FLAG) && (flags & SP_OBJECT_USER_MODIFIED_FLAG_B)) {
- this->update_patheffect(false);
- }
+ //if (SP_IS_GROUP(this) && (flags & SP_OBJECT_MODIFIED_FLAG) && (flags & SP_OBJECT_USER_MODIFIED_FLAG_B)) {
+ // sp_lpe_item_update_patheffect(this, true, false);
+ //}
}
Inkscape::XML::Node* SPLPEItem::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
diff --git a/src/object/sp-path.cpp b/src/object/sp-path.cpp
index 4d1f1311f..de31b45e2 100644
--- a/src/object/sp-path.cpp
+++ b/src/object/sp-path.cpp
@@ -280,7 +280,7 @@ Inkscape::XML::Node* SPPath::write(Inkscape::XML::Document *xml_doc, Inkscape::X
g_message("sp_path_write writes 'd' attribute");
#endif
- if ( this->_curve != NULL ) {
+ if (this->_curve) {
gchar *str = sp_svg_write_path(this->_curve->get_pathvector());
repr->setAttribute("d", str);
g_free(str);
diff --git a/src/object/sp-shape.cpp b/src/object/sp-shape.cpp
index df8a200d0..1708ecfb3 100644
--- a/src/object/sp-shape.cpp
+++ b/src/object/sp-shape.cpp
@@ -412,6 +412,9 @@ void SPShape::modified(unsigned int flags) {
}
}
}
+ if (!this->getCurve()) {
+ sp_lpe_item_update_patheffect(this, true, false);
+ }
}
Geom::OptRect SPShape::bbox(Geom::Affine const &transform, SPItem::BBoxType bboxtype) const {
diff --git a/src/object/sp-spiral.cpp b/src/object/sp-spiral.cpp
index 40abff7d7..e17ddb10d 100644
--- a/src/object/sp-spiral.cpp
+++ b/src/object/sp-spiral.cpp
@@ -349,7 +349,12 @@ void SPSpiral::set_shape() {
* This is very important for LPEs to work properly! (the bbox might be recalculated depending on the curve in shape)*/
SPCurve * before = this->getCurveBeforeLPE();
if (before || this->hasPathEffectRecursive()) {
- this->setCurveBeforeLPE(c);
+ if (c && before && before->get_pathvector() != c->get_pathvector()){
+ this->setCurveBeforeLPE(c);
+ sp_lpe_item_update_patheffect(this, true, false);
+ } else {
+ this->setCurveBeforeLPE(c);
+ }
} else {
this->setCurveInsync(c);
}
@@ -400,6 +405,17 @@ void SPSpiral::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape
*/
Geom::Affine SPSpiral::set_transform(Geom::Affine const &xform)
{
+ if (hasPathEffect() && pathEffectsEnabled() &&
+ (this->hasPathEffectOfType(Inkscape::LivePathEffect::CLONE_ORIGINAL) ||
+ this->hasPathEffectOfType(Inkscape::LivePathEffect::BEND_PATH) ||
+ this->hasPathEffectOfType(Inkscape::LivePathEffect::FILL_BETWEEN_MANY) ||
+ this->hasPathEffectOfType(Inkscape::LivePathEffect::FILL_BETWEEN_STROKES) ) )
+ {
+ // 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
+ this->adjust_livepatheffect(xform);
+ return xform;
+ }
// Only set transform with proportional scaling
if (!xform.withoutTranslation().isUniformScale()) {
// Adjust livepatheffect
diff --git a/src/object/sp-star.cpp b/src/object/sp-star.cpp
index 1be7651f8..da00080a3 100644
--- a/src/object/sp-star.cpp
+++ b/src/object/sp-star.cpp
@@ -82,11 +82,13 @@ Inkscape::XML::Node* SPStar::write(Inkscape::XML::Document *xml_doc, Inkscape::X
}
this->set_shape();
-
- char *d = sp_svg_write_path (this->_curve->get_pathvector());
- repr->setAttribute("d", d);
- g_free(d);
-
+ if (this->_curve) {
+ char *d = sp_svg_write_path (this->_curve->get_pathvector());
+ repr->setAttribute("d", d);
+ g_free(d);
+ } else {
+ repr->setAttribute("d", NULL);
+ }
// CPPIFY: see header file
SPShape::write(xml_doc, repr, flags);
@@ -432,7 +434,12 @@ void SPStar::set_shape() {
* This is very important for LPEs to work properly! (the bbox might be recalculated depending on the curve in shape)*/
SPCurve * before = this->getCurveBeforeLPE();
if (before || this->hasPathEffectRecursive()) {
- this->setCurveBeforeLPE(c);
+ if (c && before && before->get_pathvector() != c->get_pathvector()){
+ this->setCurveBeforeLPE(c);
+ sp_lpe_item_update_patheffect(this, true, false);
+ } else {
+ this->setCurveBeforeLPE(c);
+ }
} else {
this->setCurveInsync(c);
}
@@ -484,6 +491,17 @@ void SPStar::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::
Geom::Affine SPStar::set_transform(Geom::Affine const &xform)
{
bool opt_trans = (randomized == 0);
+ if (hasPathEffect() && pathEffectsEnabled() &&
+ (this->hasPathEffectOfType(Inkscape::LivePathEffect::CLONE_ORIGINAL) ||
+ this->hasPathEffectOfType(Inkscape::LivePathEffect::BEND_PATH) ||
+ this->hasPathEffectOfType(Inkscape::LivePathEffect::FILL_BETWEEN_MANY) ||
+ this->hasPathEffectOfType(Inkscape::LivePathEffect::FILL_BETWEEN_STROKES) ) )
+ {
+ // 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
+ this->adjust_livepatheffect(xform);
+ return xform;
+ }
// Only set transform with proportional scaling
if (!xform.withoutTranslation().isUniformScale()) {
// Adjust livepatheffect