Skip navigation.
 
mlRe: Reordering CALayer sublayers without raping my performance?
FROM : Jonathan del Strother
DATE : Mon Nov 19 11:02:45 2007

On 19 Nov 2007, at 09:49, David Duncan wrote:

> On Nov 19, 2007, at 1:09 AM, Jonathan del Strother wrote:
>

>> Would you run that past me again?  Changing the zPosition re-sorts 
>> the sibling layers?  In which case, is there any point in re-
>> sorting the child array to specify render order?

>
> Whenever the zPosition of a layer changes, you have to sort the 
> layers (internally) for presentation, otherwise you wouldn't get the 
> correct visual effect. It doesn't sort the sublayers array, just the 
> visual order that the layers are rendered in (which if all layers 
> have the same zPosition is just the order in the sublayers array).
>

>> I'll test it out later, but I assume that CA is using a depth 
>> buffer to make sure that higher zPositioned objects appear in front 
>> of others, in which case the only time you need to worry about the 
>> order of the child array ought to be if you're dealing with 
>> transparent elements.

>
> CA has no guarantees of having or not having transparent content. In 
> fact, the most common use for it (Appkit's layer based views) 
> involves considerable amounts of transparency (mostly for 
> antialiasing, but since the entire drawing model is supported 
> arbitrary transparency has to be supported as well).
>

>> Is there any way of re-sorting the child element array that doesn't 
>> incur a huge performance & memory hit?

>
>
> The alternative is what I said last time, to use the current 
> transaction to disable creating implicit animations.


Oooh, it's finally clicked that re-sorting the sublayers is an 
animated process.  That would explain the memory usage pattern I was 
seeing, since I would have been created a lot of overlapping 
animations...

Thanks for clarifying that

Jon

Related mailsAuthorDate
mlReordering CALayer sublayers without raping my performance? Jonathan del Strot… Nov 16, 19:41
mlRe: Reordering CALayer sublayers without raping my performance? David Duncan Nov 16, 19:48
mlRe: Reordering CALayer sublayers without raping my performance? Jonathan del Strot… Nov 16, 19:54
mlRe: Reordering CALayer sublayers without raping my performance? David Duncan Nov 16, 20:08
mlRe: Reordering CALayer sublayers without raping my performance? Jonathan del Strot… Nov 19, 10:09
mlRe: Reordering CALayer sublayers without raping my performance? David Duncan Nov 19, 10:49
mlRe: Reordering CALayer sublayers without raping my performance? Jonathan del Strot… Nov 19, 11:02
mlRe: Reordering CALayer sublayers without raping my performance? Chris Ryland Nov 19, 19:56
mlRe: Reordering CALayer sublayers without raping my performance? Jonathan del Strot… Nov 22, 13:24