WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
98600
Canvas won't refresh without hacks
https://bugs.webkit.org/show_bug.cgi?id=98600
Summary
Canvas won't refresh without hacks
Ken Tozier
Reported
2012-10-06 07:09:12 PDT
I'm writing a large, complex canvas based Javascript class and have found that in WebKit browsers (Safari, Chrome) The only way I can get user actions to display is the following ugly hack on every single draw event canvas.width = canvas.width + 1 canvas.width = canvas.width - 1 <do rest of drawing> I tried the slightly less ugly canvas.width = canvas.width + 0 but that didn't work. Only the forced resizing of the canvas does the trick. My class fills the entire window and can contain hundreds or thousands of elements that need drawing, so forcing this sort of refresh is very computationally expensive. I've tried for two days to use more efficient clearing/redrawing only the small portions of the canvas that actually contain changes, but nothing works except the above. I suspect some sort of optimization is rolled into the WebKit implementation to only draw in response to major canvas changes, but it seems like it would be far more optimal to get sub-canvas refreshing working. The working code is quite large (450K) and really can't be distilled to a small snippet as there's too much interdependency between classes. If necessary, though, I can supply it to help with figure out this bug.
Attachments
Add attachment
proposed patch, testcase, etc.
Ken Tozier
Comment 1
2012-10-06 12:50:49 PDT
I rewrote my drawing code and it seems to have resolved the issue.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug