If we ask `Canvas` to draw beyond visible area, wo...
# compose-desktop
t
If we ask
Canvas
to draw beyond visible area, would it draw that OR skip it? For example. let's say my window size is 100x100, and I ask
Canvas
to
drawImage
at
1000x1000
, so would it draw that OR ignore that call since its outside the window size?
cc @Nader Jawad @romainguy
i
Skia should skip everything that is beyond visible area. So if some part of the image is visible, only pixels of that part will be rendered. If image is entirely invisible, Skia should skip this call P.S. There can be a small overhead in the first frame, because before any image draw we should fully upload it to the graphic memory. So if your image is very big (10000x10000) it should be split to small independent images. Not sure, but Skia theoretically can do it by itself. Also not sure if Skia will upload image if it isn't visible in the first frame.
🙏 1
But even if it is only visible part that will be rendered, a lot of draw calls (10000-100000) probably isn't good for performance. You should measure, and if performance isn't good - call draw methods only for visible part.
t
Understood. 👍
n
Compose does not clip content by default so you can draw outside the bounds of a canvas composable or any other draw modifier
i
can draw outside the bounds of a canvas composable or any other draw modifier
yes, but It will be always clipped by the window bounds
n
Correct it will be clipped by the window bounds or the implicit layer created if there is alpha used on a composable
🆗 1