How to GetPicture() and serialize() to skp file incrementally

54 views
Skip to first unread message

Daolin Liu

unread,
May 8, 2023, 1:26:59 PM5/8/23
to Chromium-dev
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

K. Moon

unread,
May 8, 2023, 1:58:51 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.

--
--
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.

K. Moon

unread,
May 10, 2023, 12:48:26 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.

On Wed, May 10, 2023 at 1:19 AM Daolin Liu <daoshu...@gmail.com> wrote:
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.

Daolin Liu

unread,
May 11, 2023, 6:02:47 PM5/11/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.


在2023年5月9日星期二 UTC+8 01:58:51<K. Moon> 写道:
Reply all
Reply to author
Forward
0 new messages