Closed
Bug 748135
Opened 13 years ago
Closed 13 years ago
Add takeScreenshot() to nsIDOMWindowUtils
Categories
(Core :: DOM: Core & HTML, enhancement)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: ttaubert, Assigned: ttaubert)
References
Details
Attachments
(1 file, 3 obsolete files)
|
4.92 KB,
patch
|
Gavin
:
feedback+
|
Details | Diff | Splinter Review |
This way we don't need a canvas to capture screenshots.
Attachment #617652 -
Flags: review?(gavin.sharp)
| Assignee | ||
Comment 1•13 years ago
|
||
We can probably remove canvas.mozFetchAsStream(), I don't think anything other than the thumbnail service uses it. I'd file a follow-up for it.
Comment 2•13 years ago
|
||
The method needs a security check.
| Assignee | ||
Comment 3•13 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #2)
> The method needs a security check.
Added.
Another thing I noticed is that the screenshots captured aren't scaled down as they were before. I wasn't able to find the code responsible for this in .drawWindow()...
Attachment #617652 -
Attachment is obsolete: true
Attachment #617652 -
Flags: review?(gavin.sharp)
Attachment #617673 -
Flags: review?(gavin.sharp)
| Assignee | ||
Comment 4•13 years ago
|
||
Added a gfxContext->Scale() call to let the thumbnail be scaled down accordingly.
Attachment #617673 -
Attachment is obsolete: true
Attachment #617673 -
Flags: review?(gavin.sharp)
Attachment #617833 -
Flags: review?(gavin.sharp)
| Assignee | ||
Comment 5•13 years ago
|
||
Simplified the patch again because imgIEncoder already implements nsIAsyncInputStream.
Attachment #617833 -
Attachment is obsolete: true
Attachment #617833 -
Flags: review?(gavin.sharp)
Attachment #617840 -
Flags: review?(gavin.sharp)
| Assignee | ||
Comment 6•13 years ago
|
||
I did some measurements and the results are a bit surprising:
The old approach that creates a canvas, calls drawWindow() and mozFetchAsStream() - that still extracts and encodes image data sync - takes on average 50ms.
The new approach that calls takeScreenshot() and does the same sync image data encoding takes on average 150ms.
Is this maybe because the Azure/Skia backend accelerates the resize/scale operation for canvases? BTW, my machine doesn't support HW accel. It would be interesting to know if mobile actually took a performance hit by implementing bug 724210. They don't seem to scale down and moved the PNG encoding to a different thread (which we could also do?) so that still might be a win...
Comment 7•13 years ago
|
||
Comment on attachment 617840 [details] [diff] [review]
patch v4
Looks good to me. You should get review from a DOM peer (Olli?) and get feedback from some gfx person about your perf findings, I guess!
Attachment #617840 -
Flags: review?(gavin.sharp) → feedback+
| Assignee | ||
Comment 8•13 years ago
|
||
Adding khuey and hope he has some idea about the perf issues I'm seeing.
I'm not the right person to ask about gfx perf.
| Assignee | ||
Comment 10•13 years ago
|
||
Hmm, that's what I thought. Adding roc to hopefully lighten us up regarding comment #6.
Comment 11•13 years ago
|
||
I spoke to Jeff&Joe about this - they weren't sure about why there was a perf difference, but suggested that using RenderDocument still wasn't optimal. They suggested instead adding an API to directly retrieve the drawn data (asynchronously), and then using that instead (which should work fine as long as we only want to capture the selected tab). Would need more feedback from them about how exactly to do that (Jeff suggested discussing it with Bas and roc), but it might be best to WONTFIX this and just focus on that instead.
| Assignee | ||
Comment 12•13 years ago
|
||
Marking as WONTFIX based on comment #11.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → WONTFIX
Comment 13•13 years ago
|
||
If you pass the widget_layers flag and the data you are asking for is actually retained we shouldn't need to do any painting, just composite the layer tree to the output context. However there are some things that might prevent that from happening. For the content to be retained it has to actually be visible on screen when you make the call, and you can't pass any flags to drawWindow or RenderDocument that ask for something different then what is drawn on screen.
Comment 14•13 years ago
|
||
For example, background tabs don't have any retained content because they are not visible.
Comment 15•13 years ago
|
||
The "but it might actually be slower or lower quality than normal" comment in the IDL is slightly worrying, but it sounds like we should get a bug on file to consider using DRAWWINDOW_USE_WIDGET_LAYERS? We currently only care about capturing thumbnails of displayed pages.
Comment 16•13 years ago
|
||
I guess it might be slower if its in GPU memory and we have to do readback? I'm not sure. I'm also not sure about the quality part.
Comment 17•13 years ago
|
||
The two flags in this patch (RENDER_IGNORE_VIEWPORT_SCROLLING, RENDER_DOCUMENT_RELATIVE) are the bad kind that make the widget layers flag not work so well.
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•