Interview With Paul Cantrell: High-Powered Graphics, Low-Powered CPU
The iPhone inherits its UI rendering approach from OS-X. Every view is rendered in an off-screen buffer, and the OS is responsible for compositing what ends up on the screen.
This approach has interesting performance implications, especially given that the OS can offload much of the work to the graphics processor. This design is how we get great graphics and animations on a relatively underpowered system.
In this podcast interview, Paul Cantrell describes how this works, how it came to be (via OS-X) and how this forms the basis for much of the iPhone’s programming model. We also talk about optimizations that impact the rendering of applications, Objective-C APIs stacked atop C underpinnings, the relationship between views and layers and much more.
Paul is a fascinating guy with a knack for understanding and communicating the practical applications of real computer science. His projects site is innig.net.
You can listen using the Flash player below, download the MP3, or subscribe to the iPhone Developer Podcast using the instructions at the bottom of this post.
For easy scanning of the interview, here is what was covered and when:
- 2:00 – Off-screen buffers for every view
- 3:00 – OS compositing of the screen
- 4:00 – Shifting this off to the graphics card for fast windows compositing
- 5:00 – Optimizing transitions/animations on a hardware limited devices like the iPhone
- 6:00 – Juxtaposing this programming model to the alternatives
- 8:00 – drawRect: normally called once: performance implications
- 10:00 – Custom animation strategies
- 13:30 – Mixing OpenGL and UIKit
- 16:45 – Gotchas from operations that you wouldn’t expect to be expensive, but are: e.g., creating a new view
- 17:00 – Table-view optimizations
- 22:30 – How the simulator is implemented
- 25:30 – Drawing fractals: the difficulties of pixel-by-pixel rendering in UIKit
- 27:25 – Using CoreGraphics APIs to manually allocate an offscreen buffer
- 28:15 – Drawing a custom offscreen buffer
- 29:00 – Relationship between the view hierarchy and layer hierarchy
- 30:30 – When would you work with layers (vs. views)
- 34:00 – APIs Apple is willing to commit to vs. what’s obviously there but not exposed
- 36:00 – Overcoming UIScrollview limitations
- 38:00 – API Hierarchies: straight C API with an Objective C API built atop it
Keep up to date with our iPhone developers’ podcast
Subscribe to our iPhone Development Podcast in one of two great ways:
- Use the podcast’s feed with the feed app of your choice: https://podcast.mobileorchard.com/feed/podcast/
- Subscribe using iTunes by clicking here.
We hope you enjoy the podcast, and if you have any suggestions of who we should interview (or want to be interviewed yourself), use our Contact page or leave a comment against this post. Thanks for listening!
Photo credit: Luke Francl via Flickr.
What a fantastic interview. I ended up listening to this at exactly the time I was applying per-pixel transforms to a raw bitmap, so finding out the shortcut to displaying it on a CALayer via a CGImageRef was extremely useful. Thanks, Mobile Orchard and Paul Cantrell