summaryrefslogtreecommitdiffstats
path: root/src
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
parentupdate to trunk (diff)
downloadinkscape-18619e3328e070c5d59f12c4d19fa09713fc4700.tar.gz
inkscape-18619e3328e070c5d59f12c4d19fa09713fc4700.zip
Handling hide
(bzr r15706)
Diffstat (limited to 'src')
-rw-r--r--src/display/drawing-item.h2
-rw-r--r--src/live_effects/lpe-powerclip.cpp46
-rw-r--r--src/sp-clippath.cpp10
3 files changed, 39 insertions, 19 deletions
diff --git a/src/display/drawing-item.h b/src/display/drawing-item.h
index 21f6ffacc..1df60d783 100644
--- a/src/display/drawing-item.h
+++ b/src/display/drawing-item.h
@@ -120,7 +120,9 @@ public:
void setBlendMode(unsigned blend_mode);
void setTransform(Geom::Affine const &trans);
void setClip(DrawingItem *item);
+ DrawingItem * getClip(){ return _clip;}
void setMask(DrawingItem *item);
+ DrawingItem * getMask(){ return _mask;}
void setFillPattern(DrawingPattern *pattern);
void setStrokePattern(DrawingPattern *pattern);
void setZOrder(unsigned z);
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);
diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp
index b371e15b2..16b769d53 100644
--- a/src/sp-clippath.cpp
+++ b/src/sp-clippath.cpp
@@ -35,7 +35,6 @@ struct SPClipPathView {
Inkscape::DrawingItem *arenaitem;
Geom::OptRect bbox;
};
-
static SPClipPathView* sp_clippath_view_new_prepend(SPClipPathView *list, unsigned int key, Inkscape::DrawingItem *arenaitem);
static SPClipPathView* sp_clippath_view_list_remove(SPClipPathView *list, SPClipPathView *view);
@@ -227,15 +226,20 @@ void SPClipPath::hide(unsigned int key) {
SP_ITEM(&child)->invoke_hide(key);
}
}
-
+ bool is_hided = false;
for (SPClipPathView *v = display; v != NULL; v = v->next) {
+ if (!v->arenaitem->getClip()) {
+ is_hided = true;
+ }
if (v->key == key) {
/* We simply unref and let item to manage this in handler */
display = sp_clippath_view_list_remove(display, v);
return;
}
}
-
+ if (is_hided) {
+ return;
+ }
g_assert_not_reached();
}