@@ -706,7 +706,6 @@ static esp_err_t rgb_panel_draw_bitmap(esp_lcd_panel_t *panel, int x_start, int
706706{
707707 esp_rgb_panel_t * rgb_panel = __containerof (panel , esp_rgb_panel_t , base );
708708 ESP_RETURN_ON_FALSE (rgb_panel -> num_fbs > 0 , ESP_ERR_NOT_SUPPORTED , TAG , "no frame buffer installed" );
709- assert ((x_start < x_end ) && (y_start < y_end ) && "start position must be smaller than end position" );
710709
711710 // check if we need to copy the draw buffer (pointed by the color_data) to the driver's frame buffer
712711 bool do_copy = false;
@@ -726,18 +725,19 @@ static esp_err_t rgb_panel_draw_bitmap(esp_lcd_panel_t *panel, int x_start, int
726725 y_start += rgb_panel -> y_gap ;
727726 x_end += rgb_panel -> x_gap ;
728727 y_end += rgb_panel -> y_gap ;
729- // round the boundary
728+
729+ // clip to boundaries
730730 int h_res = rgb_panel -> timings .h_res ;
731731 int v_res = rgb_panel -> timings .v_res ;
732732 if (rgb_panel -> rotate_mask & ROTATE_MASK_SWAP_XY ) {
733- x_start = MIN (x_start , v_res );
733+ x_start = MAX (x_start , 0 );
734734 x_end = MIN (x_end , v_res );
735- y_start = MIN (y_start , h_res );
735+ y_start = MAX (y_start , 0 );
736736 y_end = MIN (y_end , h_res );
737737 } else {
738- x_start = MIN (x_start , h_res );
738+ x_start = MAX (x_start , 0 );
739739 x_end = MIN (x_end , h_res );
740- y_start = MIN (y_start , v_res );
740+ y_start = MAX (y_start , 0 );
741741 y_end = MIN (y_end , v_res );
742742 }
743743
0 commit comments