Skip to content

Commit

Permalink
draw: dma2d: add support for ARGB1555 color on top of RGB565 format
Browse files Browse the repository at this point in the history
Signed-off-by: Felipe Neves <[email protected]>
  • Loading branch information
uLipe committed Jan 6, 2025
1 parent f27c65b commit 4392640
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion demos/ebike/generated/font_ebike_130.c
Original file line number Diff line number Diff line change
Expand Up @@ -2724,7 +2724,7 @@ static const uint8_t kern_pair_glyph_ids[] = {
* 4.4 format which needs to scaled with `kern_scale`*/
static const int8_t kern_pair_values[] = {
-20, 14, -54
};
};

/*Collect the kern pair's data in one place*/
static const lv_font_fmt_txt_kern_pair_t kern_pairs = {
Expand Down
2 changes: 1 addition & 1 deletion demos/ebike/generated/font_ebike_56.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ static const uint8_t kern_pair_glyph_ids[] = {
* 4.4 format which needs to scaled with `kern_scale`*/
static const int8_t kern_pair_values[] = {
-30, -9, -42, 6, -23
};
};

/*Collect the kern pair's data in one place*/
static const lv_font_fmt_txt_kern_pair_t kern_pairs = {
Expand Down
2 changes: 1 addition & 1 deletion demos/high_res/lv_demo_high_res_app_smart_home.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ static void create_widget3(lv_demo_high_res_ctx_t * c, lv_obj_t * widgets)

lv_obj_t * play_pause_img = lv_image_create(controls);
lv_image_set_src(play_pause_img, c->imgs[lv_subject_get_int(&c->api.subjects.music_play) ? IMG_PLAY_ICON :
IMG_PLAY_ICON_1]);
IMG_PLAY_ICON_1]);
lv_obj_set_style_image_recolor(play_pause_img, lv_color_white(), 0);
lv_obj_set_style_image_recolor_opa(play_pause_img, LV_OPA_COVER, 0);
lv_obj_add_flag(play_pause_img, LV_OBJ_FLAG_CLICKABLE);
Expand Down
4 changes: 2 additions & 2 deletions demos/high_res/lv_demo_high_res_top_margin.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ lv_obj_t * lv_demo_high_res_top_margin_create(lv_obj_t * parent, int32_t pad_hor
lv_obj_t * health_icon = create_icon(top_margin_right_cluster, &c->top_margin_health_subject, &c->imgs[IMG_HEALTH_ICON],
c);
lv_image_set_src(health_icon, c->imgs[lv_subject_get_int(&c->top_margin_health_subject) ? IMG_HEALTH_ICON_BOLD :
IMG_HEALTH_ICON]);
IMG_HEALTH_ICON]);
lv_obj_t * perfmon = create_perfmon(lv_layer_sys(), c);
lv_obj_bind_flag_if_eq(perfmon, &c->top_margin_health_subject, LV_OBJ_FLAG_HIDDEN, 0);
lv_obj_add_event_cb(health_icon, delete_modal_cb, LV_EVENT_DELETE, perfmon);

lv_obj_t * settings_icon = create_icon(top_margin_right_cluster, &c->top_margin_setting_subject,
&c->imgs[IMG_SETTING_ICON], c);
lv_image_set_src(settings_icon, c->imgs[lv_subject_get_int(&c->top_margin_setting_subject) ? IMG_SETTING_ICON_BOLD :
IMG_SETTING_ICON]);
IMG_SETTING_ICON]);
lv_obj_t * settings = create_settings(lv_layer_sys(), c);
lv_obj_bind_flag_if_eq(settings, &c->top_margin_setting_subject, LV_OBJ_FLAG_HIDDEN, 0);
lv_obj_add_event_cb(settings_icon, delete_modal_cb, LV_EVENT_DELETE, settings);
Expand Down
2 changes: 1 addition & 1 deletion examples/others/fragment/lv_example_fragment_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static const lv_fragment_class_t sample_cls = {
.constructor_cb = sample_fragment_ctor,
.create_obj_cb = sample_fragment_create_obj,
.instance_size = sizeof(struct sample_fragment_t),
};
};

void lv_example_fragment_1(void)
{
Expand Down
7 changes: 5 additions & 2 deletions src/draw/dma2d/lv_draw_dma2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ lv_draw_dma2d_output_cf_t lv_draw_dma2d_cf_to_dma2d_output_cf(lv_color_format_t
return LV_DRAW_DMA2D_OUTPUT_CF_RGB888;
case LV_COLOR_FORMAT_RGB565:
return LV_DRAW_DMA2D_OUTPUT_CF_RGB565;
default:
case LV_COLOR_FORMAT_ARGB1555:
return LV_DRAW_DMA2D_OUTPUT_CF_ARGB1555
default:
LV_ASSERT_MSG(false, "unsupported output color format");
}
return LV_DRAW_DMA2D_OUTPUT_CF_RGB565;
Expand Down Expand Up @@ -310,7 +312,8 @@ static int32_t evaluate_cb(lv_draw_unit_t * draw_unit, lv_draw_task_t * task)
&& (dsc->header.cf == LV_COLOR_FORMAT_ARGB8888
|| dsc->header.cf == LV_COLOR_FORMAT_XRGB8888
|| dsc->header.cf == LV_COLOR_FORMAT_RGB888
|| dsc->header.cf == LV_COLOR_FORMAT_RGB565)
|| dsc->header.cf == LV_COLOR_FORMAT_RGB565
|| dsc->header.cf == LV_COLOR_FORMAT_ARGB1555)
&& (dsc->base.layer->color_format == LV_COLOR_FORMAT_ARGB8888
|| dsc->base.layer->color_format == LV_COLOR_FORMAT_XRGB8888
|| dsc->base.layer->color_format == LV_COLOR_FORMAT_RGB888
Expand Down
8 changes: 4 additions & 4 deletions src/drivers/glfw/lv_opengles_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ static void lv_opengles_render_internal(unsigned int texture, const lv_area_t *

float positions[LV_OPENGLES_VERTEX_BUFFER_LEN] = {
-1.0f, 1.0f, tex_clip_x1, tex_clip_y2,
1.0f, 1.0f, tex_clip_x2, tex_clip_y2,
1.0f, -1.0f, tex_clip_x2, tex_clip_y1,
-1.0f, -1.0f, tex_clip_x1, tex_clip_y1
};
1.0f, 1.0f, tex_clip_x2, tex_clip_y2,
1.0f, -1.0f, tex_clip_x2, tex_clip_y1,
-1.0f, -1.0f, tex_clip_x1, tex_clip_y1
};
lv_opengles_vertex_buffer_init(positions, sizeof(positions));
}

Expand Down

0 comments on commit 4392640

Please sign in to comment.