2022-01-06 02:44 AM
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
2022-02-24 02:56 AM
Hello PWagn.1,
Yes, you're right. We will fix that soon.
Thanks for your contribution :)
/Osman