diff options
| author | Martin Owens <doctormo@gmail.com> | 2014-02-28 15:50:05 +0000 |
|---|---|---|
| committer | Martin Owens <doctormo@gmail.com> | 2014-02-28 15:50:05 +0000 |
| commit | 1bc1b442d8ec6f394f456c4675d5ca7f6aa1d0d6 (patch) | |
| tree | 0b4c86988abeb6c01b23324f159bd0a8a936f485 /src/sp-use.cpp | |
| parent | Improved uri testing (diff) | |
| parent | Spray tool: (diff) | |
| download | inkscape-1bc1b442d8ec6f394f456c4675d5ca7f6aa1d0d6.tar.gz inkscape-1bc1b442d8ec6f394f456c4675d5ca7f6aa1d0d6.zip | |
Merge to trunk
(bzr r13047.1.7)
Diffstat (limited to 'src/sp-use.cpp')
| -rw-r--r-- | src/sp-use.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/sp-use.cpp b/src/sp-use.cpp index b2a51b8d9..e394e84c2 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -300,6 +300,23 @@ SPItem const *SPUse::root() const { } /** + * Get the number of dereferences or calls to get_original() needed to get an object + * which is not an svg:use. Returns -1 if there is no original object. + */ +int SPUse::cloneDepth() const { + unsigned depth = 1; + SPItem *orig = this->child; + + while (orig && SP_IS_USE(orig)) { + ++depth; + orig = SP_USE(orig)->child; + } + + if (!orig) return -1; + return depth; +} + +/** * Returns the effective transform that goes from the ultimate original to given SPUse, both ends * included. */ |
