Closed
Bug 430873
Opened 17 years ago
Closed 17 years ago
fast-path drawImage with a canvas as source
Categories
(Core :: Graphics: Canvas2D, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: vlad, Assigned: vlad)
References
Details
Attachments
(3 files, 1 obsolete file)
7.91 KB,
patch
|
roc
:
review+
roc
:
superreview+
damons
:
approval1.9+
|
Details | Diff | Splinter Review |
8.31 KB,
patch
|
roc
:
review+
roc
:
superreview+
|
Details | Diff | Splinter Review |
8.28 KB,
patch
|
pavlov
:
review+
damons
:
approval1.9+
|
Details | Diff | Splinter Review |
There's a bit of quite dumb code that always converts a source canvas to an image surface before rendering it when a canvas is used as a source for drawImage. This makes all sorts of actions much slower than they need to be, especially when a separate canvas is used for buffering (e.g. when drawWindow is done to a separate canvas which is then composited according to user input).
This extends the internal canvas API so that it's possible for a canvas to request a thebes surface from another canvas, and so speeds up the drawImage operation tremendously.
I'd like to get this into RC1, as it's a quite low-risk very large perf win for extensions and other consumers of canvas.
Attachment #317784 -
Flags: review?(roc)
Comment on attachment 317784 [details] [diff] [review]
add native fast-path
Did I ever tell you that I sort of hate the way that each 'context' actually has its own completely separate buffer state?
Attachment #317784 -
Flags: superreview+
Attachment #317784 -
Flags: review?(roc)
Attachment #317784 -
Flags: review+
Assignee | ||
Comment 2•17 years ago
|
||
(In reply to comment #1)
> (From update of attachment 317784 [details] [diff] [review])
> Did I ever tell you that I sort of hate the way that each 'context' actually
> has its own completely separate buffer state?
I think you did, though there are good arguments for both ways of doing it!
Though with this, you could probably hack up an additional context to grab the buffer of the previously-created context or somesuch... that is, once we support multiple contexts on one canvas.
Assignee | ||
Comment 3•17 years ago
|
||
Comment on attachment 317784 [details] [diff] [review]
add native fast-path
Requesting approval for this (I believe) low-risk performance fix. It greatly improves the common case of rendering a canvas to another canvas using drawImage; test coverage is in the form of the existing canvas tests, as this is just a perf issue and should not change functionality at all.
Attachment #317784 -
Flags: approval1.9?
Comment 4•17 years ago
|
||
Comment on attachment 317784 [details] [diff] [review]
add native fast-path
a1.9+=damons
Attachment #317784 -
Flags: approval1.9? → approval1.9+
Assignee | ||
Comment 5•17 years ago
|
||
This is a minor tweak to the previous patch -- the previous code would've caused a canvas used as a pattern to be "live", which is a change in behaviour. With this patch, a copy is forced when a canvas is used as a pattern, but no copy happens when drawImage is used.
+ ctx->SetOperator(gfxContext::OPERATOR_OVER);
I wondered why this isn't OPERATOR_SOURCE, but I guess it's because you want to compose the surfaces if there are multiple contexts.
Another argument for having only one active buffer :-).
(In reply to comment #2)
> Though with this, you could probably hack up an additional context to grab the
> buffer of the previously-created context or somesuch... that is, once we
> support multiple contexts on one canvas.
Right. Let there be an "active" context which has the current buffer. If someone draws through an inactive context, it takes over the buffer, copying to the right kind of surface if necessary. That would make a lot more sense to me.
Attachment #318274 -
Flags: superreview+
Attachment #318274 -
Flags: review?(roc)
Attachment #318274 -
Flags: review+
Assignee | ||
Comment 8•17 years ago
|
||
Assignee | ||
Comment 9•17 years ago
|
||
Comment on attachment 318299 [details]
my testcase
This is very much the wrong bug.
Attachment #318299 -
Attachment is obsolete: true
Assignee | ||
Updated•17 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Backed out because of
Linux qm-centos5-01 dep unit test on 2008/04/29 03:15:14
*** 4847 ERROR FAIL | pixel 1,1 is 0,0,0,255; expected 0,255,0,255 +/- 0 | | /tests/content/canvas/test/test_2d.pattern.basic.nocontext.html
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Note, at least locally that test failure was random, but happened pretty often.
Assignee | ||
Comment 12•17 years ago
|
||
Stupid linux. The temp surface created isn't cleared like it should be (and like it is on the other platforms); so go back to explicitly clearing it. Waiting on tryserver build to verify this on linux.
Comment on attachment 318414 [details] [diff] [review]
fix for linux
Tested locally, works ok on 64bit linux.
Assignee | ||
Comment 14•17 years ago
|
||
Comment on attachment 318414 [details] [diff] [review]
fix for linux
Simple fix for linux, just ran tests on linux to make sure the issue is fixed. Just needed the temp surface to be cleared (like it was before, but I thought it wasn't needed, argh).
Attachment #318414 -
Flags: review?(pavlov)
Updated•17 years ago
|
Attachment #318414 -
Flags: review?(pavlov) → review+
Assignee | ||
Comment 15•17 years ago
|
||
Comment on attachment 318414 [details] [diff] [review]
fix for linux
Begging for approval again, big canvas perf win, this time without silly bugs on linux. :(
Attachment #318414 -
Flags: approval1.9?
Comment 16•17 years ago
|
||
Comment on attachment 318414 [details] [diff] [review]
fix for linux
a1.9+=damons
Attachment #318414 -
Flags: approval1.9? → approval1.9+
Assignee | ||
Comment 17•17 years ago
|
||
Checked in again.
Status: REOPENED → RESOLVED
Closed: 17 years ago → 17 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•