- QuickDraw. Default mode used by Opera, older Firefox and Safari versions.
- Quartz 2D (a.k.a. Core Graphics). Supported by newer versions of Firefox and Safari.
- OpenGL. No browser I know of supports this properly today.
- Core Animation. Only available in Safari 4 + OS X 10.6 right now, with caveats in the current version.
In addition to these drawing models designers can embed Flash content in 3 different ways by specifying wmode:
- Normal
- Opaque
- Transparent
| Safari 4 | Firefox 3 | Opera 10 | |
| Normal | Quartz 2D | QuickDraw | QuickDraw |
| Opaque | Quartz 2D | QuickDraw | QuickDraw |
| Transparent | Quartz 2D | QuickDraw | QuickDraw |
| Safari 4 (*) | Firefox 3 | Opera 10 | |
| Normal | Core Animation | Quartz 2D | QuickDraw |
| Opaque | Quartz 2D(**) | Quartz 2D | QuickDraw |
| Transparent | Quartz 2D(**) | Quartz 2D | QuickDraw |
(**) Core Animation is used when the SWF is the front most object on the HTML page.What are the issues with Quartz 2D?The basic premise of Quartz 2D as Apple describes it:Quartz 2D is an advanced, two-dimensional drawing engine available for iPhone application development and to all Mac OS X application environments outside of the kernel. Quartz 2D provides low-level, lightweight 2D rendering with unmatched output fidelity regardless of display or printing device. Quartz 2D is not designed for multimedia applications, like animation or video playback. That's where OpenGL, Core Video, Core Animation shine. Safari's use of Quartz 2D to draw HTML content makes perfect sense as its content is static in most cases. Everything works well until Flash comes into the picture. For instance when the Flash Player plays a SWF using the Quartz 2D drawing model is has to do so with the full involvement of the browser. The sequence of events looks like this (you can follow the stack traces in Shark):
- Whenever the Flash Player is ready to display a new frame, the Flash Player requests a refresh of its region using NPN_InvalidateRect.
- The browser adds the the rectangle provided by the Flash Player to its dirty region.
- The browser traverses its own display list (the HTML DOM) and paints every node which is part of the dirty region.
- When the browser finds a node with a Flash Player instance it first draws the HTML background and then posts an event to the Flash Player to tell it that it has to paint over the requested region now.
- The Flash Player then finally draws its frame.
So far so good, makes sense I hope. So what's the technical issue? Think of a fairly complex HTML page, for instance a page with a CSS gradient in the background. Add to add a SWF which runs at 30 frames/sec. You will see that a lot of time is spent in the browser, not in the Flash Player. This is where Core Animation kicks in: step 3 and 4 pretty much go away (as long as the SWF is the top most object).Core Animation in the Flash PlayerFlash Player 10.1 implements the Core Animation drawing model to fix this technical issue, among others. Instead of using a CGImageRef + CGContextDrawImage to get the bits to screen we pass a CAOpenGLLayer to Safari and use an OpenGL texture of type GL_TEXTURE_RECTANGLE_ARB to get our bits to the screen.The support for the Core Animation drawing model was originally driven by Apple and we have worked feverishly to finish the engineering work on both sides. Yes that's right: This was and is a joint effort between Apple and Adobe engineers. Given the now almost perfect integration of Core Animation plugins into Safari I hope that future versions of the Flash Player will take advantage of more capabilities of OpenGL. And that without the requirement of setting any special wmode. I am pretty stoked about it.As of today (2/10/2010) we are getting closer to having it stable enough for public consumption. That means though: You will need Flash Player 10.1, OS X 10.6 and updated version of Safari (or the nightly WebKit build), otherwise you will not see anything.What difference does it really make?This is by no means panacea for all performance issues in the Flash Player. Far from it. But it is a small step to a larger goal which is to improve the experience in the browser with the ever more complex web content out there. That said here is a comparison between Flash Player 10.0 and Flash 10.1 using this test case (this only works in Safari). Keep in mind that that is an extreme test case which has little to do with real world web content.Flash Player 10.0 + nightly WebKit + OS X 10.6
Flash Player 10.1 + nightly WebKit + OS X 10.6
PS: You might have noticed that Core Animation is a Cocoa API. Yes, Flash Player 10.1 is a true Cocoa app now (with a Carbon fallback to support Firefox and Opera which are not Cocoa yet).

