Closed
Bug 293267
Opened 20 years ago
Closed 20 years ago
When called via onclick, canvas rendering is far slower than called via onload
Categories
(Core :: Graphics: Canvas2D, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jens.b, Assigned: vlad)
Details
(Keywords: perf)
Attachments
(3 files)
|
1.06 KB,
text/html
|
Details | |
|
1.03 KB,
text/html
|
Details | |
|
11.90 KB,
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
shaver
:
approval1.8b2+
|
Details | Diff | Splinter Review |
When drawing into a canvas, the speed heavily differs depending on the way the function is invoked. onload rendering is okay, onclick/href="javascript:..." is really slow. Is this a bug or the intended behaviour?
| Reporter | ||
Comment 1•20 years ago
|
||
| Reporter | ||
Comment 2•20 years ago
|
||
Comment 3•20 years ago
|
||
What may be causing this is that after initial loading the canvas seems to be rendered to screen after every drawing call. But that should not happen during javascript execution. Only when the script is finished should the canvas repaint to screen again.
| Assignee | ||
Comment 4•20 years ago
|
||
Whoops, this was a pretty big thinko in the implementation. This patch speeds up performance drastically for interactive renderings. It's still going to be slightly /slow/ until the rendering stuff gets a little deeper into our moz rendering core, but you won't get to watch each individual circle paint. As a side effect, this also fixes the bug 293544 holding-pointer-after-Release() issue.
- NS_IF_ADDREF(*canvas = mDOMCanvasElement); - return NS_OK; + return CallQueryInterface(mCanvasElement, canvas); You probably need to nullcheck mCanvasElement first since CallQI isn't nullsafe.
Comment 6•20 years ago
|
||
Comment on attachment 183361 [details] [diff] [review] massive canvas speedup patch >Index: content/canvas/src/nsCanvasRenderingContext2D.cpp > nsCanvasRenderingContext2D::GetCanvas(nsIDOMHTMLCanvasElement **canvas) > { >- NS_IF_ADDREF(*canvas = mDOMCanvasElement); >- return NS_OK; >+ return CallQueryInterface(mCanvasElement, canvas); That will crash if mCanvasElement is null. You need to explicitly set *canvas to null in that case, and not CallQI. >Index: content/html/content/src/nsHTMLCanvasElement.cpp >+ NS_IMETHOD UpdateImageFrame (); Nix space before '('. >+nsHTMLCanvasElement::UpdateImageFrame () And here. r+sr=bzbarsky with those fixed.
Attachment #183361 -
Flags: superreview+
Attachment #183361 -
Flags: review?(bzbarsky)
Attachment #183361 -
Flags: review+
| Assignee | ||
Updated•20 years ago
|
Attachment #183361 -
Flags: approval1.8b2?
Comment 7•20 years ago
|
||
Comment on attachment 183361 [details] [diff] [review] massive canvas speedup patch a=shaver
Attachment #183361 -
Flags: approval1.8b2? → approval1.8b2+
| Assignee | ||
Comment 8•20 years ago
|
||
Checked in with CallQI and whitespace issues fixed. One of these days I'll remember that CallQI doesn't handle a null param...
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Comment 9•20 years ago
|
||
confirmed, the difference is really unreal testcase 1 went from 15 secs down to instant
You need to log in
before you can comment on or make changes to this bug.
Description
•