tinygo-org / drivers

TinyGo drivers for sensors, displays, wireless adaptors, and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
584 stars 180 forks source link

pixel: fix `Image[Monochrome].Set` for larger images #683

Closed aykevl closed 1 month ago

aykevl commented 1 month ago

For bigger images, the pixel index might not fit in a int16. Therefore, int is needed during the calculation.

While fixing this bug, I've added a few tests that verify the Image implementation by creating images, filling them with random data, and then checking whether they still contain the same data. This test failed before the patch.

deadprogram commented 1 month ago

Thanks for the fix @aykevl looks good. Now merging.