mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-21 22:52:46 +08:00
feat(EVE): support fonts with a stride alignment (#8937)
This commit is contained in:
@@ -23,6 +23,7 @@ Limitations
|
||||
|
||||
- Image format, size, and count limit.
|
||||
- Font format, size, and count limit.
|
||||
- Only 4 bpp fonts are supported for now.
|
||||
- The total number of tasks rendered per refresh has an upper limit.
|
||||
- Layers are not supported.
|
||||
|
||||
@@ -195,6 +196,24 @@ It can be called multiple times with different strings.
|
||||
lv_draw_eve_pre_upload_font_range(disp, &lv_font_montserrat_48, ':', ':');
|
||||
|
||||
|
||||
Supported Asset Formats
|
||||
-----------------------
|
||||
|
||||
The supported image color formats are RGB565, RGB565A8, ARGB8888, and L8. It's good to
|
||||
note that RGB565A8 and ARGB8888 are converted to ARGB4444 before being uploaded to EVE. The
|
||||
implication of this is that a reduced color depth will be realized on the display compared
|
||||
to the original asset. The initial asset upload time may also be longer.
|
||||
|
||||
The only supported font format is 4 bpp. If the font's stride is not 1, it will be converted
|
||||
to stride 1 before being uploaded to EVE. If the font already has a stride of 1, it will be
|
||||
uploaded directly without conversion, which can improve asset upload time.
|
||||
|
||||
To generate a font with a specific stride (such as 1), you should use the
|
||||
`offline font converter <https://github.com/lvgl/lv_font_conv>`__ and specify a stride
|
||||
argument on the command line, e.g. ``--stride 1``. A stride of 0 is the default. This means
|
||||
that the bits are packed even across rows, but EVE cannot use fonts that are packed across rows.
|
||||
|
||||
|
||||
.. _eve register access:
|
||||
|
||||
EVE Register Access
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
static void lv_draw_eve_letter_cb(lv_draw_task_t * t, lv_draw_glyph_dsc_t * glyph_draw_dsc,
|
||||
lv_draw_fill_dsc_t * fill_draw_dsc, const lv_area_t * fill_area);
|
||||
static void font_bitmap_to_ramg(uint32_t addr, const uint8_t * src, uint32_t width,
|
||||
uint32_t height);
|
||||
uint32_t height, uint8_t src_stride_align);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -103,7 +103,8 @@ uint32_t lv_draw_eve_label_upload_glyph(bool burst_is_active, const lv_font_fmt_
|
||||
EVE_end_cmd_burst();
|
||||
}
|
||||
|
||||
font_bitmap_to_ramg(ramg_addr, glyph_bitmap, g_box_w, g_box_h);
|
||||
uint8_t glyph_bitmap_stride_align = font_dsc->stride;
|
||||
font_bitmap_to_ramg(ramg_addr, glyph_bitmap, g_box_w, g_box_h, glyph_bitmap_stride_align);
|
||||
|
||||
if(burst_is_active) {
|
||||
EVE_start_cmd_burst();
|
||||
@@ -164,16 +165,26 @@ static void lv_draw_eve_letter_cb(lv_draw_task_t * t, lv_draw_glyph_dsc_t * glyp
|
||||
}
|
||||
|
||||
static void font_bitmap_to_ramg(uint32_t addr, const uint8_t * src, uint32_t width,
|
||||
uint32_t height)
|
||||
uint32_t height, uint8_t src_stride_align)
|
||||
{
|
||||
uint32_t stride = (width + 1) / 2;
|
||||
|
||||
if(width % 2 == 0) {
|
||||
if(src_stride_align == 1 || (src_stride_align == 0 && width % 2 == 0)) {
|
||||
uint32_t size = stride * height;
|
||||
EVE_memWrite_flash_buffer(addr, src, size);
|
||||
return;
|
||||
}
|
||||
|
||||
if(src_stride_align > 0) {
|
||||
uint32_t src_stride = LV_ALIGN_UP(stride, src_stride_align);
|
||||
for(uint32_t y = 0; y < height; y++) {
|
||||
EVE_memWrite_sram_buffer(addr, src, stride);
|
||||
addr += stride;
|
||||
src += src_stride;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t * row_buf = lv_malloc(stride);
|
||||
LV_ASSERT_MALLOC(row_buf);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user