Using graphics hardware acceleration in AIR for TV apps

And here is yet one more tip from soon-to-be-available-at-adobe.com documentation about AIR for TV application development.

AIR for TV devices provide hardware acceleration for 2D graphics operations. The device’s hardware graphics accelerators off-load the CPU to perform the following operations:

  • Bitmap rendering
  • Bitmap scaling
  • Bitmap blending
  • Solid rectangle filling

This hardware graphics acceleration means many graphics operations in an AIR for TV application can be high performing. Some of these operations include:

  • Sliding transitions
  • Scaling transitions
  • Fading in and out
  • Compositing multiple images with alpha

To get the performance benefits of hardware graphics acceleration for these types of operations, use one of the following techniques:

  • Set the cacheAsBitmap property to true on MovieClip objects and other display objects that have content that is mostly unchanging. Then perform sliding transitions, fading transitions, and alpha blending on these objects.
  • Use the cacheAsBitmapMatrix property on display objects you want to scale or translate (apply x and y repositioning).

    By using Matrix class operations for scaling and translation, the device’s hardware accelerators perform the operations. Alternatively, consider the scenario where you change the dimensions of a display object that has its cacheAsBitmap property set to true. When the dimensions change, the runtime’s software redraws the bitmap. Redrawing with software yields poorer performance than scaling with hardware acceleration by using a Matrix operation.

    For example, consider an application that displays an image that expands when an end user selects it. Use the Matrix scale operation multiple times to give the illusion of the image expanding. However, depending on the size of the original image and final image, the quality of the final image can be unacceptable. Therefore, reset the dimensions of the display object after the expanding operations are completed. Because cacheAsBitmap is true, the runtime software redraws the display object, but only once, and it renders a high-quality image.

    Note: Typically, AIR for TV devices do not support hardware-accelerated rotation and skewing. Therefore, if you specify rotation and skewing in the Matrix class, AIR for TV performs all the Matrix operations in the software. These software operations can have a detrimental impact to performance.
  • Use the BitmapData class to create custom bitmap caching behavior.