summaryrefslogtreecommitdiffstats
path: root/src/live_effects
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2017-05-29 02:23:48 +0000
committerJabiertxof <jtx@jtx>2017-05-29 02:23:48 +0000
commit18619e3328e070c5d59f12c4d19fa09713fc4700 (patch)
treef1575b0048c4a138719ea9210a054babae609d56 /src/live_effects
parentupdate to trunk (diff)
downloadinkscape-18619e3328e070c5d59f12c4d19fa09713fc4700.tar.gz
inkscape-18619e3328e070c5d59f12c4d19fa09713fc4700.zip
Handling hide
(bzr r15706)
Diffstat (limited to 'src/live_effects')
-rw-r--r--src/live_effects/lpe-powerclip.cpp46
1 files changed, 30 insertions, 16 deletions
diff --git a/src/live_effects/lpe-powerclip.cpp b/src/live_effects/lpe-powerclip.cpp
index a3a827ec4..275acef1e 100644
--- a/src/live_effects/lpe-powerclip.cpp
+++ b/src/live_effects/lpe-powerclip.cpp
@@ -17,6 +17,14 @@
// TODO due to internal breakage in glibmm headers, this must be last:
#include <glibmm/i18n.h>
+// FIXME: expose these from sp-clippath/mask.cpp
+struct SPClipPathView {
+ SPClipPathView *next;
+ unsigned int key;
+ Inkscape::DrawingItem *arenaitem;
+ Geom::OptRect bbox;
+};
+
namespace Inkscape {
namespace LivePathEffect {
@@ -48,28 +56,34 @@ LPEPowerClip::doBeforeEffect (SPLPEItem const* lpeitem){
const Glib::ustring uri = (Glib::ustring)sp_lpe_item->getRepr()->attribute("clip-path");
SPClipPath *clip_path = SP_ITEM(lpeitem)->clip_ref->getObject();
SPItem * item = SP_ITEM(lpeitem);
- if(hide_clip) {
+ bool update_lpe = false;
+ if(clip_path && hide_clip) {
SPItemView *v;
for (v = item->display; v != NULL; v = v->next) {
- clip_path->hide(v->arenaitem->key());
+ if (clip_path->display->arenaitem && clip_path->display->arenaitem->visible()) {
+ clip_path->hide(v->arenaitem->key());
+ update_lpe = true;
+ }
}
- Geom::OptRect bbox = item->geometricBounds();
- clip_path->setBBox(v->arenaitem->key(), bbox);
- item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
- } else if (!hide_clip) {
+ } else if (clip_path && !hide_clip) {
Geom::OptRect bbox = item->geometricBounds();
for (SPItemView *v = item->display; v != NULL; v = v->next) {
- if (!v->arenaitem->key()) {
- v->arenaitem->setKey(SPItem::display_key_new(3));
- }
- Inkscape::DrawingItem *ai = clip_path->show(
- v->arenaitem->drawing(),
- v->arenaitem->key());
- v->arenaitem->setClip(ai);
- clip_path->setBBox(v->arenaitem->key(), bbox);
- clip_path->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+ if (!clip_path->display->arenaitem->key()) {
+ v->arenaitem->setKey(SPItem::display_key_new(3));
+ }
+ if (clip_path->display->arenaitem && !clip_path->display->arenaitem->visible()) {
+ Inkscape::DrawingItem *ai = clip_path->show(
+ v->arenaitem->drawing(),
+ v->arenaitem->key());
+ v->arenaitem->setClip(ai);
+ clip_path->setBBox(v->arenaitem->key(), bbox);
+ update_lpe = true;
+ }
}
- item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+ }
+ if (update_lpe) {
+ clip_path->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+ sp_lpe_item_update_patheffect(sp_lpe_item, true, true);
}
Geom::Point topleft = Geom::Point(boundingbox_X.min() - 5,boundingbox_Y.max() + 5);
Geom::Point topright = Geom::Point(boundingbox_X.max() + 5,boundingbox_Y.max() + 5);