Skip to content

画一段很长的path越来越卡,请问怎么优化 #112

Answered by domchen
ghbhaha asked this question in Q&A
Discussion options

You must be logged in to vote

你是不是一直在往同一个Path对象上不断累加数据然后每次清屏重画。这样操作无论是什么方案最后都会触发性能临界值。你的还是靠无数的直线在模拟曲线,数据量巨大。这种场景要用起来缓存,不要清屏,每次只生成新增的 Path画上去就行了。要缓存也用Suface.makeImageSnapshot()生成画好的图片缓存,不应该去缓存无限大的矢量数据。

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@domchen
Comment options

Answer selected by domchen
@ghbhaha
Comment options

@domchen
Comment options

@ghbhaha
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants