简体   繁体   English

在Cocoa WebView中,HTML5画布绘制比Safari慢

[英]HTML5 canvas drawing is slower in Cocoa WebView than Safari

I'm trying to build a wrapper app using WebView for HTML5 game that uses canvas for drawing. 我正在尝试使用WebView for HTML5游戏构建一个包装器应用程序,该游戏使用画布绘制。 In Safari I'm getting 60fps but in WebView inside a wrapper app fps drops significantly (to 30-45). 在Safari中,我得到60fps,但在WebView内部的包装应用程序fps显着下降(至30-45)。

Is canvas slower in WebView than Safari or I'm doing something wrong? WebView中的画布比Safari慢,还是我做错了? If so, why and can anything be done about it? 如果是这样,为什么,可以做任何事情呢?

I have searched the Web for answer but can't find any mention of speed difference. 我在网上搜索了答案,但找不到速度差异。

Thank you! 谢谢!

Unfortunately, haven't found the answer to my question but have solved my problem. 不幸的是,没有找到我的问题的答案,但已解决了我的问题。 I circumvented WebViews canvas drawing slowness by not using WebView. 我通过不使用WebView来规避WebViews画布绘制的速度。

I rather built a wrapper for my game using JavaScriptCore framework and redirected canvas calls to OpenGL functions. 我宁愿使用JavaScriptCore框架为我的游戏构建一个包装器,并重定向到OpenGL函数的canvas调用。 Also redirected audio calls to OpenAL, and mouse input from view to JavaScript. 还将重定向的音频调用重定向到OpenAL,并将鼠标输入从视图重定向到JavaScript。

Game code haven't changed a bit, and engine (small, custom one) got a few function overrides. 游戏代码没有改变,引擎(小型,自定义)有一些功能覆盖。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM