I have a custom view that can scale and pan. All he does is show path (whose coordinates are obtained from the API). Since path are loaded as a texture into the GPU and then drawn, there is a maximum path size limit that can be drawn (which varies from device to device). My custom view can grow quite large (> 30,000 pixels in an area), and to get around the limitation, I used setLayerType(LAYER_TYPE_SOFTWARE) in my custom view. It works well, but it does not help me in delivering 60FPS.
To bring the frame rate to 60FPS, I decided to return to LAYER_TYPE_NONE . Now, instead of preventing the path from being scaled, I decided to stop it at a certain zoom level and to scale the canvas for further scaling (in case of loss of clarity). To find the zoom level at which I have to stop scaling path and start scaling the canvas , I did a few trails (I use nexus 7 (2012) and nexus 9 as test devices).
I expected to see the path too large to be rendered into a texture message only after reaching the texture size limit (which I recognize with canvas.isHardwareAccelerated() ).
- For nexus 7, the texture size limit is 2048, but the path disappears when its width or height reaches 2036 , and I see
path too large to be rendered into a texture in the log, I expected this to happen in 2048. - For nexus 9, the texture size limit is 16384, but sometimes the application crashes with the journal
A/libcοΉ Fatal signal 11 (SIGSEGV), code 1, fault addr 0x78 in tid 7252 (RenderThread) before even the texture limit is reached. For example, these are some of the sizes of the user view when the application crashes: (7199, 5049), (13814, 2500), (8040, 4200). The only common feature that I could find among them is that the total area of ββthe user view (as well as path ) exceeds 32,000,000 pixels.
Therefore, I could not decide exactly when I should switch from scaling path to scaling canvas . Any ideas on when to do this?
EDIT 1
I noticed that for nexus 9, the application crashes every time the total path area reaches ~ 33,000,000. What does this limit mean?
source share