[cairo-commit] src/cairo-recording-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Sat Nov 10 00:40:50 PST 2012


 src/cairo-recording-surface.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 62b795fe52c73ad58101c101aa77449f4b61a576
Author: Zozó Teki <teknos at gmail.com>
Date:   Sat Nov 10 08:35:33 2012 +0000

    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.

diff --git a/src/cairo-recording-surface.c b/src/cairo-recording-surface.c
index ce7c760..3bb5996 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;
     }


More information about the cairo-commit mailing list