draw: fixes related to blend modes
This commit is contained in:
@@ -33,12 +33,11 @@ typedef uint8_t cmd_state_t;
|
|||||||
* STATIC PROTOTYPES
|
* STATIC PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area, const lv_font_t * font_p,
|
static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area, const lv_font_t * font_p,
|
||||||
uint32_t letter,
|
uint32_t letter, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||||
lv_color_t color, lv_opa_t opa);
|
|
||||||
static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
||||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa);
|
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||||
static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
||||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa);
|
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||||
|
|
||||||
|
|
||||||
static uint8_t hex_char_to_num(char hex);
|
static uint8_t hex_char_to_num(char hex);
|
||||||
@@ -310,7 +309,7 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, lv_draw_lab
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_draw_letter(&pos, mask, font, letter, color, opa);
|
lv_draw_letter(&pos, mask, font, letter, color, opa, dsc->blend_mode);
|
||||||
|
|
||||||
if(letter_w > 0) {
|
if(letter_w > 0) {
|
||||||
pos.x += letter_w + dsc->letter_space;
|
pos.x += letter_w + dsc->letter_space;
|
||||||
@@ -386,7 +385,7 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, lv_draw_lab
|
|||||||
*/
|
*/
|
||||||
static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area, const lv_font_t * font_p,
|
static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area, const lv_font_t * font_p,
|
||||||
uint32_t letter,
|
uint32_t letter,
|
||||||
lv_color_t color, lv_opa_t opa)
|
lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||||
{
|
{
|
||||||
if(opa < LV_OPA_MIN) return;
|
if(opa < LV_OPA_MIN) return;
|
||||||
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
|
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
|
||||||
@@ -429,16 +428,16 @@ static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(font_p->subpx) {
|
if(font_p->subpx) {
|
||||||
draw_letter_subpx(pos_x, pos_y, &g, clip_area, map_p, color, opa);
|
draw_letter_subpx(pos_x, pos_y, &g, clip_area, map_p, color, opa, blend_mode);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
draw_letter_normal(pos_x, pos_y, &g, clip_area, map_p, color, opa);
|
draw_letter_normal(pos_x, pos_y, &g, clip_area, map_p, color, opa, blend_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
||||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa)
|
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||||
{
|
{
|
||||||
const uint8_t * bpp_opa_table_p;
|
const uint8_t * bpp_opa_table_p;
|
||||||
uint32_t bitmask_init;
|
uint32_t bitmask_init;
|
||||||
@@ -567,7 +566,7 @@ static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph
|
|||||||
else {
|
else {
|
||||||
lv_blend_fill(clip_area, &fill_area,
|
lv_blend_fill(clip_area, &fill_area,
|
||||||
color, mask_buf, LV_DRAW_MASK_RES_CHANGED, LV_OPA_COVER,
|
color, mask_buf, LV_DRAW_MASK_RES_CHANGED, LV_OPA_COVER,
|
||||||
LV_BLEND_MODE_NORMAL);
|
blend_mode);
|
||||||
|
|
||||||
fill_area.y1 = fill_area.y2 + 1;
|
fill_area.y1 = fill_area.y2 + 1;
|
||||||
fill_area.y2 = fill_area.y1;
|
fill_area.y2 = fill_area.y1;
|
||||||
@@ -584,7 +583,7 @@ static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph
|
|||||||
fill_area.y2--;
|
fill_area.y2--;
|
||||||
lv_blend_fill(clip_area, &fill_area,
|
lv_blend_fill(clip_area, &fill_area,
|
||||||
color, mask_buf, LV_DRAW_MASK_RES_CHANGED, LV_OPA_COVER,
|
color, mask_buf, LV_DRAW_MASK_RES_CHANGED, LV_OPA_COVER,
|
||||||
LV_BLEND_MODE_NORMAL);
|
blend_mode);
|
||||||
mask_p = 0;
|
mask_p = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,7 +591,7 @@ static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
||||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa)
|
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||||
{
|
{
|
||||||
const uint8_t * bpp_opa_table;
|
const uint8_t * bpp_opa_table;
|
||||||
uint32_t bitmask_init;
|
uint32_t bitmask_init;
|
||||||
@@ -765,7 +764,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
|||||||
map_area.y2 ++;
|
map_area.y2 ++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lv_blend_map(clip_area, &map_area, color_buf, mask_buf, LV_DRAW_MASK_RES_CHANGED, opa, LV_BLEND_MODE_NORMAL);
|
lv_blend_map(clip_area, &map_area, color_buf, mask_buf, LV_DRAW_MASK_RES_CHANGED, opa, blend_mode);
|
||||||
|
|
||||||
map_area.y1 = map_area.y2 + 1;
|
map_area.y1 = map_area.y2 + 1;
|
||||||
map_area.y2 = map_area.y1;
|
map_area.y2 = map_area.y1;
|
||||||
@@ -784,7 +783,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
|||||||
/*Flush the last part*/
|
/*Flush the last part*/
|
||||||
if(map_area.y1 != map_area.y2) {
|
if(map_area.y1 != map_area.y2) {
|
||||||
map_area.y2--;
|
map_area.y2--;
|
||||||
lv_blend_map(clip_area, &map_area, color_buf, mask_buf, LV_DRAW_MASK_RES_CHANGED, opa, LV_BLEND_MODE_NORMAL);
|
lv_blend_map(clip_area, &map_area, color_buf, mask_buf, LV_DRAW_MASK_RES_CHANGED, opa, blend_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_mem_buf_release(mask_buf);
|
lv_mem_buf_release(mask_buf);
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ static void draw_line_hor(const lv_point_t * point1, const lv_point_t * point2,
|
|||||||
if(simple_mode) {
|
if(simple_mode) {
|
||||||
lv_blend_fill(clip, &draw_area,
|
lv_blend_fill(clip, &draw_area,
|
||||||
dsc->color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa,
|
dsc->color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa,
|
||||||
LV_BLEND_MODE_NORMAL);
|
dsc->blend_mode);
|
||||||
}
|
}
|
||||||
/*If there other mask apply it*/
|
/*If there other mask apply it*/
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user