Merge pull request #1810 from tannewt/black_line_ondisk
Fix off by one error in OnDiskBitmap
This commit is contained in:
commit
00379dbb7e
|
@ -123,12 +123,13 @@ uint32_t common_hal_displayio_ondiskbitmap_get_pixel(displayio_ondiskbitmap_t *s
|
||||||
if (x < 0 || x >= self->width || y < 0 || y >= self->height) {
|
if (x < 0 || x >= self->width || y < 0 || y >= self->height) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t location;
|
uint32_t location;
|
||||||
uint8_t bytes_per_pixel = (self->bits_per_pixel / 8) ? (self->bits_per_pixel /8) : 1;
|
uint8_t bytes_per_pixel = (self->bits_per_pixel / 8) ? (self->bits_per_pixel /8) : 1;
|
||||||
if (self->bits_per_pixel >= 8){
|
if (self->bits_per_pixel >= 8){
|
||||||
location = self->data_offset + (self->height - y) * self->stride + x * bytes_per_pixel;
|
location = self->data_offset + (self->height - y - 1) * self->stride + x * bytes_per_pixel;
|
||||||
} else {
|
} else {
|
||||||
location = self->data_offset + (self->height - y) * self->stride + x / 8;
|
location = self->data_offset + (self->height - y - 1) * self->stride + x / 8;
|
||||||
}
|
}
|
||||||
// We don't cache here because the underlying FS caches sectors.
|
// We don't cache here because the underlying FS caches sectors.
|
||||||
f_lseek(&self->file->fp, location);
|
f_lseek(&self->file->fp, location);
|
||||||
|
|
Loading…
Reference in New Issue