Skip to content

Commit 070b0dc

Browse files
committed
Pixelbuf: subscr: Get correct pixel value
Previously, the 0th pixel's value was always returned
1 parent ac034d0 commit 070b0dc

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

shared-module/_pixelbuf/PixelBuf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ mp_obj_t common_hal__pixelbuf_pixelbuf_get_pixel(mp_obj_t self_in, size_t index)
254254
if (self->pre_brightness_buffer != NULL) {
255255
pixel_buffer = self->pre_brightness_buffer;
256256
}
257+
pixel_buffer += self->byteorder.bpp * index;
257258

258259
pixelbuf_rgbw_t *rgbw_order = &self->byteorder.byteorder;
259260
elems[0] = MP_OBJ_NEW_SMALL_INT(pixel_buffer[rgbw_order->r]);

0 commit comments

Comments
 (0)