I took your advice and I have CATiledLayers now where the
drawInContext: method draws only if the layer only lies in a certain
range.
I want to empty the layer buffer when the layer is not in this range
anymore. Presumably this is done by calling setNeedsDisplay: on the
layer and just drawing nothing into the supplied context.
The problem now is that layers do not receive the drawinContext:
message after invoking setNeedsDisplay:, when they are not in the
visible view bounds. However, my layers are required to draw their
contents until just after they have passed through the "right" of the
view. (the ones that disspear on the left fade first, so they are in
visible range and emptied when faded out)
The result is that CA keeps the layer buffers of every layer that
moves off to the right, and I have no way of emptying them (except for
emptying them when still visible, which is no solution either).
Overriding display: to always call drawinContext: seems hard too given
the threaded workings of CATiledLayer. Is there any workaround to this?
On 16-feb-08, at 00:01, Scott Thompson wrote:
On Feb 14, 2008, at 4:53 PM, Dennis Lorson wrote:
The culprit seems to be Core Animation (it's still called LayerKit
in the lower levels) as it is responsable for many chunks varying
from 1-100MB, adding up to a total of 1.9GB.
The same behavior can be seen when no layer is supplied an image
texture.
This prevents me from ever allocating a large number of bitmaps in
combination with CA. Is this expected behavior? If I recall
correctly, Core Animation was said to be capable of handling 1000's
of layers.
Well.. you can have thousands of layers. But that doesn't
necessarily mean that you can have thousands of memory resident
images.
It looks like you are going to have to provide the images for the
layers on-demand through a layer delegate. That way only those
layers that are actually drawn at any one time need to have their
images in memory. You would also avoid any separate caching that
Core Animation might be doing.
At 500x500 it seems that you should only be able to have about 15-20
layers on the screen at once? This seems consistent with effects
like those of the Cover Flow view in the Finder.
Of your 1000 layers, how many are likely to be on the screen at any
one time?
Scott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartz-dev/email@hidden