Animation glitches while rendering on SurfaceView

前端 未结 1 1665
误落风尘
误落风尘 2020-12-22 12:07

The FPS is around 60, but the animation still glitches sometimes. I did threads profiling and discovered that on Samsung S4 or Samsung S3 <

相关标签:
1条回答
  • 2020-12-22 12:25

    Some devices, particularly those based around qcom CPUs, will aggressively manage power by lowering clocks, so you will see occasionally glitches in 60fps animation when your finger isn't actively moving across the touchscreen.

    The best way to handle this is to drop frames when necessary. The "Record GL app" activity in Grafika uses a simple trick with Choreographer to do this. For a detailed explanation, see this appendix in the graphics architecture doc.

    I should also point out that Canvas rendering on a SurfaceView surface isn't hardware-accelerated, and as pixel counts increase the rendering time will increase as well, making it more likely that you'll miss your window. In some ways the added CPU load can actually make things smoother -- if the power management believes the device is heavily loaded it won't lower the clocks -- but it does drain the battery faster.

    0 讨论(0)
提交回复
热议问题