summaryrefslogtreecommitdiffstats
path: root/src/sp-item.cpp
diff options
context:
space:
mode:
authorThomas Holder <speleo3@users.sourceforge.net>2008-12-16 15:52:36 +0000
committerspeleo3 <speleo3@users.sourceforge.net>2008-12-16 15:52:36 +0000
commit4fc3975983c401a7fb95084ab2db10d609e36f05 (patch)
treeaab43b87dcf998923b3d7b1c21b2c5dfa4e15f17 /src/sp-item.cpp
parentAdded "Add" button to the SVG Fonts dialog. (diff)
downloadinkscape-4fc3975983c401a7fb95084ab2db10d609e36f05.tar.gz
inkscape-4fc3975983c401a7fb95084ab2db10d609e36f05.zip
* remove sp_item_i2root_affine and sp_item_i2r_affine and replace all calls by
sp_item_i2doc_affine or sp_item_i2d_affine respectively * remove sp_root_bbox, root->c2p was considered in the wrong place there * in sp_item_i2doc_affine do not consider SP_ITEM(object)->transform for root node, because <svg> node does not have a transform attribute * fix style scaling for boolean operations (with viewBox) * fix zoom to fit drawing (with viewBox) * fix export area size for "export drawing" (with viewBox) * fix simultaneous movement of clone + original (with viewBox) (bzr r7010)
Diffstat (limited to 'src/sp-item.cpp')
-rw-r--r--src/sp-item.cpp42
1 files changed, 6 insertions, 36 deletions
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 78561de1b..519ed2a45 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -1515,8 +1515,9 @@ i2anc_affine(SPObject const *object, SPObject const *const ancestor) {
while ( object != ancestor && SP_IS_ITEM(object) ) {
if (SP_IS_ROOT(object)) {
ret *= SP_ROOT(object)->c2p;
+ } else {
+ ret *= SP_ITEM(object)->transform;
}
- ret *= SP_ITEM(object)->transform;
object = SP_OBJECT_PARENT(object);
}
return ret;
@@ -1543,30 +1544,8 @@ Geom::Matrix sp_item_i2doc_affine(SPItem const *item)
}
/**
- * Returns the accumulated transformation of the item and all its ancestors, but excluding root's viewport.
- * Used in path operations mostly.
- * \pre (item != NULL) and SP_IS_ITEM(item).
+ * Returns the transformation from item to desktop coords
*/
-Geom::Matrix sp_item_i2root_affine(SPItem const *item)
-{
- g_assert(item != NULL);
- g_assert(SP_IS_ITEM(item));
-
- Geom::Matrix ret(Geom::identity());
- g_assert(ret.isIdentity());
- while ( NULL != SP_OBJECT_PARENT(item) ) {
- ret *= item->transform;
- item = SP_ITEM(SP_OBJECT_PARENT(item));
- }
- g_assert(SP_IS_ROOT(item));
-
- ret *= item->transform;
-
- return ret;
-}
-
-/* fixme: This is EVIL!!! */
-// fix this note: why/what evil? :)
Geom::Matrix sp_item_i2d_affine(SPItem const *item)
{
g_assert(item != NULL);
@@ -1578,18 +1557,6 @@ Geom::Matrix sp_item_i2d_affine(SPItem const *item)
return ret;
}
-// same as i2d but with i2root instead of i2doc
-Geom::Matrix sp_item_i2r_affine(SPItem const *item)
-{
- g_assert(item != NULL);
- g_assert(SP_IS_ITEM(item));
-
- Geom::Matrix const ret( sp_item_i2root_affine(item)
- * Geom::Scale(1, -1)
- * Geom::Translate(0, sp_document_height(SP_OBJECT_DOCUMENT(item))) );
- return ret;
-}
-
/**
* Converts a matrix \a m into the desktop coords of the \a item.
* Will become a noop when we eliminate the coordinate flipping.
@@ -1632,6 +1599,9 @@ void sp_item_set_i2d_affine(SPItem *item, Geom::Matrix const &i2dt)
}
+/**
+ * should rather be named "sp_item_d2i_affine" to match "sp_item_i2d_affine" (or vice versa)
+ */
Geom::Matrix
sp_item_dt2i_affine(SPItem const *item)
{