summaryrefslogtreecommitdiffstats
path: root/src/live_effects
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2018-09-28 22:45:49 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2018-09-28 22:45:49 +0000
commit6d3682c7c8daacee95364d5d80a4490786235a45 (patch)
treeb4149058bc1d69fbf8cd3f7b02cd21d4aa2e904e /src/live_effects
parentfix 1789208 poppler 0.69 (diff)
downloadinkscape-6d3682c7c8daacee95364d5d80a4490786235a45.tar.gz
inkscape-6d3682c7c8daacee95364d5d80a4490786235a45.zip
Fix bug #1791696: PowerClip: Using a group as a clip doesn't work as expected
Diffstat (limited to 'src/live_effects')
-rw-r--r--src/live_effects/lpe-powerclip.cpp16
-rw-r--r--src/live_effects/lpe-powerclip.h2
2 files changed, 8 insertions, 10 deletions
diff --git a/src/live_effects/lpe-powerclip.cpp b/src/live_effects/lpe-powerclip.cpp
index 494c6d8a4..c27824938 100644
--- a/src/live_effects/lpe-powerclip.cpp
+++ b/src/live_effects/lpe-powerclip.cpp
@@ -109,7 +109,7 @@ LPEPowerClip::doBeforeEffect (SPLPEItem const* lpeitem){
gchar * is_inverse_str = is_inverse.param_getSVGValue();
if(!strcmp(is_inverse_str,"false") && inverse && isVisible()) {
SPCurve * clipcurve = new SPCurve();
- addInverse(SP_ITEM(clip_data), clipcurve, true);
+ addInverse(SP_ITEM(clip_data), clipcurve, Geom::Affine::identity(), true);
} else if((!strcmp(is_inverse_str,"true") && !inverse && isVisible()) ||
(inverse && !is_visible && is_inverse_str == (Glib::ustring)"true"))
{
@@ -133,7 +133,7 @@ LPEPowerClip::doAfterEffect (SPLPEItem const* lpeitem){
}
void
-LPEPowerClip::addInverse (SPItem * clip_data, SPCurve * clipcurve, bool root){
+LPEPowerClip::addInverse (SPItem * clip_data, SPCurve * clipcurve, Geom::Affine affine, bool root){
gchar * is_inverse_str = is_inverse.param_getSVGValue();
SPDocument * document = SP_ACTIVE_DOCUMENT;
if (!document) {
@@ -142,10 +142,7 @@ LPEPowerClip::addInverse (SPItem * clip_data, SPCurve * clipcurve, bool root){
SPObject *elemref = NULL;
if(root) {
Inkscape::XML::Document *xml_doc = document->getReprDoc();
- if (!SP_IS_SHAPE(clip_data)) {
- return;
- }
- SP_SHAPE(clip_data)->removeAllPathEffects(true);
+ SP_LPE_ITEM(clip_data)->removeAllPathEffects(true);
Inkscape::XML::Node *clip_path_node = xml_doc->createElement("svg:path");
Inkscape::XML::Node *parent = clip_data->getRepr()->parent();
parent->appendChild(clip_path_node);
@@ -158,15 +155,16 @@ LPEPowerClip::addInverse (SPItem * clip_data, SPCurve * clipcurve, bool root){
std::vector<SPItem*> item_list = sp_item_group_item_list(SP_GROUP(clip_data));
for ( std::vector<SPItem*>::const_iterator iter=item_list.begin();iter!=item_list.end();++iter) {
SPItem *subitem = *iter;
- addInverse(subitem, clipcurve, false);
+ Geom::Affine affine_group = SP_ITEM(clip_data)->transform;
+ addInverse(subitem, clipcurve, affine_group, false);
if (root) {
- Geom::Affine affine = SP_ITEM(clip_data)->transform;
- clip_box *= affine;
+ clip_box *= affine_group;
}
}
} else if (SP_IS_SHAPE(clip_data)) {
SPCurve * c = nullptr;
c = SP_SHAPE(clip_data)->getCurve();
+ c->transform(affine);
if (c) {
Geom::PathVector c_pv = c->get_pathvector();
//TODO: this can be not correct but no better way
diff --git a/src/live_effects/lpe-powerclip.h b/src/live_effects/lpe-powerclip.h
index 6fc85cbab..c79932b84 100644
--- a/src/live_effects/lpe-powerclip.h
+++ b/src/live_effects/lpe-powerclip.h
@@ -24,7 +24,7 @@ public:
void doOnRemove (SPLPEItem const* /*lpeitem*/) override;
void doOnVisibilityToggled(SPLPEItem const* lpeitem) override;
void doAfterEffect (SPLPEItem const* lpeitem) override;
- void addInverse (SPItem * clip_data, SPCurve * clipcurve, bool root);
+ void addInverse (SPItem * clip_data, SPCurve * clipcurve, Geom::Affine affine, bool root);
void updateInverse (SPItem * clip_data);
void removeInverse (SPItem * clip_data);
void flattenClip(SPItem * clip_data, Geom::PathVector &path_in);