Mistake in Custom Widget example
In Custom Widget example in documentation, there is a mistake in draw method.
The example suggest to use touchgfx::HAL::DISPLAY_WIDTH to calculate position in framebuffer.
framebuffer[absolute.x + x + (absolute.y + y) * touchgfx::HAL::DISPLAY_WIDTH] = data->at(x / scale, y / scale) ? 0x0000 : 0xffff;This is not correct, because the framebuffer is not always allocated for entire line of display, but only invalidated section, so to get position of another line the Y coordinate must be multiplied by FRAME_BUFFER_WIDTH instead:
framebuffer[absolute.x + x + (absolute.y + y) * touchgfx::HAL::FRAME_BUFFER_WIDTH] = data->at(x / scale, y / scale) ? 0x0000 : 0xffff;I believe, the same issue appears in the linked source examples.
Petr