From 4f15bde706ec8cd78fa57845c8eee7bdb5515282 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Tue, 23 Jun 2020 13:46:43 +0900 Subject: [PATCH] Efl.Gfx.Path: Change draw of a rounded rect from arc to quadratic Summary: The rounded rect is a very slightly different shape compared to chrome's svg output. To solve this, modify to use a quadratic bezier instead of arc when drawing a round. Test Plan: {F3904500} (Drawing rect with arc or quadratic) Compare Image {F3904501} {F3904502} Reviewers: Hermet, kimcinoo, herb Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12020 --- src/lib/efl/interfaces/efl_gfx_path.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/lib/efl/interfaces/efl_gfx_path.c b/src/lib/efl/interfaces/efl_gfx_path.c index 0f69653df9..b0e00f9f30 100644 --- a/src/lib/efl/interfaces/efl_gfx_path.c +++ b/src/lib/efl/interfaces/efl_gfx_path.c @@ -1108,16 +1108,18 @@ _efl_gfx_path_append_rect(Eo *obj, Efl_Gfx_Path_Data *pd, } // clamp the rx and ry radius value. - rx = 2*rx; - ry = 2*ry; if (rx > w) rx = w; if (ry > h) ry = h; - _efl_gfx_path_append_move_to(obj, pd, x, y + h/2); - _efl_gfx_path_append_arc(obj, pd, x, y + h - ry, rx, ry, 180, 90); - _efl_gfx_path_append_arc(obj, pd, x + w - rx, y + h - ry, rx, ry, 270, 90); - _efl_gfx_path_append_arc(obj, pd, x + w - rx, y, rx, ry, 0, 90); - _efl_gfx_path_append_arc(obj, pd, x, y, rx, ry, 90, 90); + _efl_gfx_path_append_move_to(obj, pd, x + rx, y); + _efl_gfx_path_append_line_to(obj, pd, x + (w - rx), y); + _efl_gfx_path_append_quadratic_to(obj, pd, x + w, y + ry, x + w, y); + _efl_gfx_path_append_line_to(obj, pd, x + w, y + (h - ry)); + _efl_gfx_path_append_quadratic_to(obj, pd, x + (w - rx), y + h, x + w, y + h); + _efl_gfx_path_append_line_to(obj, pd, x + rx, y + h); + _efl_gfx_path_append_quadratic_to(obj, pd, x , y + (h - ry), x, y + h); + _efl_gfx_path_append_line_to(obj, pd, x, y + ry); + _efl_gfx_path_append_quadratic_to(obj, pd, x + rx, y, x, y); _efl_gfx_path_append_close(obj, pd); //update convex flag