Skip to content

Commit eef3e85

Browse files
soburifabiobaltieri
authored andcommitted
samples: drivers: display: Fix drawing on non-x8 height VTILED display
VTILED displays with a height other than x8 fail to draw bottom-row tiles. This is because it extends beyond the display area. I fixed the drawing area to be cropped to fit within the display. Signed-off-by: TOKITA Hiroshi <[email protected]>
1 parent 0b87cb1 commit eef3e85

File tree

1 file changed

+8
-0
lines changed
  • samples/drivers/display/src

1 file changed

+8
-0
lines changed

samples/drivers/display/src/main.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,14 @@ int main(void)
298298
buf_desc.height = h_step;
299299

300300
for (int idx = 0; idx < capabilities.y_resolution; idx += h_step) {
301+
/*
302+
* Tweaking the height value not to draw outside of the display.
303+
* It is required when using a monochrome display whose vertical
304+
* resolution can not be divided by 8.
305+
*/
306+
if ((capabilities.y_resolution - idx) < h_step) {
307+
buf_desc.height = (capabilities.y_resolution - idx);
308+
}
301309
display_write(display_dev, 0, idx, &buf_desc, buf);
302310
}
303311

0 commit comments

Comments
 (0)