How to add dummy bytes to make the line width multiple of 64/128 bytes? #5406
-
Hi guys, I'm using
for optimal performance. My question is, how would I do it with Slint? I'm using 24bpp (RGB888) color, and the width of the screen is 800. That's 2,400 bytes if my math is correct, not a multiple of 64/128. I would need to add 32 bytes to the end of each line (and then set the pitch in LTDC, but that's beyond the point). Is it possible? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If you are using the SoftwareRenderer::render, you can allocate a bigger buffer and change the stride. But unfortunately, the stride being in pixel and not byte, you can't add 32 bytes :-(. What you can do is add 12 pixels (288 bytes) at the end of each lines. That's some wasted spaces, but maybe that helps. In a future version of Slint we should change the software renderer to have a Another solution is to render line by line into the buffer using the |
Beta Was this translation helpful? Give feedback.
If you are using the SoftwareRenderer::render, you can allocate a bigger buffer and change the stride. But unfortunately, the stride being in pixel and not byte, you can't add 32 bytes :-(.
What you can do is add 12 pixels (288 bytes) at the end of each lines. That's some wasted spaces, but maybe that helps.
In a future version of Slint we should change the software renderer to have a
trait TargetBuffer
instead ofTargetPixel
which would have a function to retrieve lines.Another solution is to render line by line into the buffer using the
render_by_line
function