From 367dbd176ff44571f5dd595e526c22dafef7afc2 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Fri, 13 Mar 2009 12:20:26 +0000 Subject: [PATCH] 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. --- cogl-path.h | 34 +++++++++++++++++----------------- common/cogl-primitives.c | 30 +++++++++++++++--------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/cogl-path.h b/cogl-path.h index 361c9ef1b..ad0d02094 100644 --- a/cogl-path.h +++ b/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); diff --git a/common/cogl-primitives.c b/common/cogl-primitives.c index 65df7130d..853a9907d 100644 --- a/common/cogl-primitives.c +++ b/common/cogl-primitives.c @@ -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,