improve progress bar

This commit is contained in:
lixianjing 2023-08-10 09:41:21 +08:00
parent 7622b12c2d
commit d062d569cb
3 changed files with 14 additions and 2 deletions

View File

@ -1,4 +1,8 @@
# 最新动态
2023/08/10
* 完善progress bar的脏矩形(感谢智明提供补丁)
2023/08/09
* 增加函数bits\_stream\_set/bits\_stream\_get

View File

@ -196,7 +196,7 @@ rect_t progress_circle_calc_line_dirty_rect(widget_t* widget, float_t old_value,
} else {
rect = rect_init(0, 0, widget->w, widget->h);
}
return rect;
}
@ -244,6 +244,8 @@ static ret_t progress_circle_on_paint_self(widget_t* widget, canvas_t* c) {
}
vgcanvas_restore(vg);
progress_circle->last_dirty_rect = rect_init(progress_circle->dirty_rect.x, progress_circle->dirty_rect.y, progress_circle->dirty_rect.w, progress_circle->dirty_rect.h);
progress_circle->dirty_rect = rect_init(0, 0, 0, 0);
}
color = style_get_color(style, STYLE_ID_TEXT_COLOR, trans);
@ -268,7 +270,9 @@ ret_t progress_circle_set_value(widget_t* widget, float_t value) {
if (widget_dispatch(widget, (event_t*)&evt) != RET_STOP) {
rect_t r = progress_circle_calc_line_dirty_rect(widget, old_value, value);
widget_invalidate(widget, &r);
rect_merge(&progress_circle->dirty_rect, &r);
rect_merge(&r, &progress_circle->last_dirty_rect);
widget_invalidate_force(widget, &r);
progress_circle->value = value;
evt.e.type = EVT_VALUE_CHANGED;

View File

@ -126,6 +126,10 @@ typedef struct _progress_circle_t {
* (TRUE)
*/
bool_t show_text;
/* private */
rect_t dirty_rect;
rect_t last_dirty_rect;
} progress_circle_t;
/**