LiveWallpaper with SurfaceHolder.lockCanvas(Rect dirty)

不羁的心 提交于 2019-12-05 10:36:43

lockCanvas(Rect dirty) is pretty simple. Remember that on Android surfaces are double-buffered by default. This means that you need to not only repaint the dirty region of the current surface, but also the dirty region of the previous surface to make it work properly. This is why lockCanvas() will resize the rectangle you pass: it tells what the real dirty region is. The dirty region might also change because the surface was discarded and recreated, etc. The correct way to use lockCanvas(Rect) is to pass your dirty rectangle and then check its new values and honor them.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!