Merge pull request #2716 from jepler/pixelbuf-subscr

Pixelbuf: subscr: Get correct pixel value
This commit is contained in:
Scott Shawcroft 2020-03-19 10:02:08 -07:00 committed by GitHub
commit 98f5cf25a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -243,6 +243,7 @@ mp_obj_t common_hal__pixelbuf_pixelbuf_get_pixel(mp_obj_t self_in, size_t index)
if (self->pre_brightness_buffer != NULL) {
pixel_buffer = self->pre_brightness_buffer;
}
pixel_buffer += self->byteorder.bpp * index;
pixelbuf_rgbw_t *rgbw_order = &self->byteorder.byteorder;
elems[0] = MP_OBJ_NEW_SMALL_INT(pixel_buffer[rgbw_order->r]);