@@ -557,6 +557,8 @@ bool displayio_tilegrid_fill_area(displayio_tilegrid_t *self,
557
557
const int x_subgrid_start = x_pixel_start % tile_width ;
558
558
const int x_grid_start = x_pixel_start / tile_width ;
559
559
560
+ const mp_obj_type_t * pixel_shader_type = mp_obj_get_type (self -> pixel_shader );
561
+
560
562
int old_tile = 0 , tile_row = 0 , tile_col = 0 ;
561
563
for (input_pixel .y = start_y ; input_pixel .y < end_y ; ++ input_pixel .y ) {
562
564
int16_t row_start = start + (input_pixel .y - start_y + y_shift ) * y_stride ; // in pixels
@@ -617,12 +619,12 @@ bool displayio_tilegrid_fill_area(displayio_tilegrid_t *self,
617
619
input_pixel .pixel = get_pixel_func (self -> bitmap , input_pixel .tile_x , input_pixel .tile_y );
618
620
619
621
output_pixel .opaque = true;
620
- if (self -> pixel_shader == mp_const_none ) {
621
- output_pixel .pixel = input_pixel .pixel ;
622
- } else if (mp_obj_is_type (self -> pixel_shader , & displayio_palette_type )) {
622
+ if (pixel_shader_type == & displayio_palette_type ) {
623
623
output_pixel .opaque = displayio_palette_get_color (self -> pixel_shader , colorspace , input_pixel .pixel , & output_pixel .pixel );
624
- } else if (mp_obj_is_type ( self -> pixel_shader , & displayio_colorconverter_type ) ) {
624
+ } else if (pixel_shader_type == & displayio_colorconverter_type ) {
625
625
displayio_colorconverter_convert (self -> pixel_shader , colorspace , & input_pixel , & output_pixel );
626
+ } else {
627
+ output_pixel .pixel = input_pixel .pixel ;
626
628
}
627
629
pixel_changed = false;
628
630
}
0 commit comments