After reading on http://developer.android.com/guide/topics/graphics/hardware-accel.html , my understanding on 3 different type of layering techniques are (Assume the device has GPU)
- LAYER_TYPE_SOFTWARE - Draw is performed by software on software's off-screen bitmap memory. Software's off-screen bitmap will then transferred to GPU. GPU render the bitmap on screen.
- LAYER_TYPE_NONE - GPU will draw directly on screen.
- LAYER_TYPE_HARDWARE - Draw is performed by GPU on GPU's off-screen bitmap memory. GPU's off-screen bitmap will then render to screen by GPU.
When to use LAYER_TYPE_SOFTWARE
My understanding certain draw operation isn't supported by GPU like setShadowLayer
. Hence, we need to switch to LAYER_TYPE_SOFTWARE
, so that draw will be performed by software.
However, since there's software's off-screen bitmap memory transferred to GPU operation, things may appear slower.
When to use LAYER_TYPE_NONE
I think this is the default settings in most of the devices. So, I assume we should use this technique most of the time.
When to use LAYER_TYPE_HARDWARE
I have no idea when to use this technique. Any example will be very much appreciated, on when we should apply LAYER_TYPE_HARDWARE
technique.
p/s Also, my understanding on LAYER_TYPE_... may appear wrong. Kindly correct me, if you find any mistake. Thank you.