When should we use LAYER_TYPE_HARDWARE

After reading http://developer.android.com/guide/topics/graphics/hardware-accel.html my understanding of three different types of layering methods (suppose the device has a GPU)

  • LAYER_TYPE_SOFTWARE . A draw is performed using software on an off-tier raster software memory. The off-screen software bitmap will be transferred to the GPU. The GPU displays a bitmap on the screen.
  • LAYER_TYPE_NONE - The GPU will draw directly on the screen.
  • LAYER_TYPE_HARDWARE . Drawing is done using the GPU on the graphic map of the raster image of the GPU. The graphic image of the GPU will not be displayed on the screen by the GPU.

When to use LAYER_TYPE_SOFTWARE

My understanding is that the drawing operation is not supported by the GPU like setShadowLayer for example. Therefore, we need to switch to LAYER_TYPE_SOFTWARE , so that the drawing will be done using software.

However, since the software screen raster memory transferred to the GPU may look slower.

When to use LAYER_TYPE_NONE

I think these are the default settings on most devices. Therefore, I suggest that we should use this method most of the time.

When to use LAYER_TYPE_HARDWARE

I do not know when to use this technique. Any example would be greatly appreciated when we should apply the LAYER_TYPE_HARDWARE technique.

p / s Also, my understanding in LAYER_TYPE _... may seem wrong. Please correct me if you find any error. Thanks.

+6
source share

Source: https://habr.com/ru/post/978729/


All Articles