4 Replies Latest reply on Aug 31, 2011 11:48 AM by xbmd2007x

    Internal Workings of Bitmap Caching.


      I have a few questions about Bitmap Caching that I can't manage to solve, and a few I'm just trying to verify.


      1.  I've read that when Bitmap Caching an object, if the objects you are caching are bitmaps that all point to the same bitmapData object, than only one instance is cached and used by the GPU.  However, if the bitmap contains a scale, does this hold true, or is a new bitmap cached for each object because of the new scale?  I'm pretty sure its the second one, just checking.


      2.  When using cacheAsBitmapMatrix, I've seen examples setting the matrix to identity, and setting it to the concatenated matrix of the bitmap object.  Can someone explain the difference between the two approaches?  I would assume setting it to identity doesn't scale it up or down when caching is as stated in the documentation:


      "The matrix transformation you apply to the cacheAsBitmapMatrix property is applied to the display object as it isrendered into the bitmap cache. Thus, if the transform contains a 2x scale, the bitmap rendering is twice the size of thevector rendering. The renderer applies the inverse transformation to the cached bitmap so that the final display looks the same."


      But if this bitmap is nested in a sprite that moves throughout the scene, will the bitmap still move with it?  Or will I need to update the matrix's x/y everytime I update the sprite's x/y.  If this problem exists, does using the concatenated matrix get around it.


      3.  Finally, I have seen some sites state that more gpu memory is used when cacheAsBitmapMatrix (such as an additional copy of the texture being pushed into the gpu), but I was under the impression that this would just rotate and scale the texture in memory using openGL matrices.  Why would more gpu memory be used when cacheAsBitmapMatrix is set?



      My understanding is that when designing for mobile, if the graphic isn't too large, and the object doesn't contain nested animating objects, the best approach is to cacheAsBitmap and cacheAsBitmapMatrix on the object to ensure it won't be pushed to the gpu each frame, but feel free to correct me if I'm wrong.  Adobe states "Always set the cacheAsBitmapMatrix property whenever you set cacheAsBitmap to true in content created for mobile devices."