Graphics Reference
In-Depth Information
Color Hits Green and Misses Red —When using the shouldRasterize property,
expensive layer drawing is cached and rendered as a single flattened image. This
option highlights rasterized layers in red when the cache has to be regenerated. If the
cache is regenerated frequently this is an indication that the rasterization may have a
negative performance impact. (See Chapter 15, “Layer Performance,” for more detail
about the implications of using the shouldRasterize property.)
Color Copied Images —Sometimes the way that backing images are created means
that Core Animation is forced to make a copy of the image and send it to the render
server instead of just sending a pointer to the original. This option colors such images
blue in the interface. Copying images is very expensive in terms of memory and CPU
usage and should be avoided if possible.
Color Immediately —Normally the Core Animation Instrument only updates the
layer debug colors once every 10 milliseconds. For some effects, this may be too
slow to detect an issue. This option sets it to update every frame (which may impact
rendering performance and throw off the accuracy of frame rate measurements, so it
should not be left on all the time).
Color Misaligned Images —This highlights images that have been scaled or
stretched for display, or which have not been correctly aligned to a pixel boundary
(that is, they have nonintegral coordinates). Most of these will be false positives
because it is common to deliberately scale images in an app, but if you are
accidentally displaying a large image as a thumbnail, or making your graphics blurry
by not aligning them correctly, this will help you to spot it.
Color Offscreen-Rendered Yellow —This highlights any layer that requires
offscreen rendering in yellow. Such layers may be candidates for using optimizations
such as shadowPath or shouldRasterize .
Color OpenGL Fast Path Blue —This highlights anywhere that you are drawing
directly to the screen using OpenGL. If you are only using UIKit or Core Animation
APIs, then this won't have any effect. If you are using a GLKView or CAEAGLLayer ,
then if it doesn't show in blue it may mean that you are doing more work than
necessary by forcing the GPU to render to a texture instead of drawing directly to the
screen.
Flash Updated Regions —This will briefly highlight in yellow any content that is
redrawn (that is, any layer that is doing software drawing using Core Graphics). Such
drawing is slow. If it's happening frequently, it may indicate a bug or an opportunity
to improve performance by adding caching or using an alternative approach to
generate your graphics.
Several of these layer coloring options are also available in the iOS Simulator Debug menu
(see Figure 12.5). We stated earlier that it's a bad idea to test performance in the simulator,
but if you have identified that the cause of your performance issues can be highlighted
using these debugging options, using the iOS Simulator to verify that you've resolved the
problem may provide a quicker fix/test cycle than tethering to a device.
Search WWH ::




Custom Search