Change cogl_path_rectangle and cogl_path_round_rectangle to take x1,y1,x2,y2

This matches the changes to cogl_rectangle to improve consistency.
This commit is contained in:
Neil Roberts 2009-03-13 12:20:26 +00:00
parent 5af7c85fa2
commit 367dbd176f
2 changed files with 32 additions and 32 deletions

View File

@ -290,18 +290,18 @@ void cogl_path_polygon (float *coords,
/** /**
* cogl_path_rectangle: * cogl_path_rectangle:
* @x: X coordinate of the top-left corner. * @x1: X coordinate of the top-left corner.
* @y: Y coordinate of the top-left corner. * @y1: Y coordinate of the top-left corner.
* @width: Rectangle width. * @x2: X coordinate of the bottom-right corner.
* @height: Rectangle height. * @y2: Y coordinate of the bottom-right corner.
* *
* Constructs a rectangular shape at the given coordinates. If there * Constructs a rectangular shape at the given coordinates. If there
* is an existing path this will start a new disjoint sub-path. * is an existing path this will start a new disjoint sub-path.
**/ **/
void cogl_path_rectangle (float x, void cogl_path_rectangle (float x1,
float y, float y1,
float width, float x2,
float height); float y2);
/** /**
* cogl_path_ellipse: * cogl_path_ellipse:
@ -320,21 +320,21 @@ void cogl_path_ellipse (float center_x,
/** /**
* cogl_path_round_rectangle: * cogl_path_round_rectangle:
* @x: X coordinate of the top-left corner * @x1: X coordinate of the top-left corner.
* @y: Y coordinate of the top-left corner * @y1: Y coordinate of the top-left corner.
* @width: Width of the rectangle * @x2: X coordinate of the bottom-right corner.
* @height: Height of the rectangle * @y2: Y coordinate of the bottom-right corner.
* @radius: Radius of the corner arcs. * @radius: Radius of the corner arcs.
* @arc_step: Angle increment resolution for subdivision of * @arc_step: Angle increment resolution for subdivision of
* the corner arcs. * the corner arcs.
* *
* Constructs a rectangular shape with rounded corners. If there is an * Constructs a rectangular shape with rounded corners. If there is an
* existing path this will start a new disjoint sub-path. * existing path this will start a new disjoint sub-path.
**/ **/
void cogl_path_round_rectangle (float x, void cogl_path_round_rectangle (float x1,
float y, float y1,
float width, float x2,
float height, float y2,
float radius, float radius,
float arc_step); float arc_step);

View File

@ -193,15 +193,15 @@ cogl_path_polygon (float *coords,
} }
void void
cogl_path_rectangle (float x, cogl_path_rectangle (float x1,
float y, float y1,
float width, float x2,
float height) float y2)
{ {
cogl_path_move_to (x, y); cogl_path_move_to (x1, y1);
cogl_path_line_to (x + width, y); cogl_path_line_to (x2, y1);
cogl_path_line_to (x + width, y + height); cogl_path_line_to (x2, y2);
cogl_path_line_to (x, y + height); cogl_path_line_to (x1, y2);
cogl_path_close (); cogl_path_close ();
} }
@ -327,19 +327,19 @@ cogl_path_ellipse (float center_x,
} }
void void
cogl_path_round_rectangle (float x, cogl_path_round_rectangle (float x1,
float y, float y1,
float width, float x2,
float height, float y2,
float radius, float radius,
float arc_step) float arc_step)
{ {
float inner_width = width - (radius * 2); float inner_width = x2 - x1 - radius * 2;
float inner_height = height - (radius * 2); float inner_height = y2 - y1 - radius * 2;
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
cogl_path_move_to (x, y + radius); cogl_path_move_to (x1, y1 + radius);
cogl_path_arc_rel (radius, 0, cogl_path_arc_rel (radius, 0,
radius, radius, radius, radius,
180, 180,