double x, double y, double w, double h,
double rx, double ry)
{
- // clamp the x and y radius value.
- if (rx > w/2) rx = w/2;
- if (ry > h/2) ry = h/2;
-
- _efl_gfx_shape_append_move_to(obj, pd, x, y + ry);
- // Top left corner
- _efl_gfx_shape_append_arc_to(obj, pd, x + rx, y, rx, ry, 0, EINA_FALSE, EINA_TRUE);
- _efl_gfx_shape_append_line_to(obj, pd, x + w - rx, y);
- // Top right corner
- _efl_gfx_shape_append_arc_to(obj, pd, x + w, y + ry, rx, ry, 0, EINA_FALSE, EINA_TRUE);
- _efl_gfx_shape_append_line_to(obj, pd, x + w, y + h - ry);
- // Bottom right corner
- _efl_gfx_shape_append_arc_to(obj, pd, x + w - rx, y + h, rx, ry, 0, EINA_FALSE, EINA_TRUE);
- _efl_gfx_shape_append_line_to(obj, pd, x + rx, y + h);
- // Bottom left corner
- _efl_gfx_shape_append_arc_to(obj, pd, x, y + h - ry, rx, ry, 0, EINA_FALSE, EINA_TRUE);
+ // check for invalid rectangle
+ if (w <=0 || h<= 0)
+ return;
+
+ if (rx <=0 || ry<=0)
+ {
+ // add a normal rect.
+ _efl_gfx_shape_append_move_to(obj, pd, x, y);
+ _efl_gfx_shape_append_line_to(obj, pd, x, y + h);
+ _efl_gfx_shape_append_line_to(obj, pd, x + w, y + h);
+ _efl_gfx_shape_append_line_to(obj, pd, x + w, y);
+ _efl_gfx_shape_append_close(obj, pd);
+ return;
+ }
+
+ // 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_shape_append_move_to(obj, pd, x, y + h/2);
+ _efl_gfx_shape_append_arc(obj, pd, x, y + h - ry, rx, ry, 180, 90);
+ _efl_gfx_shape_append_arc(obj, pd, x + w - rx, y + h - ry, rx, ry, 270, 90);
+ _efl_gfx_shape_append_arc(obj, pd, x + w - rx, y, rx, ry, 0, 90);
+ _efl_gfx_shape_append_arc(obj, pd, x, y, rx, ry, 90, 90);
_efl_gfx_shape_append_close(obj, pd);
}