Re: [chromium-dev] How to GetPicture() and serialize() to skp file incrementally

55 views
Skip to first unread message

K. Moon

unread,
May 8, 2023, 1:57:20 PM5/8/23
to daoshu...@gmail.com, skia-d...@googlegroups.com
Since you're working at the SkPicture level, I think this is more of a Skia question, although I suppose there could be some cc-specific insight someone could contribute.

I'm not sure what you mean by "incremental" here, but if you want to play back individual drawing operations, SkPicture is just a list of those, which can be played back on an SkCanvas. You can subclass SkCanvas and add overrides for the operations you want to inspect.

On Mon, May 8, 2023 at 10:26 AM Daolin Liu <daoshu...@gmail.com> wrote:
Hi,

I use below demo code to generate skp file for each layer:

sk_sp<const SkPicture> picture = layer->GetPicture();
auto data = picture->serialize();

I think this data is the "full" result. How can I get the "incremental" result? Is there any interface or method under layer or cc::displayltemlist or even skia renderer object supported my requirement?

Currently, I use courgette to generate the diff patch, but it's not fast enough for me. 

Any help is appreciated!

Dorian

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/3ab66362-faab-41da-bd72-749b9f037d25n%40chromium.org.

Sohan Jyoti Ghosh

unread,
May 8, 2023, 3:02:51 PM5/8/23
to skia-d...@googlegroups.com, daoshu...@gmail.com
Hi !

From my experiments, there are ways to track the "increments" or invalidations if I assume, that's what you meant. It is tracked at different stages of the pipeline, Painting (PaintInvalidator), Rasterization (RasterInvalidator) or Drawing (DamageTracker)
But to generate SKP's based on them would involve you have to ensure whether you have the right handles to do that (PaintRecord etc.) and may need considerable hacking in the pipeline.

Also, another aspect with using only the invalidations, is the re-composition, while playback.
Hope that helps.

Br,
Sohan

You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/CACwGi-6ZHENOV_8N1uPf-z7_7MfBJm32MfOsRK8js00%2BwKkY-w%40mail.gmail.com.

Daolin Liu

unread,
May 10, 2023, 8:41:18 AM5/10/23
to Chromium-dev, K. Moon, skia-d...@googlegroups.com, daoshu...@gmail.com
Hi,

Thank you for your reply.

The "incremental" means "diff" in my previous post. Maybe too many drawing operations every time when I generate SKP file (this file is not small enough), so my requirement is "reduce" this SKP file, which only include "diff" drawing operations compared to the last time. I'm not sure if skia support this or not.

K. Moon

unread,
May 10, 2023, 12:46:55 PM5/10/23
to Daolin Liu, Chromium-dev, skia-d...@googlegroups.com
That's an interesting idea, but outside of the scope of Chromium or Skia. You could use the idea I suggested earlier to try and break up the SKP playback into multiple outputs, or you could work directly with the serialized SKP format (with the understanding that this isn't supported by Skia), but there's no inherent support for this.
Reply all
Reply to author
Forward
0 new messages