summaryrefslogtreecommitdiffstats
path: root/src/sp-item-group.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2006-10-24 05:13:40 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2006-10-24 05:13:40 +0000
commit9b2e553d11a612a8027b27ee2ab31ac477cf4e44 (patch)
tree670f37efa7d71391c45f01f77787e127ebd3ee7d /src/sp-item-group.cpp
parentenable copy/paste of objects with filters (diff)
downloadinkscape-9b2e553d11a612a8027b27ee2ab31ac477cf4e44.tar.gz
inkscape-9b2e553d11a612a8027b27ee2ab31ac477cf4e44.zip
fix 1520018: sync up the embed/not embed transform logic when ungrouping with that used in sp_item_write_transform, so as to not embed e.g. for clipped/masked objects
(bzr r1853)
Diffstat (limited to 'src/sp-item-group.cpp')
-rw-r--r--src/sp-item-group.cpp46
1 files changed, 32 insertions, 14 deletions
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index 422d033ca..d9f0e6f3d 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -28,10 +28,11 @@
#include "style.h"
#include "attributes.h"
#include "sp-item-transform.h"
-
#include "sp-root.h"
#include "sp-use.h"
#include "prefs-utils.h"
+#include "sp-clippath.h"
+#include "sp-mask.h"
static void sp_group_class_init (SPGroupClass *klass);
static void sp_group_init (SPGroup *group);
@@ -425,21 +426,27 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done)
repr->setPosition(pos > 0 ? pos : 0);
// fill in the children list if non-null
- SPItem *nitem = (SPItem *) doc->getObjectByRepr(repr);
-
- /* Optimize the transform matrix if requested. */
- // No compensations are required because this is supposed to be a non-transformation visually.
- if (!preserve) {
- NR::Matrix (*set_transform)(SPItem *, NR::Matrix const &) = ((SPItemClass *) G_OBJECT_GET_CLASS(nitem))->set_transform;
- if (set_transform) {
- sp_item_set_item_transform(nitem, set_transform(nitem, nitem->transform));
- nitem->updateRepr();
- }
- }
+ SPItem *item = (SPItem *) doc->getObjectByRepr(repr);
+
+ /* Optimize the transform matrix if requested. */
+ // No compensations are required because this is supposed to be a non-transformation visually.
+ // FIXME: this if is wholly lifted from sp_item_write_transform and should stay in sync
+ NR::Matrix transform_attr (item->transform);
+ if ( // run the object's set_transform (i.e. embed transform) only if:
+ ((SPItemClass *) G_OBJECT_GET_CLASS(item))->set_transform && // it does have a set_transform method
+ !preserve && // user did not chose to preserve all transforms
+ !item->clip_ref->getObject() && // the object does not have a clippath
+ !item->mask_ref->getObject() && // the object does not have a mask
+ !(!transform_attr.is_translation() && SP_OBJECT_STYLE(item) && SP_OBJECT_STYLE(item)->filter.filter)
+ // the object does not have a filter, or the transform is translation (which is supposed to not affect filters)
+ ) {
+ transform_attr = ((SPItemClass *) G_OBJECT_GET_CLASS(item))->set_transform(item, item->transform);
+ }
+ sp_item_set_item_transform(item, transform_attr);
Inkscape::GC::release(repr);
- if (children && SP_IS_ITEM (nitem))
- *children = g_slist_prepend (*children, nitem);
+ if (children && SP_IS_ITEM (item))
+ *children = g_slist_prepend (*children, item);
items = g_slist_remove (items, items->data);
}
@@ -761,3 +768,14 @@ void CGroup::onOrderChanged (Inkscape::XML::Node *child, Inkscape::XML::Node *,
_group->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :