ObjectSet::documentBounds report incorrect bounds for some groups

Bug #1642738 reported by Alexander Brock
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
New
Undecided
Unassigned

Bug Description

I wanted to test a new feature I wrote where objects are replaced by their intersection with all relevant clipping paths.
I stumbled upon some weird behaviour of ObjectSet::documentBounds()

I wrote a test where I add rects to a set, move them around and group them:

http://bazaar.launchpad.net/~inkscape+alexander/inkscape/intersect-clip/view/head:/testfiles/src/object-set-test.cpp#L686

In line 772 the set is grouped and in line 787 the result of documentBounds is compared to the previous result which is different.

This might be related to the code which calculates bboxes for groups where the transforms for children of the group is handled:

http://bazaar.launchpad.net/~inkscape+alexander/inkscape/intersect-clip/view/head:/src/sp-item-group.cpp#L283

And the function i2anc_affine which handles the transforms of all ancestors of a SPObject:

http://bazaar.launchpad.net/~inkscape+alexander/inkscape/intersect-clip/view/head:/src/sp-item.cpp#L1547

I thought that both methods handling transforms might cause transforms to be applied twice but I couldn't get it working right by removing the transform handling code from SPGroup and now I'm out of ideas.

I fixed one issue where grouping a single rect which was previously moved lead to the wrong bbox: I added bbox_valid = false where the bbox might be changed.

Revision history for this message
Alexander Brock (brock-alexander) wrote :

I tried to disable the cache by removing "if (!bbox_valid)", didn't change anything. I also can't reproduce it in the GUI.

Revision history for this message
Alexander Brock (brock-alexander) wrote :

I did a little bit more debugging.
I wrote a function for recursing into groups, printing debug info and printing bboxes of group children:

http://bazaar.launchpad.net/~inkscape+alexander/inkscape/intersect-clip2/view/head:/testfiles/src/object-set-test.cpp#L111

I did the following test: http://bazaar.launchpad.net/~inkscape+alexander/inkscape/intersect-clip2/view/head:/testfiles/src/object-set-test.cpp#L625
1. add a rectangle to a ObjectSet
2. move it by (10,10)
3. add a second rectangle
4. print the bboxes, they look fine: http://bazaar.launchpad.net/~inkscape+alexander/inkscape/intersect-clip2/view/head:/testfiles/src/object-set-test.cpp#L663
<output>
 item: Rect Interval(10, 20) x Interval(-10, 0)
 item: Rect Interval(0, 10) x Interval(0, 10)
</output>
5. group the set and print bboxes again: http://bazaar.launchpad.net/~inkscape+alexander/inkscape/intersect-clip2/view/head:/testfiles/src/object-set-test.cpp#L674
<output>
 item: of <b>2</b> objects Rect Interval(10, 20) x Interval(-10, 0)
+ item: Rect Interval(10, 20) x Interval(-10, 0)
+ item: --
</output>
Seems that grouping somehow destroys the last rectangle I added

Any ideas?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.