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:
parent
5af7c85fa2
commit
367dbd176f
34
cogl-path.h
34
cogl-path.h
@ -290,18 +290,18 @@ void cogl_path_polygon (float *coords,
|
||||
|
||||
/**
|
||||
* cogl_path_rectangle:
|
||||
* @x: X coordinate of the top-left corner.
|
||||
* @y: Y coordinate of the top-left corner.
|
||||
* @width: Rectangle width.
|
||||
* @height: Rectangle height.
|
||||
* @x1: X coordinate of the top-left corner.
|
||||
* @y1: Y coordinate of the top-left corner.
|
||||
* @x2: X coordinate of the bottom-right corner.
|
||||
* @y2: Y coordinate of the bottom-right corner.
|
||||
*
|
||||
* Constructs a rectangular shape at the given coordinates. If there
|
||||
* is an existing path this will start a new disjoint sub-path.
|
||||
**/
|
||||
void cogl_path_rectangle (float x,
|
||||
float y,
|
||||
float width,
|
||||
float height);
|
||||
void cogl_path_rectangle (float x1,
|
||||
float y1,
|
||||
float x2,
|
||||
float y2);
|
||||
|
||||
/**
|
||||
* cogl_path_ellipse:
|
||||
@ -320,21 +320,21 @@ void cogl_path_ellipse (float center_x,
|
||||
|
||||
/**
|
||||
* cogl_path_round_rectangle:
|
||||
* @x: X coordinate of the top-left corner
|
||||
* @y: Y coordinate of the top-left corner
|
||||
* @width: Width of the rectangle
|
||||
* @height: Height of the rectangle
|
||||
* @x1: X coordinate of the top-left corner.
|
||||
* @y1: Y coordinate of the top-left corner.
|
||||
* @x2: X coordinate of the bottom-right corner.
|
||||
* @y2: Y coordinate of the bottom-right corner.
|
||||
* @radius: Radius of the corner arcs.
|
||||
* @arc_step: Angle increment resolution for subdivision of
|
||||
* the corner arcs.
|
||||
*
|
||||
* Constructs a rectangular shape with rounded corners. If there is an
|
||||
* existing path this will start a new disjoint sub-path.
|
||||
**/
|
||||
void cogl_path_round_rectangle (float x,
|
||||
float y,
|
||||
float width,
|
||||
float height,
|
||||
**/
|
||||
void cogl_path_round_rectangle (float x1,
|
||||
float y1,
|
||||
float x2,
|
||||
float y2,
|
||||
float radius,
|
||||
float arc_step);
|
||||
|
||||
|
@ -193,15 +193,15 @@ cogl_path_polygon (float *coords,
|
||||
}
|
||||
|
||||
void
|
||||
cogl_path_rectangle (float x,
|
||||
float y,
|
||||
float width,
|
||||
float height)
|
||||
cogl_path_rectangle (float x1,
|
||||
float y1,
|
||||
float x2,
|
||||
float y2)
|
||||
{
|
||||
cogl_path_move_to (x, y);
|
||||
cogl_path_line_to (x + width, y);
|
||||
cogl_path_line_to (x + width, y + height);
|
||||
cogl_path_line_to (x, y + height);
|
||||
cogl_path_move_to (x1, y1);
|
||||
cogl_path_line_to (x2, y1);
|
||||
cogl_path_line_to (x2, y2);
|
||||
cogl_path_line_to (x1, y2);
|
||||
cogl_path_close ();
|
||||
}
|
||||
|
||||
@ -327,19 +327,19 @@ cogl_path_ellipse (float center_x,
|
||||
}
|
||||
|
||||
void
|
||||
cogl_path_round_rectangle (float x,
|
||||
float y,
|
||||
float width,
|
||||
float height,
|
||||
cogl_path_round_rectangle (float x1,
|
||||
float y1,
|
||||
float x2,
|
||||
float y2,
|
||||
float radius,
|
||||
float arc_step)
|
||||
{
|
||||
float inner_width = width - (radius * 2);
|
||||
float inner_height = height - (radius * 2);
|
||||
float inner_width = x2 - x1 - radius * 2;
|
||||
float inner_height = y2 - y1 - radius * 2;
|
||||
|
||||
_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,
|
||||
radius, radius,
|
||||
180,
|
||||
|
Loading…
Reference in New Issue
Block a user