Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. In Safari I'm getting 60fps but in WebView inside a wrapper app fps drops significantly (to 30-45).

Is canvas slower in WebView than Safari or I'm doing something wrong? 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!

like image 958
Valentin Solina Avatar asked Nov 13 '22 20:11

Valentin Solina


1 Answers

Unfortunately, haven't found the answer to my question but have solved my problem. I circumvented WebViews canvas drawing slowness by not using WebView.

I rather built a wrapper for my game using JavaScriptCore framework and redirected canvas calls to OpenGL functions. Also redirected audio calls to OpenAL, and mouse input from view to JavaScript.

Game code haven't changed a bit, and engine (small, custom one) got a few function overrides.

like image 196
Valentin Solina Avatar answered Nov 15 '22 11:11

Valentin Solina