SaveLayer Internals / Optimizations

60 views
Skip to first unread message

corey....@gmail.com

unread,
Jun 9, 2022, 8:12:22 AM6/9/22
to skia-discuss
Before I go spelunking in the code, can someone please clarify how optimal saveLayer is behind the scenes as it relates to the requested layer bounds?

e.g. Hypothetical, say I have a surface that is only say a 1024x1024 tile, and I have a path that is 2048x2048.  If I use saveLayer or saveLayerRec with a 2048x2048 bounding box when drawing my path, is Skia behind the scenes intersecting those bounds to keep them constrained within the 1024x1024 surface bounds or do we need to tackle that optimization ourselves (user code)?

I know the docs mention "SkRect bounds suggests but does not define the layer size. " but not much beyond.

-C

Brian Salomon

unread,
Jun 9, 2022, 11:16:05 AM6/9/22
to skia-discuss
We will consider the root device's size, the current clip bounds, and any expansion required by an image filter attached to the restore paint to determine the size of the layer. The layer size is determined at the time of the saveLayer and so doesn't consider the bounds of the draws into the layer. 
Reply all
Reply to author
Forward
0 new messages