mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 03:58:33 +08:00
add canvas_reset_cache
This commit is contained in:
parent
dd34bc6aa4
commit
c956e89cef
@ -3,6 +3,7 @@
|
||||
2022/05/06
|
||||
* 增加[如何显示上下文菜单(俗称右键菜单)](how_to_show_context_menu.md)
|
||||
* 增加 STYLE\_ID\_CLEAR\_BG。为 true 时,绘制背景时用 clear\_rect 代替 fill\_rect。其作用是可以直接修改 lcd 颜色的 alpha 通道,方便于其它硬件层(如摄像头/视频)进行合成。
|
||||
* 修复窗口动画播放完后由于在线canvas数据与lcd不一致导致的有一帧闪屏的现象(感谢雨欣提供补丁)。
|
||||
|
||||
2022/05/05
|
||||
* 修复combo\_box设置readonly和value控件后焦点状态切换异常的问题(感谢雨欣提供补丁)。
|
||||
|
@ -2063,13 +2063,36 @@ canvas_t* canvas_cast(canvas_t* c) {
|
||||
ret_t canvas_reset(canvas_t* c) {
|
||||
return_value_if_fail(c != NULL && c->lcd != NULL, RET_BAD_PARAMS);
|
||||
|
||||
TKMEM_FREE(c->font_name);
|
||||
canvas_reset_cache(c);
|
||||
TKMEM_FREE(c->last_text_str);
|
||||
memset(c, 0x00, sizeof(canvas_t));
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t canvas_reset_cache(canvas_t* c) {
|
||||
return_value_if_fail(c != NULL && c->lcd != NULL, RET_BAD_PARAMS);
|
||||
|
||||
c->ox = 0;
|
||||
c->oy = 0;
|
||||
c->global_alpha = 0;
|
||||
|
||||
c->clip_left = 0;
|
||||
c->clip_top = 0;
|
||||
c->clip_right = canvas_get_width(c) - 1;
|
||||
c->clip_bottom = canvas_get_height(c) - 1;
|
||||
|
||||
c->text_align_v = ALIGN_V_NONE;
|
||||
c->text_align_h = ALIGN_H_NONE;
|
||||
|
||||
c->font_manager = NULL;
|
||||
c->assets_manager = NULL;
|
||||
|
||||
canvas_reset_font(c);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t canvas_get_text_metrics(canvas_t* c, float_t* ascent, float_t* descent, float_t* line_hight) {
|
||||
return_value_if_fail(c != NULL, RET_BAD_PARAMS);
|
||||
return_value_if_fail(ascent != NULL && descent != NULL && line_hight != NULL, RET_BAD_PARAMS);
|
||||
|
@ -715,6 +715,18 @@ canvas_t* canvas_cast(canvas_t* c);
|
||||
*/
|
||||
ret_t canvas_reset(canvas_t* c);
|
||||
|
||||
/**
|
||||
* @method canvas_reset_cache
|
||||
* 清除canvas中缓存。
|
||||
* > 备注:主要用于窗口动画的离线画布绘制完成后重置在线画布,使下一帧中lcd对象的数据保持一致。
|
||||
*
|
||||
* @annotation ["scriptable"]
|
||||
* @param {canvas_t*} c canvas对象。
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t canvas_reset_cache(canvas_t* c);
|
||||
|
||||
/**
|
||||
* @method canvas_draw_image_at
|
||||
* 在指定位置画图。
|
||||
|
@ -152,6 +152,8 @@ ret_t window_manager_default_snap_curr_window(widget_t* widget, widget_t* curr_w
|
||||
ENSURE(canvas_offline_destroy(canvas) == RET_OK);
|
||||
img->flags |= BITMAP_FLAG_OPAQUE;
|
||||
canvas_restore(c);
|
||||
/* 清除在线画布的缓存,确保绘制完窗口动画后,lcd对象的数据能和在线画布同步 */
|
||||
canvas_reset_cache(c);
|
||||
#endif
|
||||
return RET_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user