summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZozó Teki <teknos@gmail.com>2012-11-10 08:35:33 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-11-10 08:37:23 +0000
commit62b795fe52c73ad58101c101aa77449f4b61a576 (patch)
treeccd4848e925241e2c4a26ceecca4afefd12a4b87
parent6ed1da67b5814c5ff062831f17621a585f81d704 (diff)
downloadcairo-62b795fe52c73ad58101c101aa77449f4b61a576.tar.gz
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.
-rw-r--r--src/cairo-recording-surface.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cairo-recording-surface.c b/src/cairo-recording-surface.c
index ce7c76086..3bb59967b 100644
--- a/src/cairo-recording-surface.c
+++ b/src/cairo-recording-surface.c
@@ -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;
}