Skip navigation.
 
mlRe: Reordering CALayer sublayers without raping my performance?
FROM : David Duncan
DATE : Mon Nov 19 10:49:29 2007

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.
--
David Duncan
Apple DTS Animation and Printing
david.<email_removed>

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