动画毛刺,同时渲染SurfaceView [英] Animation glitches while rendering on SurfaceView

查看:134
本文介绍了动画毛刺,同时渲染SurfaceView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的FPS是60左右,但动画仍然有时故障。我做了主题分析,发现在三星S4 三星S3 lockCanvas()可能需要长达 20ms的的时候。 有没有什么特别的原因呢?如何避免这样的故障。

The FPS is around 60, but the animation still glitches sometimes. I did threads profiling and discovered that on Samsung S4 or Samsung S3 lockCanvas() could take up to 20ms sometimes. Is there any specific reason for it? How to avoid such glitches.

推荐答案

某些设备,尤其是基于各地QCOM的CPU,积极将管理电源<一href="http://stackoverflow.com/questions/21172585/android-thread-performance-priority-on-galaxy-note-2-when-screen-is-touched-rele/21322371#21322371">lowering钟表的,所以你会看到偶尔毛刺在60fps的动画,当你的手指没有积极地跨触摸屏移动。

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.

要处理这种情况最好的办法就是在必要时丢弃帧。在 Grafika 的记录GL的应用程序活动采用一个简单的技巧与编导做到这一点。有关详细说明,请参见在图形架构文档本附录

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.

我还应该指出的是画布上绘制一个SurfaceView表面不是硬件加速,并作为像素数增加了渲染时间也将随之提高,使之更可能的是,你会想念你的窗口。在某些方面增加CPU的负载实际上可以使事情变得更顺畅 - 如果电源管理层认为该设备负载过重也不会降低时钟 - 但它确实耗尽电池快

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.

这篇关于动画毛刺,同时渲染SurfaceView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆