Very Large Surface Woes.

74 views
Skip to first unread message

Corey Lucier

unread,
Nov 1, 2018, 8:48:40 AM11/1/18
to skia-discuss
I am trying to dynamically generate a very large retina (raster) image with Skia and a good portion of the canvas contents drawn is omitted from the final result.

The image itself in this case is exactly 21400 x 4000.  The contents up to about 16000 is visible, the remainder is not.

What is the actual raster surface/canvas limitation here I am hitting, and what would you recommend to solve this.  Even if I tile things in some way if I can't address > 16000 portion of my canvas how will I assemble the tiles for instance on my offscreen surface/canvas?

Thanks,

C

Corey Lucier

unread,
Nov 1, 2018, 9:02:33 AM11/1/18
to skia-discuss
Actually, after further debugging... it seems that there might be a maximum clip rect?  In this case we have set a clip rect to bound the entire image and everything beyond the 16K point gets clipped. 

Also any sub-clip rects or clip shapes beyond the 16K point aren't showing up.

Bug that we should report or known limitation?


Message has been deleted

Mike Reed

unread,
Nov 1, 2018, 11:55:14 AM11/1/18
to skia-d...@googlegroups.com
Hmmmm
- gpu or cpu backend?
- show a snippet?

--
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 post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

Mike Reed

unread,
Nov 1, 2018, 11:56:12 AM11/1/18
to skia-d...@googlegroups.com
Ignore my prev -- didn't see this info.

--

Corey Lucier

unread,
Nov 1, 2018, 12:01:27 PM11/1/18
to skia-discuss
CPU.

I am trying to recreate with a fiddle but no luck.

If I dump a SKP file is there a skp dump utility that will show the skia calls I am making? (This is M69).  If I can do this I might be able to fine-tune my fiddle repro.


Corey Lucier

unread,
Nov 1, 2018, 12:21:47 PM11/1/18
to skia-discuss
...a skip viewer that is for my skp file. I can generate the SKP file myself.

Mike Klein

unread,
Nov 1, 2018, 12:32:07 PM11/1/18
to skia-d...@googlegroups.com
Yes, we have an .skp debugger, which you can either use over the web at https://debugger.skia.org/ or build and yourself in the Skia tree (the binary is called skiaserve).

On Thu, Nov 1, 2018 at 12:21 PM Corey Lucier <corey....@gmail.com> wrote:
...a skip viewer that is for my skp file. I can generate the SKP file myself.

--

Mike Klein

unread,
Nov 1, 2018, 12:32:33 PM11/1/18
to skia-d...@googlegroups.com
... or build and run yourself ...

Corey Lucier

unread,
Nov 1, 2018, 1:03:56 PM11/1/18
to skia-discuss
So of course it doesn't repro in the Skia debugger... but at least I captured my steps.  See attached.

There must be something to explain not being able to clip beyond 16,384 (x or y).

artboard.skp

Corey Lucier

unread,
Nov 1, 2018, 1:21:53 PM11/1/18
to skia-discuss
So the debugger seems capped at 8k x 8k...so I can't use it to repro my issue per say.


Corey Lucier

unread,
Nov 1, 2018, 1:42:17 PM11/1/18
to skia-discuss
In fact it's not showing my drawing calls (drawRect) in my SKP if I draw outside 8k.  Similar to problem I have in our app except that is capped at 16K.

Corey Lucier

unread,
Nov 1, 2018, 2:37:39 PM11/1/18
to skia-discuss
OK, Finally reproduced.


If you change the position we draw the blue rect to anything over 16K it is clipped.

Rectangle clip masks work great..just not RRect or shape clips.

Roman Petrenko

unread,
Aug 2, 2022, 1:32:09 AMAug 2
to skia-discuss
I just ran into this issue too. Nothing is being drawn outside the (0,0 -> 16K,16K) bounds if you use clipping. Without clipping, things get drawn fine. Is there a way to work around this limitation?

Thanks in advance.

Brian Salomon

unread,
Aug 2, 2022, 11:43:06 AMAug 2
to skia-discuss
You might want to take a look at this discussion:


The solution used there may work for you.

Roman Petrenko

unread,
Aug 2, 2022, 7:51:25 PMAug 2
to skia-discuss
Hi Brian, thanks for the advice. Yes, a tiling solution would help, but I'd like to point out that right now it's possible to create a surface having more than 16384 pixels in one dimension (for example, 20000*1000 pixels), and most of the drawing functionality will work fine, except cropping. So I think there is a bug in Skia related specifically to cropping.

Brian Salomon

unread,
Aug 3, 2022, 8:56:17 AMAug 3
to skia-d...@googlegroups.com
Hi Roman,

Do you have an example you could share? Is it with any clip set?

Best,
Brian

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


--

Brian Salomon | Office Hours: go/bsalomon-office | bsal...@google.com

Roman Petrenko

unread,
Aug 3, 2022, 6:44:15 PM (13 days ago) Aug 3
to skia-discuss
Hi Brian,

The fiddle that was previously shared in this thread still reproduces the issue even though it's been 4 years: https://fiddle.skia.org/c/ab0c5f4bb2ffec05677688566d30009a

Best Regards,
Roman

Michael Ludwig

unread,
Aug 4, 2022, 10:54:59 AM (12 days ago) Aug 4
to skia-discuss
Hi Roman,

Skia fiddles don't re-compute their images, so that output was what's been saved since the fiddle was made. Making a white space change shows that the SkCanvas::drawBitmap API has been removed, and fixing that (https://fiddle.skia.org/c/b3376a02c819579bf2866288a9f05646) leads to a server sandbox violation, most likely trying to allocate the space for the very large bitmap.  I will try and run this locally and see if I can identify the cause.

Mike Reed

unread,
Aug 4, 2022, 11:17:19 AM (12 days ago) Aug 4
to skia-d...@googlegroups.com
I've also been confused by 'stale' fiddle results.

I wonder if the cache could also include which skia version built the image -- so it would know it was stale on a re-run attempt.



--
"I think I can safely say that nobody understands quantum mechanics." -- Richard Feynman
"It ain't what you don't know that gets you into trouble. It's what you know for sure that just ain't so." -- Mark Twain
"I am pleased to see that we have differences" -- Surak

Michael Ludwig

unread,
Aug 4, 2022, 11:46:22 AM (12 days ago) Aug 4
to skia-discuss
I was able to reproduce this locally. It looks like SkRegion (which is used for handling the clip shape in this case) is not able to convert an SkPath with such large coordinates. It should be capable of representing it but there are some internal precision limits that it was running into. I have a bug here to track this work: https://bugs.chromium.org/p/skia/issues/detail?id=13626 but it'll be a little bit before I can tackle it.

Tiling at the SkCanvas level will bypass this and also allow you to take advantage of GPU canvases that have a more restricted image size already, so I would recommend pursuing that if you can.

Reply all
Reply to author
Forward
0 new messages