From: buliabyak Date: Tue, 24 Oct 2006 05:13:40 +0000 (+0000) Subject: fix 1520018: sync up the embed/not embed transform logic when ungrouping with that... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7150f0829e7f5452f5cab605b8014a245f9b7e7c;p=inkscape.git 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 --- 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 :