material: fix copying of material layer differences
material: fix copying of material layer differences

This fixes how we copy layer differences in
_cogl_material_copy_layer_differences.

We were making a redundant g_list_copy of the src differences and then
iterating the src list calling _cogl_material_add_layer_difference for
each entry which would double the list length, but the initial copy
directly referenced the original layers which wasn't correct.

Also we were initializing dest->n_layers before copying the layer
differences but the act of copying the differences will re-initialize
n_layers to 0 when adding the first layer_difference since it will
trigger a layer_pre_change_notify and since the dest material isn't yet
a STATE_LAYERS authority the state group is initialized before allowing
the change.

collects/clutter,GNOME/clutter,spatulasnout/clutter,djdeath/clutter-android,GNOME/clutter,jigpu/clutter,ebassi/clutter,heysion/clutter-clone,djdeath/clutter-multithreaded,jigpu/clutter,ebassi/clutter,collects/clutter,collects/clutter,GNOME/clutter,spatulasnout/clutter,nobled/clutter,spatulasnout/clutter,djdeath/clutter-android,ebassi/clutter,djdeath/clutter,jigpu/clutter,GNOME/clutter,jigpu/clutter,heysion/clutter-clone,kerrickstaley/clutter-vala,ebassi/clutter,djdeath/clutter,collects/clutter,Distrotech/clutter,dlespiau/clutter,spatulasnout/clutter,heysion/clutter-clone,dlespiau/clutter,kerrickstaley/clutter-vala,kerrickstaley/clutter-vala,djdeath/clutter-multithreaded,djdeath/clutter-multithreaded,Distrotech/clutter,kerrickstaley/clutter-vala,nobled/clutter,heysion/clutter-clone,djdeath/clutter-multithreaded,GNOME/clutter,djdeath/clutter-android,collects/clutter,ebassi/clutter,nobled/clutter,Distrotech/clutter,Distrotech/clutter,Distrotech/clutter,heysion/clutter-clone,dlespiau/clutter,djdeath/clutter-android,djdeath/clutter,spatulasnout/clutter,jigpu/clutter,djdeath/clutter,djdeath/clutter,djdeath/clutter,jigpu/clutter,Distrotech/clutter,djdeath/clutter-android