Mistake in Custom Widget example
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2022-01-06 2: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
Labels:
- Labels:
-
TouchGFX
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2022-02-24 2:56 AM
Hello PWagn.1,
Yes, you're right. We will fix that soon.
Thanks for your contribution :)
/Osman
Osman SOYKURT
ST Software Developer | TouchGFX
ST Software Developer | TouchGFX
