recording: Append new elements to the end of the bbtree chain

I have noticed that some of my objects were lost when drawing them on
a recording surface and playing them back. Later elements with the same
extents as a prior one tend to disappear from the chain of headers
having similar extents. After doing some debugging, I found that they
are not properly added to the bbtree during playback, and were instead
clobbering the existing chain.
This commit is contained in:
Zozó Teki 2012-11-10 08:35:33 +00:00 committed by Chris Wilson
parent 6ed1da67b5
commit 62b795fe52

View file

@ -210,7 +210,10 @@ bbtree_add (struct bbtree *bbt,
if (box->p1.x == bbt->extents.p1.x && box->p1.y == bbt->extents.p1.y &&
box->p2.x == bbt->extents.p2.x && box->p2.y == bbt->extents.p2.y)
{
header->chain = bbt->chain;
cairo_command_header_t *last = header;
while (last->chain) /* expected to be infrequent */
last = last->chain;
last->chain = bbt->chain;
bbt->chain = header;
return CAIRO_STATUS_SUCCESS;
}