diff options
author | JunsuChoi <jsuya.choi@samsung.com> | 2020-06-23 13:46:43 +0900 |
---|---|---|
committer | Hermet Park <chuneon.park@samsung.com> | 2020-06-23 13:46:43 +0900 |
commit | 4f15bde706ec8cd78fa57845c8eee7bdb5515282 (patch) | |
tree | 3bd0cbf2ff8e3c004e45bd9b8184eea79314bc26 /src | |
parent | c501d09c3aa4c3e7f1ab5a27171b897c3cb4a11c (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/efl/interfaces/efl_gfx_path.c | 16 |
1 files 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, | |||
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | // clamp the rx and ry radius value. | 1110 | // clamp the rx and ry radius value. |
1111 | rx = 2*rx; | ||
1112 | ry = 2*ry; | ||
1113 | if (rx > w) rx = w; | 1111 | if (rx > w) rx = w; |
1114 | if (ry > h) ry = h; | 1112 | if (ry > h) ry = h; |
1115 | 1113 | ||
1116 | _efl_gfx_path_append_move_to(obj, pd, x, y + h/2); | 1114 | _efl_gfx_path_append_move_to(obj, pd, x + rx, y); |
1117 | _efl_gfx_path_append_arc(obj, pd, x, y + h - ry, rx, ry, 180, 90); | 1115 | _efl_gfx_path_append_line_to(obj, pd, x + (w - rx), y); |
1118 | _efl_gfx_path_append_arc(obj, pd, x + w - rx, y + h - ry, rx, ry, 270, 90); | 1116 | _efl_gfx_path_append_quadratic_to(obj, pd, x + w, y + ry, x + w, y); |
1119 | _efl_gfx_path_append_arc(obj, pd, x + w - rx, y, rx, ry, 0, 90); | 1117 | _efl_gfx_path_append_line_to(obj, pd, x + w, y + (h - ry)); |
1120 | _efl_gfx_path_append_arc(obj, pd, x, y, rx, ry, 90, 90); | 1118 | _efl_gfx_path_append_quadratic_to(obj, pd, x + (w - rx), y + h, x + w, y + h); |
1119 | _efl_gfx_path_append_line_to(obj, pd, x + rx, y + h); | ||
1120 | _efl_gfx_path_append_quadratic_to(obj, pd, x , y + (h - ry), x, y + h); | ||
1121 | _efl_gfx_path_append_line_to(obj, pd, x, y + ry); | ||
1122 | _efl_gfx_path_append_quadratic_to(obj, pd, x + rx, y, x, y); | ||
1121 | _efl_gfx_path_append_close(obj, pd); | 1123 | _efl_gfx_path_append_close(obj, pd); |
1122 | 1124 | ||
1123 | //update convex flag | 1125 | //update convex flag |