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 5d4c09369e
commit cde05288b7
6 changed files with 46 additions and 45 deletions

5
README
View File

@ -260,8 +260,9 @@ Release Notes for Clutter 1.0
cogl_set_source_texture (tex_handle);
cogl_polygon (verts, 3, TRUE);
* The arguments to cogl_rectangle have been changed - for consistency - from
x1, y2, width, height, to x1, y1, x2, y2.
* The arguments to cogl_rectangle, cogl_path_rectangle and
cogl_path_round_rectangle have been changed - for consistency - from
x, y, width, height, to x1, y1, x2, y2.
* A CoglMatrix type and utility API has been added; this is currently used to
support describing texture matrices.

View File

@ -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);

View File

@ -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,

View File

@ -461,10 +461,10 @@ cogl_pango_renderer_draw_box (PangoRenderer *renderer,
CoglPangoRenderer *priv = COGL_PANGO_RENDERER (renderer);
cogl_set_source (priv->solid_material);
cogl_path_rectangle ((float)(x),
(float)(y - height),
(float)(width),
(float)(height));
cogl_path_rectangle (x,
y - height,
x + width,
y);
cogl_path_stroke ();
}

View File

@ -41,10 +41,10 @@ path_shapes (gint x, gint y, gint width, gint height)
cogl_path_line_to ((x + width * 4 / 15), (y + height * 4 / 5));
cogl_path_close ();
cogl_path_rectangle ((x + width / 3),
cogl_path_rectangle (x + width / 3,
y,
(width * 4 / 15),
(height * 4 / 5));
x + width * 9 / 15,
y + height * 4 / 5);
cogl_path_ellipse ((x + width * 4 / 5),
(y + height * 2 / 5),
@ -73,8 +73,8 @@ make_clip_path (Clip *clip)
case CLIP_RECTANGLE:
cogl_path_rectangle (clip->x1,
clip->y1,
(clip->x2 - clip->x1),
(clip->y2 - clip->y1));
clip->x2,
clip->y2);
break;
case CLIP_ELLIPSE:

View File

@ -16,13 +16,13 @@ test_paint_line ()
static void
test_paint_rect ()
{
cogl_path_rectangle (-50, -25, 100, 50);
cogl_path_rectangle (-50, -25, 50, 25);
}
static void
test_paint_rndrect()
{
cogl_path_round_rectangle (-50, -25, 100, 50, 10, 5);
cogl_path_round_rectangle (-50, -25, 50, 25, 10, 5);
}
static void