diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2014-09-08 20:49:35 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2014-09-08 20:49:35 +0000 |
| commit | 4f1261cd9c848a54ccbc16b48494f210e401e6a4 (patch) | |
| tree | d96ba9bbe2b3489a79a064467b2b385ea5f9ace2 /src | |
| parent | osx-build.sh: update creation of info file (more packages, include license an... (diff) | |
| parent | partial rollback of r13544, allow old recursive behavior for some locations, ... (diff) | |
| download | inkscape-4f1261cd9c848a54ccbc16b48494f210e401e6a4.tar.gz inkscape-4f1261cd9c848a54ccbc16b48494f210e401e6a4.zip | |
update to trunk (r13549)
(bzr r13506.1.79)
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/internal/metafile-inout.cpp | 2 | ||||
| -rw-r--r-- | src/sp-item-group.cpp | 49 | ||||
| -rw-r--r-- | src/sp-item-group.h | 2 | ||||
| -rw-r--r-- | src/ui/dialog/document-properties.cpp | 3 |
4 files changed, 33 insertions, 23 deletions
diff --git a/src/extension/internal/metafile-inout.cpp b/src/extension/internal/metafile-inout.cpp index 162ad8b7d..28e9932b3 100644 --- a/src/extension/internal/metafile-inout.cpp +++ b/src/extension/internal/metafile-inout.cpp @@ -222,7 +222,7 @@ void Metafile::setViewBoxIfMissing(SPDocument *doc) { prefs->setBool("/options/transform/pattern", true); prefs->setBool("/options/transform/gradient", true); - doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, dh)); + doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, dh), true); ShapeEditor::blockSetItem(false); // restore options diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 3d03edd85..5936cfbe5 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -644,32 +644,41 @@ void SPGroup::translateChildItems(Geom::Translate const &tr) } } -// Recursively scale child items around a point -void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p) +// Recursively (or not) scale child items around a point +void SPGroup::scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bool noRecurse) { if ( hasChildren() ) { for (SPObject *o = firstChild() ; o ; o = o->getNext() ) { if ( SP_IS_ITEM(o) ) { if (SP_IS_GROUP(o) && !SP_IS_BOX3D(o)) { - // Doing it this way breaks clipping because transforms are applied - // in coordinates for draws but nothing in defs is changed - // SP_GROUP(o)->scaleChildItemsRec(sc, p); - // instead change the transform on the entire group, and the transform - // is applied after any references to clipping paths. - SPItem *item = SP_ITEM(o); - Geom::Translate const s(p); - Geom::Affine final = s.inverse() * sc * s; - Geom::Affine tAff = item->i2dt_affine() * final; - item->set_i2d_affine(tAff); - tAff = item->transform; - // Eliminate common rounding error affecting EMF/WMF input. - // When the rounding error persists it converts the simple - // transform=scale() to transform=matrix(). - if(std::abs(tAff[4]) < 1.0e-5 && std::abs(tAff[5]) < 1.0e-5){ - tAff[4] = 0.0; - tAff[5] = 0.0; + /* Using recursion breaks clipping because transforms are applied + in coordinates for draws but nothing in defs is changed + instead change the transform on the entire group, and the transform + is applied after any references to clipping paths. However NOT using + recursion apparently breaks as of r13544 other parts of Inkscape + involved with showing/modifying units. So offer both for use + in different contexts. + */ + if(noRecurse) { + // used for EMF import + SPItem *item = SP_ITEM(o); + Geom::Translate const s(p); + Geom::Affine final = s.inverse() * sc * s; + Geom::Affine tAff = item->i2dt_affine() * final; + item->set_i2d_affine(tAff); + tAff = item->transform; + // Eliminate common rounding error affecting EMF/WMF input. + // When the rounding error persists it converts the simple + // transform=scale() to transform=matrix(). + if(std::abs(tAff[4]) < 1.0e-5 && std::abs(tAff[5]) < 1.0e-5){ + tAff[4] = 0.0; + tAff[5] = 0.0; + } + item->doWriteTransform(item->getRepr(), tAff, NULL, true); + } else { + // used for other import + SP_GROUP(o)->scaleChildItemsRec(sc, p, false); } - item->doWriteTransform(item->getRepr(), tAff, NULL, true); } else { SPItem *item = SP_ITEM(o); Geom::OptRect bbox = item->desktopVisualBounds(); diff --git a/src/sp-item-group.h b/src/sp-item-group.h index 2004a72b8..dd1e9317a 100644 --- a/src/sp-item-group.h +++ b/src/sp-item-group.h @@ -52,7 +52,7 @@ public: LayerMode layerDisplayMode(unsigned int display_key) const; void setLayerDisplayMode(unsigned int display_key, LayerMode mode); void translateChildItems(Geom::Translate const &tr); - void scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p); + void scaleChildItemsRec(Geom::Scale const &sc, Geom::Point const &p, bool noRecurse); gint getItemCount() const; virtual void _showChildren (Inkscape::Drawing &drawing, Inkscape::DrawingItem *ai, unsigned int key, unsigned int flags); diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 2757a0ec9..1f220b246 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1747,7 +1747,8 @@ void DocumentProperties::onDocUnitChange() doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(-viewscale*doc->getRoot()->viewBox.min()[Geom::X] + (doc->getWidth().value("px") - viewscale*doc->getRoot()->viewBox.width())/2, viewscale*doc->getRoot()->viewBox.min()[Geom::Y] + - (doc->getHeight().value("px") + viewscale*doc->getRoot()->viewBox.height())/2)); + (doc->getHeight().value("px") + viewscale*doc->getRoot()->viewBox.height())/2), + false); ShapeEditor::blockSetItem(false); } prefs->setBool("/options/transform/stroke", transform_stroke); |
