diff --git a/src/draw/lv_draw.h b/src/draw/lv_draw.h index 0db5dbbbfa..b143f2c34a 100644 --- a/src/draw/lv_draw.h +++ b/src/draw/lv_draw.h @@ -203,8 +203,14 @@ typedef struct { * GLOBAL PROTOTYPES **********************/ +/** + * Used internally to initialize the drawing module + */ void lv_draw_init(void); +/** + * Deinitialize the drawing module + */ void lv_draw_deinit(void); /** @@ -214,12 +220,35 @@ void lv_draw_deinit(void); */ void * lv_draw_create_unit(size_t size); +/** + * Add an empty draw task to the draw task list of a layer. + * @param layer pointer to a layer + * @param coords the coordinates of the draw task + * @return the created draw task which needs to be + * further configured e.g. by added a draw descriptor + */ lv_draw_task_t * lv_draw_add_task(lv_layer_t * layer, const lv_area_t * coords); +/** + * Needs to be called when a draw task is created and configured. + * It will send an event about the new draw task to the widget + * and assign it to a draw unit. + * @param layer pointer to a layer + * @param t poinr to a draw task + */ void lv_draw_finalize_task_creation(lv_layer_t * layer, lv_draw_task_t * t); +/** + * Try dispatching draw tasks to draw units + */ void lv_draw_dispatch(void); +/** + * Used internally to try dispatching draw tasks of a specific layer + * @param disp pointer to a display on which the dispatching was requested + * @param layer pointer to a layer + * @return at least one draw task is being rendered (maybe it was taken earlier) + */ bool lv_draw_dispatch_layer(struct _lv_display_t * disp, lv_layer_t * layer); /** @@ -228,6 +257,10 @@ bool lv_draw_dispatch_layer(struct _lv_display_t * disp, lv_layer_t * layer); */ void lv_draw_dispatch_wait_for_request(void); +/** + * When a draw unit finished a draw task it needs to request dispatching + * to let LVGL assign a new draw task to it + */ void lv_draw_dispatch_request(void); /** diff --git a/src/draw/lv_draw_arc.h b/src/draw/lv_draw_arc.h index ec39c698de..c05302590a 100644 --- a/src/draw/lv_draw_arc.h +++ b/src/draw/lv_draw_arc.h @@ -25,6 +25,7 @@ extern "C" { /********************** * TYPEDEFS **********************/ + typedef struct { lv_draw_dsc_base_t base; @@ -45,8 +46,17 @@ struct _lv_layer_t; * GLOBAL PROTOTYPES **********************/ +/** + * Initialize an arc draw descriptor. + * @param dsc pointer to a draw descriptor + */ void lv_draw_arc_dsc_init(lv_draw_arc_dsc_t * dsc); +/** + * Create an arc draw task. + * @param layer pointer to a layer + * @param dsc pointer to an initialized draw descriptor variable + */ void lv_draw_arc(struct _lv_layer_t * layer, const lv_draw_arc_dsc_t * dsc); /** diff --git a/src/draw/lv_draw_image.h b/src/draw/lv_draw_image.h index 044970e938..48915b7b29 100644 --- a/src/draw/lv_draw_image.h +++ b/src/draw/lv_draw_image.h @@ -78,20 +78,24 @@ struct _lv_layer_t; * GLOBAL PROTOTYPES **********************/ +/** + * Initialize an image draw descriptor. + * @param dsc pointer to a draw descriptor + */ void lv_draw_image_dsc_init(lv_draw_image_dsc_t * dsc); /** - * Draw an image + * Create an image draw task * @param layer pointer to a layer - * @param dsc pointer to an initialized `lv_draw_image_dsc_t` variable + * @param dsc pointer to an initialized draw descriptor * @param coords the coordinates of the image */ void lv_draw_image(struct _lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv_area_t * coords); /** - * Draw a layer on an other layer + * Create a draw task to blend a layer to an other layer * @param layer pointer to a layer - * @param dsc pointer to an initialized `lv_draw_image_dsc_t` variable + * @param dsc pointer to an initialized draw descriptor * @param coords the coordinates of the layer */ void lv_draw_layer(struct _lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv_area_t * coords); diff --git a/src/draw/lv_draw_label.c b/src/draw/lv_draw_label.c index 3eb5f728a0..affaa8ebe3 100644 --- a/src/draw/lv_draw_label.c +++ b/src/draw/lv_draw_label.c @@ -29,7 +29,7 @@ * STATIC PROTOTYPES **********************/ static void draw_letter(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * dsc, const lv_point_t * pos, - const lv_font_t * font, uint32_t letter, lv_draw_letter_cb_t cb); + const lv_font_t * font, uint32_t letter, lv_draw_glyph_cb_t cb); /********************** * STATIC VARIABLES @@ -61,7 +61,7 @@ void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc) dsc->base.dsc_size = sizeof(lv_draw_label_dsc_t); } -void lv_draw_letter_dsc_init(lv_draw_glyph_dsc_t * dsc) +void lv_draw_glyph_dsc_init(lv_draw_glyph_dsc_t * dsc) { lv_memzero(dsc, sizeof(lv_draw_glyph_dsc_t)); } @@ -93,8 +93,8 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(lv_layer_t * layer, const lv_draw_label LV_PROFILER_END; } -LV_ATTRIBUTE_FAST_MEM void lv_draw_letter(lv_layer_t * layer, lv_draw_label_dsc_t * dsc, - const lv_point_t * point, uint32_t unicode_letter) +LV_ATTRIBUTE_FAST_MEM void lv_draw_character(lv_layer_t * layer, lv_draw_label_dsc_t * dsc, + const lv_point_t * point, uint32_t unicode_letter) { if(dsc->opa <= LV_OPA_MIN) return; if(dsc->font == NULL) { @@ -133,9 +133,9 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_letter(lv_layer_t * layer, lv_draw_label_dsc_ LV_PROFILER_END; } -void lv_draw_label_iterate_letters(lv_draw_unit_t * draw_unit, const lv_draw_label_dsc_t * dsc, - const lv_area_t * coords, - lv_draw_letter_cb_t cb) +void lv_draw_label_iterate_characters(lv_draw_unit_t * draw_unit, const lv_draw_label_dsc_t * dsc, + const lv_area_t * coords, + lv_draw_glyph_cb_t cb) { const lv_font_t * font = dsc->font; int32_t w; @@ -236,7 +236,7 @@ void lv_draw_label_iterate_letters(lv_draw_unit_t * draw_unit, const lv_draw_lab lv_area_t bg_coords; lv_draw_glyph_dsc_t draw_letter_dsc; - lv_draw_letter_dsc_init(&draw_letter_dsc); + lv_draw_glyph_dsc_init(&draw_letter_dsc); draw_letter_dsc.opa = dsc->opa; draw_letter_dsc.bg_coords = &bg_coords; draw_letter_dsc.color = dsc->color; @@ -365,7 +365,7 @@ void lv_draw_label_iterate_letters(lv_draw_unit_t * draw_unit, const lv_draw_lab **********************/ static void draw_letter(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * dsc, const lv_point_t * pos, - const lv_font_t * font, uint32_t letter, lv_draw_letter_cb_t cb) + const lv_font_t * font, uint32_t letter, lv_draw_glyph_cb_t cb) { lv_font_glyph_dsc_t g; diff --git a/src/draw/lv_draw_label.h b/src/draw/lv_draw_label.h index 69869dee7c..3f6bd9df82 100644 --- a/src/draw/lv_draw_label.h +++ b/src/draw/lv_draw_label.h @@ -29,6 +29,7 @@ extern "C" { **********************/ struct _lv_layer_t; + /** Store some info to speed up drawing of very large texts * It takes a lot of time to get the first visible character because * all the previous characters needs to be checked to calculate the positions. @@ -76,55 +77,81 @@ typedef struct { typedef enum { LV_DRAW_LETTER_BITMAP_FORMAT_A8, LV_DRAW_LETTER_BITMAP_FORMAT_IMAGE, -} lv_draw_letter_bitmap_format_t; +} lv_draw_glyph_bitmap_format_t; typedef struct { const uint8_t * bitmap; uint8_t * _bitmap_buf_unaligned; uint8_t * bitmap_buf; uint32_t _bitmap_buf_size; - lv_draw_letter_bitmap_format_t format; + lv_draw_glyph_bitmap_format_t format; const lv_area_t * letter_coords; const lv_area_t * bg_coords; lv_color_t color; lv_opa_t opa; } lv_draw_glyph_dsc_t; -typedef void(*lv_draw_letter_cb_t)(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * dsc, lv_draw_fill_dsc_t * fill_dsc, - const lv_area_t * fill_area); - -void lv_draw_label_iterate_letters(lv_draw_unit_t * draw_unit, const lv_draw_label_dsc_t * dsc, - const lv_area_t * coords, - lv_draw_letter_cb_t cb); +/** + * Passed as a parameter to `lv_draw_label_iterate_characters` to + * draw the characters one by one + * @param draw_unit pointer to a draw unit + * @param dsc pointer to `lv_draw_glyph_dsc_t` to describe the character to draw + * if NULL don't draw character + * @param fill_dsc pointer to a fill descriptor to draw a background for the character or + * underline or strike through + * if NULL do not fill anything + * @param fill_area the area to fill + * if NULL do not fill anything + */ +typedef void(*lv_draw_glyph_cb_t)(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * dsc, lv_draw_fill_dsc_t * fill_dsc, + const lv_area_t * fill_area); /********************** * GLOBAL PROTOTYPES **********************/ +/** + * Initialize a label draw descriptor + * @param dsc pointer to a draw descriptor + */ LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc); -void lv_draw_letter_dsc_init(lv_draw_glyph_dsc_t * dsc); +/** + * Initialize a glyph draw descriptor. + * Used internally. + * @param dsc pointer to a draw descriptor + */ +void lv_draw_glyph_dsc_init(lv_draw_glyph_dsc_t * dsc); /** - * Write a text + * Crate a draw task to render a text * @param layer pointer to a layer * @param dsc pointer to draw descriptor - * @param coords coordinates of the label - * It is managed by the draw to speed up the drawing of very long texts (thousands of lines). + * @param coords coordinates of the character */ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(lv_layer_t * layer, const lv_draw_label_dsc_t * dsc, const lv_area_t * coords); /** - * Write a text + * Crate a draw task to render a single character * @param layer pointer to a layer * @param dsc pointer to draw descriptor * @param point position of the label * @param unicode_letter the letter to draw - * It is managed by the draw to speed up the drawing of very long texts (thousands of lines). */ -LV_ATTRIBUTE_FAST_MEM void lv_draw_letter(lv_layer_t * layer, lv_draw_label_dsc_t * dsc, - const lv_point_t * point, uint32_t unicode_letter); +LV_ATTRIBUTE_FAST_MEM void lv_draw_character(lv_layer_t * layer, lv_draw_label_dsc_t * dsc, + const lv_point_t * point, uint32_t unicode_letter); + +/** + * Should be used during rendering the characters to get the position and other + * parameters of the characters + * @param draw_unit pointer to a draw unit + * @param dsc pointer to draw descriptor + * @param coords coordinates of the label + * @param cb a callback to call to draw each glyphs one by one + */ +void lv_draw_label_iterate_characters(lv_draw_unit_t * draw_unit, const lv_draw_label_dsc_t * dsc, + const lv_area_t * coords, lv_draw_glyph_cb_t cb); /*********************** * GLOBAL VARIABLES diff --git a/src/draw/lv_draw_line.h b/src/draw/lv_draw_line.h index bb2418f5e8..021ea0588e 100644 --- a/src/draw/lv_draw_line.h +++ b/src/draw/lv_draw_line.h @@ -47,12 +47,16 @@ struct _lv_layer_t; * GLOBAL PROTOTYPES **********************/ -LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc); +/** + * Initialize a line draw descriptor + * @param dsc pointer to a draw descriptor + */ +void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc); /** - * Draw a line - * @param layer pointer to a layer - * @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable + * Create a line draw task + * @param layer pointer to a layer + * @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable */ void lv_draw_line(struct _lv_layer_t * layer, const lv_draw_line_dsc_t * dsc); diff --git a/src/draw/lv_draw_mask.h b/src/draw/lv_draw_mask.h index 6c65e4f47e..bece9c8564 100644 --- a/src/draw/lv_draw_mask.h +++ b/src/draw/lv_draw_mask.h @@ -38,14 +38,16 @@ struct _lv_layer_t; * GLOBAL PROTOTYPES **********************/ +/** + * Initialize a rectangle mask draw descriptor. + * @param dsc pointer to a draw descriptor + */ LV_ATTRIBUTE_FAST_MEM void lv_draw_mask_rect_dsc_init(lv_draw_mask_rect_dsc_t * dsc); /** - * Draw a line - * @param point1 first point of the line - * @param point2 second point of the line - * @param clip the line will be drawn only in this area - * @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable + * Create a draw task to mask a rectangle from the buffer + * @param layer pointer to a layer + * @param dsc pointer to a draw descriptor */ void lv_draw_mask_rect(struct _lv_layer_t * layer, const lv_draw_mask_rect_dsc_t * dsc); diff --git a/src/draw/lv_draw_rect.h b/src/draw/lv_draw_rect.h index 3d26b28476..a8399686b4 100644 --- a/src/draw/lv_draw_rect.h +++ b/src/draw/lv_draw_rect.h @@ -109,18 +109,35 @@ typedef struct { * GLOBAL PROTOTYPES **********************/ +/** + * Initialize a rectangle draw descriptor. + * @param dsc pointer to a draw descriptor + */ LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc); +/** + * Initialize a fill draw descriptor. + * @param dsc pointer to a draw descriptor + */ void lv_draw_fill_dsc_init(lv_draw_fill_dsc_t * dsc); +/** + * Initialize a border draw descriptor. + * @param dsc pointer to a draw descriptor + */ void lv_draw_border_dsc_init(lv_draw_border_dsc_t * dsc); +/** + * Initialize a box shadow draw descriptor. + * @param dsc pointer to a draw descriptor + */ void lv_draw_box_shadow_dsc_init(lv_draw_box_shadow_dsc_t * dsc); /** - * Draw a rectangle + * The rectangle is a wrapper for fill, border, bg. image and box shadow. + * Internally fill, border, image and box shadow draw tasks will be created. * @param layer pointer to a layer - * @param dsc pointer to an initialized `lv_draw_rect_dsc_t` variable + * @param dsc pointer to an initialized draw descriptor variable * @param coords the coordinates of the rectangle */ void lv_draw_rect(struct _lv_layer_t * layer, const lv_draw_rect_dsc_t * dsc, const lv_area_t * coords); diff --git a/src/draw/lv_draw_triangle.h b/src/draw/lv_draw_triangle.h index 2f34d3b9b5..682dbfea19 100644 --- a/src/draw/lv_draw_triangle.h +++ b/src/draw/lv_draw_triangle.h @@ -36,8 +36,17 @@ typedef struct { * GLOBAL PROTOTYPES **********************/ +/** + * Initialize a triangle draw descriptor + * @param dsc pointer to a draw descriptor + */ void lv_draw_triangle_dsc_init(lv_draw_triangle_dsc_t * draw_dsc); +/** + * Create a triangle draw task + * @param layer pointer to a layer + * @param dsc pointer to an initialized `lv_draw_triangle_dsc_t` variable + */ void lv_draw_triangle(struct _lv_layer_t * layer, const lv_draw_triangle_dsc_t * draw_dsc); /********************** diff --git a/src/draw/lv_draw_vector.h b/src/draw/lv_draw_vector.h index a55534b242..87f22d4c6b 100644 --- a/src/draw/lv_draw_vector.h +++ b/src/draw/lv_draw_vector.h @@ -526,7 +526,9 @@ void lv_draw_vector(lv_vector_dsc_t * dsc); /* Traverser for task list */ typedef void (*vector_draw_task_cb)(void * ctx, const lv_vector_path_t * path, const lv_vector_draw_dsc_t * dsc); + void _lv_vector_for_each_destroy_tasks(lv_ll_t * task_list, vector_draw_task_cb cb, void * data); + #endif /* LV_USE_VECTOR_GRAPHIC */ #ifdef __cplusplus diff --git a/src/draw/lv_image_buf.h b/src/draw/lv_image_buf.h index 79e5199a4c..291e7a37f9 100644 --- a/src/draw/lv_image_buf.h +++ b/src/draw/lv_image_buf.h @@ -141,13 +141,13 @@ typedef struct { **********************/ /** - * Set the palette color of an indexed image. Valid only for `LV_IMAGE_CF_INDEXED1/2/4/8` + * Set the palette color of an indexed image. Valid only for `LV_COLOR_FORMAT_I1/2/4/8` * @param dsc pointer to an image descriptor * @param id the palette color to set: - * - for `LV_IMAGE_CF_INDEXED1`: 0..1 - * - for `LV_IMAGE_CF_INDEXED2`: 0..3 - * - for `LV_IMAGE_CF_INDEXED4`: 0..15 - * - for `LV_IMAGE_CF_INDEXED8`: 0..255 + * - for `LV_COLOR_FORMAT_I1`: 0..1 + * - for `LV_COLOR_FORMAT_I2`: 0..3 + * - for `LV_COLOR_FORMAT_I4`: 0..15 + * - for `LV_COLOR_FORMAT_I8`: 0..255 * @param c the color to set in lv_color32_t format */ void lv_image_buf_set_palette(lv_image_dsc_t * dsc, uint8_t id, lv_color32_t c); diff --git a/src/draw/lv_image_decoder.h b/src/draw/lv_image_decoder.h index 329c6e3950..e1112abfb8 100644 --- a/src/draw/lv_image_decoder.h +++ b/src/draw/lv_image_decoder.h @@ -198,7 +198,7 @@ lv_result_t lv_image_decoder_get_info(const void * src, lv_image_header_t * head * 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_drv_register())`) * 2) Variable: Pointer to an `lv_image_dsc_t` variable * 3) Symbol: E.g. `LV_SYMBOL_OK` - * @param color The color of the image with `LV_IMAGE_CF_ALPHA_...` + * @param color The color of the image with `LV_COLOR_FORMAT_ALPHA_...` * @param args args about how the image should be opened. * @return LV_RESULT_OK: opened the image. `dsc->img_data` and `dsc->header` are set. * LV_RESULT_INVALID: none of the registered image decoders were able to open the image. diff --git a/src/draw/nxp/vglite/lv_draw_vglite_label.c b/src/draw/nxp/vglite/lv_draw_vglite_label.c index edff907e1b..c28f420d85 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite_label.c +++ b/src/draw/nxp/vglite/lv_draw_vglite_label.c @@ -73,7 +73,7 @@ void lv_draw_vglite_label(lv_draw_unit_t * draw_unit, const lv_draw_label_dsc_t { if(dsc->opa <= LV_OPA_MIN) return; - lv_draw_label_iterate_letters(draw_unit, dsc, coords, _draw_vglite_letter); + lv_draw_label_iterate_characters(draw_unit, dsc, coords, _draw_vglite_letter); } /********************** diff --git a/src/draw/renesas/dave2d/lv_draw_dave2d_label.c b/src/draw/renesas/dave2d/lv_draw_dave2d_label.c index d4ac288790..5eea263ca0 100644 --- a/src/draw/renesas/dave2d/lv_draw_dave2d_label.c +++ b/src/draw/renesas/dave2d/lv_draw_dave2d_label.c @@ -12,7 +12,7 @@ void lv_draw_dave2d_label(lv_draw_dave2d_unit_t * u, const lv_draw_label_dsc_t * unit = u; - lv_draw_label_iterate_letters(&u->base_unit, dsc, coords, lv_draw_dave2d_draw_letter_cb); + lv_draw_label_iterate_characters(&u->base_unit, dsc, coords, lv_draw_dave2d_draw_letter_cb); } diff --git a/src/draw/sw/blend/lv_draw_sw_blend.h b/src/draw/sw/blend/lv_draw_sw_blend.h index 0124f36e99..eb993585a8 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend.h +++ b/src/draw/sw/blend/lv_draw_sw_blend.h @@ -77,7 +77,7 @@ typedef struct { /** * Call the blend function of the `layer`. - * @param layer pointer to a draw context + * @param draw_unit pointer to a draw unit * @param dsc pointer to an initialized blend descriptor */ void lv_draw_sw_blend(struct _lv_draw_unit_t * draw_unit, const lv_draw_sw_blend_dsc_t * dsc); diff --git a/src/draw/sw/lv_draw_sw.h b/src/draw/sw/lv_draw_sw.h index 8a3a7e1295..0f2a2fd4fa 100644 --- a/src/draw/sw/lv_draw_sw.h +++ b/src/draw/sw/lv_draw_sw.h @@ -55,36 +55,119 @@ typedef struct { * GLOBAL PROTOTYPES **********************/ +/** + * Initialize the SW renderer. Called in internally. + * It creates as many SW renderers as defined in LV_DRAW_SW_DRAW_UNIT_CNT + */ void lv_draw_sw_init(void); +/** + * Deinitialize the SW renderers + */ void lv_draw_sw_deinit(void); -LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_image(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, - const lv_area_t * coords); - +/** + * Fill an area using SW render. Handle gradient and radius. + * @param draw_unit pointer to a draw unit + * @param dsc the draw descriptor + * @param coords the coordinates of the rectangle + */ void lv_draw_sw_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * dsc, const lv_area_t * coords); +/** + * Draw border with SW render. + * @param draw_unit pointer to a draw unit + * @param dsc the draw descriptor + * @param coords the coordinates of the rectangle + */ void lv_draw_sw_border(lv_draw_unit_t * draw_unit, const lv_draw_border_dsc_t * dsc, const lv_area_t * coords); +/** + * Draw box shadow with SW render. + * @param draw_unit pointer to a draw unit + * @param dsc the draw descriptor + * @param coords the coordinates of the rectangle for which the box shadow should be drawn + */ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_dsc_t * dsc, const lv_area_t * coords); +/** + * Draw an image with SW render. It handles image decoding, tiling, transformations, and recoloring. + * @param draw_unit pointer to a draw unit + * @param dsc the draw descriptor + * @param coords the coordinates of the image + */ +void lv_draw_sw_image(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, + const lv_area_t * coords); + +/** + * Draw a label with SW render. + * @param draw_unit pointer to a draw unit + * @param dsc the draw descriptor + * @param coords the coordinates of the label + */ void lv_draw_sw_label(lv_draw_unit_t * draw_unit, const lv_draw_label_dsc_t * dsc, const lv_area_t * coords); +/** + * Draw an arc with SW render. + * @param draw_unit pointer to a draw unit + * @param dsc the draw descriptor + * @param coords the coordinates of the arc + */ void lv_draw_sw_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * dsc, const lv_area_t * coords); -LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t * dsc); +/** + * Draw a line with SW render. + * @param draw_unit pointer to a draw unit + * @param dsc the draw descriptor + */ +void lv_draw_sw_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t * dsc); +/** + * Blend a layer with SW render + * @param draw_unit pointer to a draw unit + * @param dsc the draw descriptor + * @param coords the coordinates of the layer + */ void lv_draw_sw_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, const lv_area_t * coords); +/** + * Draw a triangle with SW render. + * @param draw_unit pointer to a draw unit + * @param dsc the draw descriptor + */ void lv_draw_sw_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle_dsc_t * dsc); +/** + * Mask out a rectangle with radius from a current layer + * @param draw_unit pointer to a draw unit + * @param dsc the draw descriptor + * @param coords the coordinates of the mask + */ void lv_draw_sw_mask_rect(lv_draw_unit_t * draw_unit, const lv_draw_mask_rect_dsc_t * dsc, const lv_area_t * coords); +/** + * Used internally to get a transformed are of an image + * @param draw_unit pointer to a draw unit + * @param dest_area the area to calculate, i.e. get this area from the transformed image + * @param src_buf the source buffer + * @param src_w source buffer width in pixels + * @param src_h source buffer height in pixels + * @param src_stride source buffer stride in bytes + * @param dsc the draw descriptor + * @param sup supplementary data + * @param cf color format of the source buffer + * @param dest_buf the destination buffer + */ void lv_draw_sw_transform(lv_draw_unit_t * draw_unit, const lv_area_t * dest_area, const void * src_buf, int32_t src_w, int32_t src_h, int32_t src_stride, const lv_draw_image_dsc_t * draw_dsc, const lv_draw_image_sup_t * sup, lv_color_format_t cf, void * dest_buf); #if LV_USE_VECTOR_GRAPHIC +/** + * Draw vector graphics with SW render. + * @param draw_unit pointer to a draw unit + * @param dsc the draw descriptor + */ void lv_draw_sw_vector(lv_draw_unit_t * draw_unit, const lv_draw_vector_task_dsc_t * dsc); #endif @@ -96,6 +179,17 @@ void lv_draw_sw_vector(lv_draw_unit_t * draw_unit, const lv_draw_vector_task_dsc */ void lv_draw_sw_rgb565_swap(void * buf, int32_t buf_size_px); +/** + * Rotate a buffer into an other buffer + * @param src the source buffer + * @param dest the destination buffer + * @param src_width source width in pixels + * @param src_height source height in pixels + * @param src_sride source stride in bytes (number of bytes in a row) + * @param dest_stride destination stride in bytes (number of bytes in a row) + * @param rotation LV_DISPLAY_ROTATION_0/90/180/270 + * @param color_format LV_COLOR_FORMAT_RGB565/RGB888/XRGB8888/ARGB8888 + */ void lv_draw_sw_rotate(const void * src, void * dest, int32_t src_width, int32_t src_height, int32_t src_sride, int32_t dest_stride, lv_display_rotation_t rotation, lv_color_format_t color_format); diff --git a/src/draw/sw/lv_draw_sw_img.c b/src/draw/sw/lv_draw_sw_img.c index 0bbc00173e..340ad497f8 100644 --- a/src/draw/sw/lv_draw_sw_img.c +++ b/src/draw/sw/lv_draw_sw_img.c @@ -150,8 +150,8 @@ void lv_draw_sw_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dr #endif } -LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_image(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, - const lv_area_t * coords) +void lv_draw_sw_image(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, + const lv_area_t * coords) { if(!draw_dsc->tile) { _lv_draw_image_normal_helper(draw_unit, draw_dsc, coords, img_draw_core); diff --git a/src/draw/sw/lv_draw_sw_letter.c b/src/draw/sw/lv_draw_sw_letter.c index 828b635718..72141c7ebb 100644 --- a/src/draw/sw/lv_draw_sw_letter.c +++ b/src/draw/sw/lv_draw_sw_letter.c @@ -54,7 +54,7 @@ void lv_draw_sw_label(lv_draw_unit_t * draw_unit, const lv_draw_label_dsc_t * ds if(dsc->opa <= LV_OPA_MIN) return; LV_PROFILER_BEGIN; - lv_draw_label_iterate_letters(draw_unit, dsc, coords, draw_letter_cb); + lv_draw_label_iterate_characters(draw_unit, dsc, coords, draw_letter_cb); LV_PROFILER_END; } diff --git a/src/draw/sw/lv_draw_sw_line.c b/src/draw/sw/lv_draw_sw_line.c index fbc9b802bc..26011f0361 100644 --- a/src/draw/sw/lv_draw_sw_line.c +++ b/src/draw/sw/lv_draw_sw_line.c @@ -42,7 +42,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(lv_draw_unit_t * draw_unit, cons * GLOBAL FUNCTIONS **********************/ -LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t * dsc) +void lv_draw_sw_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t * dsc) { if(dsc->width == 0) return; if(dsc->opa <= LV_OPA_MIN) return; diff --git a/src/misc/lv_color.h b/src/misc/lv_color.h index ff1ef70b09..5d80352a6a 100644 --- a/src/misc/lv_color.h +++ b/src/misc/lv_color.h @@ -164,15 +164,15 @@ typedef uint8_t lv_color_format_t; /** * Get the pixel size of a color format in bits, bpp - * @param src_cf a color format (`LV_COLOR_FORMAT_...`) - * @return the pixel size in bits + * @param src_cf a color format (`LV_COLOR_FORMAT_...`) + * @return the pixel size in bits */ uint8_t lv_color_format_get_bpp(lv_color_format_t cf); /** * Get the pixel size of a color format in bytes - * @param src_cf a color format (`LV_COLOR_FORMAT_...`) - * @return the pixel size in bytes + * @param src_cf a color format (`LV_COLOR_FORMAT_...`) + * @return the pixel size in bytes */ static inline uint8_t lv_color_format_get_size(lv_color_format_t cf) { @@ -181,8 +181,8 @@ static inline uint8_t lv_color_format_get_size(lv_color_format_t cf) /** * Check if a color format has alpha channel or not - * @param src_cf a color format (`LV_IMAGE_CF_...`) - * @return true: has alpha channel; false: doesn't have alpha channel + * @param src_cf a color format (`LV_COLOR_FORMAT_...`) + * @return true: has alpha channel; false: doesn't have alpha channel */ bool lv_color_format_has_alpha(lv_color_format_t src_cf); diff --git a/src/widgets/canvas/lv_canvas.h b/src/widgets/canvas/lv_canvas.h index 8d51d36475..9e4fc89174 100644 --- a/src/widgets/canvas/lv_canvas.h +++ b/src/widgets/canvas/lv_canvas.h @@ -61,7 +61,7 @@ lv_obj_t * lv_canvas_create(lv_obj_t * parent); * @param canvas pointer to a canvas object * @param w width of the canvas * @param h height of the canvas - * @param cf color format. `LV_IMAGE_CF_...` + * @param cf color format. `LV_COLOR_FORMAT...` */ void lv_canvas_set_buffer(lv_obj_t * canvas, void * buf, int32_t w, int32_t h, lv_color_format_t cf); diff --git a/src/widgets/span/lv_span.c b/src/widgets/span/lv_span.c index 4a445d76c1..48ac19dac9 100644 --- a/src/widgets/span/lv_span.c +++ b/src/widgets/span/lv_span.c @@ -1004,7 +1004,7 @@ static void lv_draw_span(lv_obj_t * obj, lv_layer_t * layer) if(ellipsis_valid && pos.x + letter_w + pinfo->letter_space > ellipsis_width) { for(int ell = 0; ell < 3; ell++) { - lv_draw_letter(layer, &label_draw_dsc, &pos, '.'); + lv_draw_character(layer, &label_draw_dsc, &pos, '.'); pos.x = pos.x + dot_letter_w + pinfo->letter_space; } if(pos.x <= ellipsis_width) { @@ -1013,7 +1013,7 @@ static void lv_draw_span(lv_obj_t * obj, lv_layer_t * layer) break; } else { - lv_draw_letter(layer, &label_draw_dsc, &pos, letter); + lv_draw_character(layer, &label_draw_dsc, &pos, letter); if(letter_w > 0) { pos.x = pos.x + letter_w + pinfo->letter_space; }