improve vgcanvas

This commit is contained in:
lixianjing 2019-11-28 09:18:04 +08:00
parent dd6c61eb64
commit 4b79da8886
2 changed files with 19 additions and 9 deletions

View File

@ -3,6 +3,7 @@
* 2019/11/28
* 修复preview ui预览dialog时拖动dialog出现残影的问题。
* 完善combobox弹出对话框位置的问题。
* 完善vgcanvas感谢智明提供补丁
* 2019/11/27
* 完善edit/mledit (感谢智明提供补丁)。

View File

@ -97,16 +97,20 @@ static ret_t lcd_vgcanvas_draw_hline(lcd_t* lcd, xy_t x, xy_t y, wh_t w) {
static ret_t lcd_vgcanvas_fill_rect(lcd_t* lcd, xy_t x, xy_t y, wh_t w, wh_t h) {
float_t rect_x = x;
float_t rect_y = y;
float_t rect_w = 0;
float_t rect_h = 0;
float_t rect_w = w;
float_t rect_h = h;
vgcanvas_t* canvas = LCD(lcd)->canvas;
rect_x += 0.5f;
rect_y += 0.5f;
#ifndef AWTK_WEB
rect_x += (0.5f / lcd->ratio);
rect_y += (0.5f / lcd->ratio);
#endif /*AWTK_WEB*/
if (w > 1 && h > 1) {
rect_w = w - 1;
rect_h = h - 1;
#ifndef AWTK_WEB
rect_w -= (1.0f / lcd->ratio);
rect_h -= (1.0f / lcd->ratio);
#endif /*AWTK_WEB*/
vgcanvas_begin_path(canvas);
vgcanvas_rect(canvas, rect_x, rect_y, rect_w, rect_h);
@ -132,8 +136,13 @@ static ret_t lcd_vgcanvas_fill_rect(lcd_t* lcd, xy_t x, xy_t y, wh_t w, wh_t h)
static ret_t lcd_vgcanvas_stroke_rect(lcd_t* lcd, xy_t x, xy_t y, wh_t w, wh_t h) {
vgcanvas_t* canvas = LCD(lcd)->canvas;
x += (0.5f / lcd->ratio);
y += (0.5f / lcd->ratio);
w -= (1.0f / lcd->ratio);
h -= (1.0f / lcd->ratio);
vgcanvas_begin_path(canvas);
vgcanvas_rect(canvas, x + 0.5f, y + 0.5f, w - 1, h - 1);
vgcanvas_rect(canvas, x, y, w, h);
vgcanvas_set_line_width(canvas, 1);
vgcanvas_set_stroke_color(canvas, lcd->stroke_color);
vgcanvas_stroke(canvas);