Question

Instruments tells that there are "misaligned images" which are animated by core animation. What does that mean?

UPDATE: I've seen that in Instruments.app > Core Animation.

Was it helpful?

Solution

I'd love more information about where you're seeing this, but my suspicion is that it's referring to an image that is not pixel-aligned. Quartz allows you to draw at fractional pixels (recall that CGPoint takes CGFloats, not NSIntegers), but it's more expensive and tends to create a bit of blurriness. You can't really draw on a fractional pixel, so Quartz has to do anti-aliasing to pull it off. That takes time and certainly would hurt Core Animation performance.

Quartz will not warn you that you're drawing on fractional pixels, and it's particularly unkind to text. So it's something you need to think about any time you're doing programmatic layout.

OTHER TIPS

Misaligned views force the renderer to anti-alias before they are drawn.

In this context, "misaligned" means that the requested display point does not map directly to a screen pixel (for example, it could be between two pixels), and therefore must be drawn to two neighbouring pixels and anti-aliased to give the illusion that it was drawn "between" the them.

This almost always happens when a view's frame is computed (rather than specified in Interface Builder) because a CGRect's X coordinate, Y coordinate, width, and height are CGFloats and therefore allow fractional values.

For example, a 100.8px by 50.1px box centered at (200.5, 35.5) is a valid frame and the OS will try to render it the best it can manage. The additional interpolation and anti-aliasing overhead required for just a single pixel is enough to severely hurt performance on older hardware.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top