I’ve mentioned this in previous tutorials, but I keep forgetting to make a point out of it.
One great performance trick when using gpu renderMode on mobile, is to add this single line of code:
stage.quality = “low”;
On Android and Playbook, this can almost double your framerate without comprimising image quality at all. (Provided you use bitmap’s to render everything :p). On iOS the effects seem to be negligible. you can get a huge boost on older devices such as iPad 1 or 3GS, but the difference on newer devices like the iPad 2 seemed to be negligible from my testing.
Rather than charts I will simply give you two screenshots from my Galaxy Nexus:
![Screenshot_2012-01-11-18-39-00[1]](http://esdot.ca/site/wp-content/uploads/2012/01/Screenshot_2012-01-11-18-39-001.png)
The only difference in these two apps is the stage quality. And as you can see, they look identical.
The reason’s this works is because LOW stage quality still allows textFields to be rendered perfectly, and it also respects a bitmap.smoothing = true, or a draw() call with smoothing set to true. So text looks perfect, bitmap’s look perfect that’s almost everything… all that’s left are those pesky vector’s animations.
To render Vector’s with LOW stage quality, there’s an easy trick:
- set stage.quality = HIGH
- cache vector to bitmapData
- set stage.quality = LOW
Like So:
0 1 2 3 4 5 6 7 8 9 10 | stage.quality = StageQuality.HIGH; var asset:Sprite = new LibraryVectorAsset(); var bitmapData:BitmapData = new BitmapData(asset.width, asset.height, false, 0x0); bitmapData.draw(vectorAsset); //Here's our smoothly rendered vector :) var cachedVector:Bitmap = new Bitmap(); addChild(cachedVector); //Lets get that performance boost back stage.quality = StageQuality.LOW; |
This can be expanded upon by passing a matrix to pre-scale the vector to any size you see fit, just make sure to set smoothing=true in your draw() call.

Hi Shawn,
Great post. Just a quick question – when setting stage quality to low, display objects (bitmaps included, not just vectors) seem only able to move on full or half pixels, nothing in between. This makes it hard to tween or move even a small object over a short period of time e.g. 100 pixels in 10 seconds. Have you come across this, and if so have you found a work around? My situation only requires one instance of the object but it’s quite large (500×400) so blitting that sort animation is pretty memory heavy. Any ideas?
Thats a good point jassa, I haven’t really found this to be noticeable, but Ross has also stated this is the case.
I haven’t found any workaround for this, I think it’s a fact of life. if it’s really an issue I guess you’ll need to try MEDIUM or HIGH.
Isnt it solved by the PixelSnapping Property?
Thanks for the feedback Shawn. I have a few workaround ideas in mind – surely one of them will work!