Experiment with with a skia GDI back-end.
Categories
(Core :: Printing: Output, task, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox160 | --- | fixed |
People
(Reporter: emilio, Assigned: emilio)
References
Details
Attachments
(1 file, 4 external files)
|
336.41 KB,
text/html
|
Details |
| Assignee | ||
Comment 1•1 month ago
|
||
This is one way (not sure the best way, see below) of preventing
lifetime issues with the proposed Skia GDI back-end in the next commit.
The issue is that GDI can't represent everything that Skia does, so the
way we try make the most out of GDI is doing some analysis at the end of
the page where we can decide what regions to rasterize and which ones to
emit DGI commands for. This is very similar to what Cairo does.
Now, the main issue here is that we have this bespoke copy-on-write of
surfaces that kind of assumes that SkImages don't outlive our snapshots,
unless we make them own their pixels.
We could also fix this on the GDI side, but it's finicky, because we
can't just get away with rasterizing the SkImage I think.
| Assignee | ||
Comment 2•1 month ago
|
||
This works very similar to Cairo in the sense that it records the page,
analyzes and decides what to rasterize vs. provide commands for.
One known annoyance of this is that it needs the previous commit, and
that it uses SkPicture for recording, which is convenient but also
annoying.
It should not be hard to rejigger this to use the Gecko recording stuff
tho.
| Assignee | ||
Updated•1 month ago
|
| Assignee | ||
Comment 3•1 month ago
|
||
This also makes D331793 not needed at all. The Save/RestoreState
shenanigans seemed useful to be able to share resources like e.g. fonts
across pages...
WipeRecording was unused before this patch but is exactly what we want.
| Assignee | ||
Comment 4•1 month ago
|
||
This is a file I've been profiling against, apart from a copy of the single-page HTML spec.
| Assignee | ||
Comment 5•1 month ago
|
||
This works very similar to Cairo, in the sense that it records the page,
analyzes and decides what to rasterize vs. provide commands for.
drawPage() is where the meat of the approach is, the rest is translation
to GDI commands.
In order to avoid pulling SkPicture as a dependency in a way that
complicates our borrowed SkImage optimizations (see D331792), we pass an
std::function around to Skia that gets called every time we need to
analyze / rasterize the page, and PrintTargetWindows is what takes care
of keeping the recordings around.
In my testing, in terms of quality, this tends to perform better than
Cairo, because Cairo has full-page rasterization fallback more often.
I've also profiled this with the single-page HTML spec, and some
miscellaneous pages like mixed.html (attached to the bug), and this is
faster in all cases (with the fix for bug 2080319).
The InlineTranslator changes are so that we can reuse registered
resources from previous pages (like fonts etc). It's not perfect,
because each replay of a given page doesn't reuse the state / resources
of the first pass of that very same page, which seems like it'd be
desirable. However it does allow for reusing resources across pages
which is where most of the wins are in practice, so I think it's good
enough. I'm open to better approaches there, but I'd rather land it and
iterate on it as needed, because this is in a state already better than
Cairo.
Comment 7•1 month ago
|
||
| bugherder | ||
| Assignee | ||
Updated•1 month ago
|
| Assignee | ||
Updated•1 month ago
|
Updated•24 days ago
|
Description
•