From 9c0f2ae24fa15d0c1180597e2554f65c19cfa9b7 Mon Sep 17 00:00:00 2001 From: xianjimli Date: Wed, 12 Feb 2020 16:35:42 +0800 Subject: [PATCH] fix ffr_draw_rounded_rect --- docs/changes.md | 3 +++ src/base/ffr_draw_rounded_rect.inc | 23 +++++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/docs/changes.md b/docs/changes.md index d92954041..03f64857a 100644 --- a/docs/changes.md +++ b/docs/changes.md @@ -1,5 +1,8 @@ # 最新动态 +* 2020/02/12 + * 修复在 agge 的状态下圆角矩形不受裁剪区的影响的 bug (感谢智明提供补丁)。 + * 2020/02/11 * opengles 支持snapshot(感谢智明提供补丁)。 * 修复了 demoui 的 combox 功能的第一个 combox 在点击 edit 弹出输入法后,再点击按钮时候,导致输入法的动画异常的问题(感谢智明提供补丁)。 diff --git a/src/base/ffr_draw_rounded_rect.inc b/src/base/ffr_draw_rounded_rect.inc index 4a0c9f8b5..1ee911d30 100644 --- a/src/base/ffr_draw_rounded_rect.inc +++ b/src/base/ffr_draw_rounded_rect.inc @@ -240,15 +240,18 @@ static inline void widget_image_color2data(unsigned char* d, bitmap_format_t for } } -static inline void widget_draw_antialiasing_for_point(frr_image_info_t* image_info, int px, int py, - float_t e, rgba_t c, rgba_t o_color) { +static inline void widget_draw_antialiasing_for_point(frr_image_info_t* image_info, canvas_t* canvas, int px, int py, + float_t e, rgba_t n_color, rgba_t o_color) { int32_t p = 0; - unsigned char a = (unsigned char)(e * c.a); - IMAGE_COLOR2COLOR_BLEND(c, o_color, a); - p = (int32_t)GET_IMAGE_POINT(image_info->bpp, image_info->stride, image_info->w, image_info->h, - px, py); - if (p > 0) { - widget_image_color2data(image_info->dst + p, image_info->format, c); + unsigned char a = (unsigned char)(e * n_color.a); + + if (canvas->clip_left <= px && px <= canvas->clip_right && canvas->clip_top <= py && py <= canvas->clip_bottom) { + IMAGE_COLOR2COLOR_BLEND(n_color, o_color, a); + p = (int32_t)GET_IMAGE_POINT(image_info->bpp, image_info->stride, image_info->w, image_info->h, + px, py); + if (p > 0) { + widget_image_color2data(image_info->dst + p, image_info->format, n_color); + } } } @@ -337,7 +340,7 @@ static inline void widget_draw_circluar_point_to_quadrant(frr_image_info_t* imag if (p > 0) { widget_image_data2color(image_info->dst + p, image_info->format, &o_color); - widget_draw_antialiasing_for_point(image_info, x, y, e, color, o_color); + widget_draw_antialiasing_for_point(image_info, c, x, y, e, color, o_color); } } } @@ -379,7 +382,7 @@ static inline void widget_draw_circluar_point_to_quadrant_hline(frr_image_info_t canvas_fill_rect(c, x_h, y, w, 1); - widget_draw_antialiasing_for_point(image_info, x + c->ox, y + c->oy, e, color, o_color); + widget_draw_antialiasing_for_point(image_info, c, x + c->ox, y + c->oy, e, color, o_color); } } }