Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

发现了一个问题 #3

Closed
Yexinglong opened this issue Apr 6, 2016 · 7 comments
Closed

发现了一个问题 #3

Yexinglong opened this issue Apr 6, 2016 · 7 comments

Comments

@Yexinglong
Copy link

当CAShapeLayer 添加了非常多个的时候,性能会被降低,内存和CPU是没有任何改变,但GPU逐渐上升,最后造成卡顿卡顿!如果使用了CAShapeLayer 橡皮擦这个功能无法真正的实现擦除!你有更好的思路么?

@Yexinglong
Copy link
Author

你可以尝试将画笔增粗,然后换着颜色去涂满整个屏幕,多涂几次就会感觉到一些卡顿了!

@bb-coder
Copy link
Owner

bb-coder commented Apr 6, 2016

好的,我在寻找解决办法,之后回复您,多谢支持😁

@bb-coder
Copy link
Owner

bb-coder commented Apr 6, 2016

您好,感谢您的建议,性能上的问题我这里不是特别明显,画笔改为100,instrument上测试的GPU数据如图:
screen shot 2016-04-06 at 6 29 35 pm

橡皮擦可以参考这里

@bb-coder
Copy link
Owner

bb-coder commented Apr 6, 2016

不好意思,刚才我用1000width的画笔又试了一下,GPU占用确实会在频繁(20年单身手速画)的绘制时非常的高(有时会到100),但是随着绘制频率的降低情况会有所改善,其实优化的思路就是GPU和CPU之间的权衡,目前我没有想到一个完美的GPU和CPU都很低并且内存不高的解决方案。

@Yexinglong
Copy link
Author

哈哈哈哈哈~你好有意思啊!

@Yexinglong
Copy link
Author

嘿~哥们,我做出一个比较完美的画板了!GPU与CPU之间都共用,思路就是用CAShapeLayer 来画当前的线,画完后removeFromSuperlayer,NSUndoManager 来保存当前的位图 虽说放大5倍以上会出现锯齿,但是无所谓啦!我就不给他放大五倍就行啦!然后橡皮擦可以实现真正的擦除了!话说,你还需要女朋友吗?给你介绍介绍

@bb-coder
Copy link
Owner

bb-coder commented Apr 7, 2016

牛啊,你有Demo吗,可以的话邮箱发给我研究研究[email protected],正好我把这个Demo完善一下。最近工作比较忙,一直也没有去认真思考这个Demo。
你资源还不少啊,哈哈,女朋友还是留给别人吧,我有女朋友了😄。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants