[Webkit-unassigned] [Bug 98600] New: Canvas won't refresh without hacks

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Oct 6 07:08:41 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=98600

           Summary: Canvas won't refresh without hacks
           Product: WebKit
           Version: 525.x (Safari 3.2)
          Platform: Macintosh Intel
        OS/Version: Mac OS X 10.8
            Status: UNCONFIRMED
          Severity: Major
          Priority: P2
         Component: Canvas
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: kentozier at comcast.net


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.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list