RenderLayer code

Lars Knoll lars@trolltech.com
Fri, 31 Jan 2003 10:30:52 +0100


> On Friday, January 31, 2003, at 01:07 AM, Lars Knoll wrote:
> > I still don't pass test 4 however (see attached screenshot). I think
> > your code
> > flattening the ztree does not honour document order when zindeces are
> > equal.
>
> I pass this test.  Something else must be missing...

As I said, the tree you build has no information about document order. I could 
imagine something going wrong in the sorting, but I'll check.

> > At the same time we have a performance problem with the layer code I
> > have to
> > look into. Our painting got slower by a factor of about 5 (just
> > estimated).
> > I'll check with the new layer code, but one problem might be that you
> > construct and flatten the ztree on every paint call.
>
> Yes.  The arena allocation helps this (since the ztree nodes get
> recycled).

Sure it does, but I don't see the need to do so.

> > Our khtml paints the web page in vertical stripes of 128 pixels (for
> > double
> > buffering), so a repaint of the full widget calls paint maybe 5-6
> > times.
> > Since this doesn't change very often it would probably be a good idea
> > to
> > cache the flattened list.
>
> Ack! Yeah, we only do 1 paint call.  Maybe you could somehow grab and
> cache
> the list in the case where you know you're going to do multiple
> "striped" paints.
>
> > I thought about adding a RenderLayer *nextToPaint pointer to the layers
> > themselves. Like that one would not need an extra list. If a layer gets
> > inserted or removed, the paint order can be recalculated, but the
> > paint()
> > method should not need to do this.
>
> Note that the ztree construction prunes out layers that don't intersect
> your dirty rect, so the list can be different depending on the dirty
> rect.

We don't do that any other place in the rendering tree. You usually have a 
handful of layers, so I don't see why we can't calculate the complete order 
over the whole document and do the clipping out when painting, similar to how 
we do it in all the paint methods of the different render objects. 

IMO it has to be faster, since you have to iterate over all RenderLayer 
objects with every paint() call anyways (now to create the tree, then to 
check if they have to be painted).

It will probably also simplify code a bit.

Cheers,
Lars