Double Buffering Plan

From: James D <jamesgecko_at_gmail.com>
Date: Sat Jun 06 2009 - 09:26:01 CEST

Hello Marc,

Is this along the lines of what you wanted with The Plan (tm)? Is it
too narrow? Is anything obvious overlooked?

Thanks,
 --James

/* Add startBuffering and endBuffering to everything that needs to be double
buffered. This will stack buffers which overlap.*/

static bufferContainer //It seems like this should be a map (extents
and buffers).
                       //It would make it easier to deal with
overhanging letters.
                       //Or it could be a FIFO, if we don't mind extra memory
                       //usage by redraw runs creating new buffers.
static bufferQueue //a list of the extents
static bufferPointer //starts out pointing at mainBufferPointer
static mainBufferPointer //always points to main cairo surface

getBuffer()
        return bufferPointer

startBuffering(extents) //The extents are coming from something like
getClipRect?
        if no buffer in bufferContainer
                put a new buffer in bufferContainer
                remap bufferPointer to new buffer
        elif for each buffer in bufferContainer
                see if extents fit inside buffer
                        if extent found
                                remap bufferPointer to new buffer
                if no extents found
                        put a new buffer in bufferContainer
                        remap bufferPointer to new buffer

endBuffering()
        make bufferPointer point back at the same location as mainBufferPointer

// Run at the end
printBufferQueue()
        for buffer in bufferContainer
                pop
                paint to mainBufferPointer

//Is there any advantage to keeping the queue around for multiple render cycles?
clearBufferQueue()
        //wipe the stack and start anew
Received on Sat Jun 6 09:26:21 2009

This archive was generated by hypermail 2.1.8 : Sat Jun 06 2009 - 09:26:21 CEST