From 83e2861614eb7a1d67f3429d49e77d4b62673d1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Tue, 29 Apr 2008 15:41:34 +0000 Subject: [PATCH] * clutter/cogl/cogl.h.in: renaming of API's in cogl to make the primitives and path API a bit smaller and more resembling cairo. * clutter/cogl/gl/cogl-primitives.c: * clutter/cogl/gles/cogl-primitives.c: * clutter/cogl/gles/cogl.c: * clutter/clutter-actor.c: * clutter/clutter-rectangle.c: * tests/test-cogl-offscreen.c: * tests/test-cogl-primitives.c: * tests/test-cogl-tex-convert.c: * tests/test-cogl-tex-foreign.c: * tests/test-cogl-tex-getset.c: * tests/test-cogl-tex-tile.c: updated according to changes in cogl. --- ChangeLog | 17 ++ clutter/clutter-actor.c | 7 +- clutter/clutter-rectangle.c | 36 ++-- clutter/cogl/cogl.h.in | 236 ++++++--------------- clutter/cogl/gl/cogl-primitives.c | 185 +++++++---------- clutter/cogl/gles/cogl-primitives.c | 312 ++++++++++------------------ clutter/cogl/gles/cogl.c | 2 +- tests/test-cogl-offscreen.c | 6 +- tests/test-cogl-primitives.c | 98 +++++---- tests/test-cogl-tex-convert.c | 2 +- tests/test-cogl-tex-foreign.c | 2 +- tests/test-cogl-tex-getset.c | 2 +- tests/test-cogl-tex-tile.c | 2 +- 13 files changed, 335 insertions(+), 572 deletions(-) diff --git a/ChangeLog b/ChangeLog index b8f159d23..00446c419 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2008-04-29 Øyvind Kolås + + * clutter/cogl/cogl.h.in: renaming of API's in cogl to make the + primitives and path API a bit smaller and more resembling cairo. + * clutter/cogl/gl/cogl-primitives.c: + * clutter/cogl/gles/cogl-primitives.c: + * clutter/cogl/gles/cogl.c: + + * clutter/clutter-actor.c: + * clutter/clutter-rectangle.c: + * tests/test-cogl-offscreen.c: + * tests/test-cogl-primitives.c: + * tests/test-cogl-tex-convert.c: + * tests/test-cogl-tex-foreign.c: + * tests/test-cogl-tex-getset.c: + * tests/test-cogl-tex-tile.c: updated according to changes in cogl. + 2008-04-29 Robert Bragg * clutter/x11/clutter-x11-texture-pixmap.c: diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 72d9ddda2..35186921e 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -488,10 +488,9 @@ clutter_actor_real_pick (ClutterActor *self, if (clutter_actor_should_pick_paint (self)) { cogl_color (color); - cogl_fast_fill_rectangle (0, - 0, - clutter_actor_get_width(self), - clutter_actor_get_height(self)); + cogl_rectangle (0, 0, + clutter_actor_get_width(self), + clutter_actor_get_height(self)); } } diff --git a/clutter/clutter-rectangle.c b/clutter/clutter-rectangle.c index dfc34099c..03e20b46d 100644 --- a/clutter/clutter-rectangle.c +++ b/clutter/clutter-rectangle.c @@ -101,22 +101,22 @@ clutter_rectangle_paint (ClutterActor *self) cogl_color (&tmp_col); /* this sucks, but it's the only way to make a border */ - cogl_fast_fill_rectangle (priv->border_width, 0, - geom.width - priv->border_width, - priv->border_width); + cogl_rectangle (priv->border_width, 0, + geom.width - priv->border_width, + priv->border_width); - cogl_fast_fill_rectangle (geom.width - priv->border_width, - priv->border_width, - priv->border_width, - geom.height - priv->border_width); + cogl_rectangle (geom.width - priv->border_width, + priv->border_width, + priv->border_width, + geom.height - priv->border_width); - cogl_fast_fill_rectangle (0, geom.height - priv->border_width, - geom.width - priv->border_width, - priv->border_width); + cogl_rectangle (0, geom.height - priv->border_width, + geom.width - priv->border_width, + priv->border_width); - cogl_fast_fill_rectangle (0, 0, - priv->border_width, - geom.height - priv->border_width); + cogl_rectangle (0, 0, + priv->border_width, + geom.height - priv->border_width); tmp_col.red = priv->color.red; tmp_col.green = priv->color.green; @@ -124,10 +124,10 @@ clutter_rectangle_paint (ClutterActor *self) cogl_color (&tmp_col); - cogl_fast_fill_rectangle (priv->border_width, - priv->border_width, - geom.width - priv->border_width * 2, - geom.height - priv->border_width * 2); + cogl_rectangle (priv->border_width, + priv->border_width, + geom.width - priv->border_width * 2, + geom.height - priv->border_width * 2); } else { @@ -138,7 +138,7 @@ clutter_rectangle_paint (ClutterActor *self) cogl_color (&tmp_col); - cogl_fast_fill_rectangle (0, 0, geom.width, geom.height); + cogl_rectangle (0, 0, geom.width, geom.height); } cogl_pop_matrix(); diff --git a/clutter/cogl/cogl.h.in b/clutter/cogl/cogl.h.in index 0893a58fc..baf1ab399 100644 --- a/clutter/cogl/cogl.h.in +++ b/clutter/cogl/cogl.h.in @@ -892,9 +892,9 @@ void cogl_texture_rectangle (CoglHandle handle, * to CGL_NEAREST. */ void cogl_texture_polygon (CoglHandle handle, - guint n_vertices, - CoglTextureVertex *vertices, - gboolean use_color); + guint n_vertices, + CoglTextureVertex *vertices, + gboolean use_color); /* Primitives API */ @@ -933,7 +933,7 @@ void cogl_color (const ClutterColor *color); /** - * cogl_fast_fill_rectangle: + * cogl_rectangle: * @x: X coordinate of the top-left corner * @y: Y coordinate of the top-left corner * @width: Width of the rectangle @@ -942,13 +942,13 @@ void cogl_color (const ClutterColor *color); * Fills a rectangle at the given coordinates with the current * drawing color in a highly optimizied fashion. **/ -void cogl_fast_fill_rectangle (gint x, +void cogl_rectangle (gint x, gint y, guint width, guint height); /** - * cogl_fast_fill_rectanglex: + * cogl_rectanglex: * @x: X coordinate of the top-left corner * @y: Y coordinate of the top-left corner * @width: Width of the rectangle @@ -956,13 +956,13 @@ void cogl_fast_fill_rectangle (gint x, * * A fixed-point version of cogl_fast_fill_rectangle. **/ -void cogl_fast_fill_rectanglex (ClutterFixed x, - ClutterFixed y, - ClutterFixed width, - ClutterFixed height); - +void cogl_rectanglex (ClutterFixed x, + ClutterFixed y, + ClutterFixed width, + ClutterFixed height); +#if 0 /** - * cogl_fast_fill_trapezoid: + * cogl_trapezoid: * @y1: Y coordinate of the top two vertices. * @x11: X coordinate of the top-left vertex. * @x21: X coordinate of the top-right vertex. @@ -973,15 +973,15 @@ void cogl_fast_fill_rectanglex (ClutterFixed x, * Fills a trapezoid at the given coordinates with the current * drawing color in a highly optimized fashion. **/ -void cogl_fast_fill_trapezoid (gint y1, - gint x11, - gint x21, - gint y2, - gint x12, - gint x22); +void cogl_trapezoid (gint y1, + gint x11, + gint x21, + gint y2, + gint x12, + gint x22); /** - * cogl_fast_fill_trapezoidx: + * cogl_trapezoidx: * @y1: Y coordinate of the top two vertices. * @x11: X coordinate of the top-left vertex. * @x21: X coordinate of the top-right vertex. @@ -989,30 +989,31 @@ void cogl_fast_fill_trapezoid (gint y1, * @x12: X coordinate of the bottom-left vertex. * @x22: X coordinate of the bottom-right vertex. * - * A fixed-point version of cogl_fast_fill_trapezoid. + * A fixed-point version of cogl_trapezoid. **/ -void cogl_fast_fill_trapezoidx (ClutterFixed y1, - ClutterFixed x11, - ClutterFixed x21, - ClutterFixed y2, - ClutterFixed x12, - ClutterFixed x22); +void cogl_trapezoidx (ClutterFixed y1, + ClutterFixed x11, + ClutterFixed x21, + ClutterFixed y2, + ClutterFixed x12, + ClutterFixed x22); +#endif /** - * cogl_fill: + * cogl_path_fill: * * Fills the constructed shape using the current drawing color. **/ -void cogl_fill (void); +void cogl_path_fill (void); /** - * cogl_stroke: + * cogl_path_stroke: * * Strokes the constructed shape using the current drawing color * and a width of 1 pixel (regardless of the current transformation * matrix). **/ -void cogl_stroke (void); +void cogl_path_stroke (void); /** @@ -1023,12 +1024,12 @@ void cogl_stroke (void); * Clears the previously constructed shape and begins a new path * contour by moving the pen to the given coordinates. **/ -void cogl_path_move_to (ClutterFixed x, - ClutterFixed y); +void cogl_path_move_to (ClutterFixed x, + ClutterFixed y); /** - * cogl_path_move_to_rel: + * cogl_path_rel_move_to: * @x: X offset from the current pen location to move the pen to. * @y: Y offset from the current pen location to move the pen to. * @@ -1036,8 +1037,8 @@ void cogl_path_move_to (ClutterFixed x, * contour by moving the pen to the given coordinates relative * to the current pen location. **/ -void cogl_path_move_to_rel (ClutterFixed x, - ClutterFixed y); +void cogl_path_rel_move_to (ClutterFixed x, + ClutterFixed y); /** * cogl_path_line_to: @@ -1047,57 +1048,19 @@ void cogl_path_move_to_rel (ClutterFixed x, * Adds a straight line segment to the current path that ends at the * given coordinates. **/ -void cogl_path_line_to (ClutterFixed x, - ClutterFixed y); +void cogl_path_line_to (ClutterFixed x, + ClutterFixed y); /** - * cogl_path_line_to_rel: + * cogl_path_rel_line_to: * @x: X offset from the current pen location of the end line vertex * @y: Y offset from the current pen location of the end line vertex * * Adds a straight line segment to the current path that ends at the * given coordinates relative to the current pen location. **/ -void cogl_path_line_to_rel (ClutterFixed x, - ClutterFixed y); - -/** - * cogl_path_h_line_to: - * @x: X coordinate of the end line vertex - * - * Adds a straight horizontal line segment to the current path that - * ends at the given X coordinate and current pen Y coordinate. - **/ -void cogl_path_h_line_to (ClutterFixed x); - -/** - * cogl_path_v_line_to: - * @y: Y coordinate of the end line vertex - * - * Adds a stright vertical line segment to the current path that ends - * at the current pen X coordinate and the given Y coordinate. - **/ -void cogl_path_v_line_to (ClutterFixed y); - -/** - * cogl_path_h_line_to_rel: - * @x: X offset from the current pen location of the end line vertex - * - * Adds a straight horizontal line segment to the current path that - * ends at the given X coordinate relative to the current pen location - * and current pen Y coordinate. - **/ -void cogl_path_h_line_to_rel (ClutterFixed x); - -/** - * cogl_path_v_line_to_rel: - * @y: Y offset from the current pen location of the end line vertex - * - * Adds a stright vertical line segment to the current path that ends - * at the current pen X coordinate and the given Y coordinate relative - * to the current pen location. - **/ -void cogl_path_v_line_to_rel (ClutterFixed y); +void cogl_path_rel_line_to (ClutterFixed x, + ClutterFixed y); /** @@ -1108,7 +1071,6 @@ void cogl_path_v_line_to_rel (ClutterFixed y); * @radius_y: Y radious of the elliptical arc * @angle_1: Angle in the unit-circle at which the arc begin * @angle_2: Angle in the unit-circle at which the arc ends - * @angle_step: Angle increment resolution for subdivision * * Adds an elliptical arc segment to the current path. A straight line * segment will link the current pen location with the first vertex @@ -1119,69 +1081,12 @@ void cogl_path_arc (ClutterFixed center_x, ClutterFixed radius_x, ClutterFixed radius_y, ClutterAngle angle_1, - ClutterAngle angle_2, - ClutterAngle angle_step); + ClutterAngle angle_2); -/** - * cogl_path_arc_rel: - * @center_x: X offset from the current pen location of the elliptical - * arc center - * @center_y: Y offset from the current pen location of the elliptical - * arc center - * @radius_x: X radius of the elliptical arc - * @radius_y: Y radious of the elliptical arc - * @angle_1: Angle in the unit-circle at which the arc begin - * @angle_2: Angle in the unit-circle at which the arc ends - * @angle_step: Angle increment resolution for subdivision - * - * Adds an elliptical arc segment to the current path. A straight line - * segment will link the current pen location with the first vertex - * of the arc. - **/ -void cogl_path_arc_rel (ClutterFixed center_x, - ClutterFixed center_y, - ClutterFixed radius_x, - ClutterFixed radius_y, - ClutterAngle angle_1, - ClutterAngle angle_2, - ClutterAngle angle_step); - -/** - * cogl_path_bezier2_to: - * @x1: X coordinate of the second bezier control point - * @y1: Y coordinate of the second bezier control point - * @x2: X coordinate of the third bezier control point - * @y2: Y coordinate of the third bezier control point - * - * Adds a quadratic bezier curve segment to the current path with the given - * second and third control points and using current pen location as the - * first control point. - **/ -void cogl_path_bezier2_to (ClutterFixed x1, - ClutterFixed y1, - ClutterFixed x2, - ClutterFixed y2); /** - * cogl_path_bezier2_to_rel: - * @x1: X coordinate of the second bezier control point - * @y1: Y coordinate of the second bezier control point - * @x2: X coordinate of the third bezier control point - * @y2: Y coordinate of the third bezier control point - * - * Adds a quadratic bezier curve segment to the current path with the given - * second and third control points and using current pen location as the - * first control point. The given coordinates are relative to the current - * pen location. - **/ -void cogl_path_bezier2_to_rel (ClutterFixed x1, - ClutterFixed y1, - ClutterFixed x2, - ClutterFixed y2); - -/** - * cogl_path_bezier3_to: + * cogl_path_curve_to: * @x1: X coordinate of the second bezier control point * @y1: Y coordinate of the second bezier control point * @x2: X coordinate of the third bezier control point @@ -1193,7 +1098,7 @@ void cogl_path_bezier2_to_rel (ClutterFixed x1, * second, third and fourth control points and using current pen location * as the first control point. **/ -void cogl_path_bezier3_to (ClutterFixed x1, +void cogl_path_curve_to (ClutterFixed x1, ClutterFixed y1, ClutterFixed x2, ClutterFixed y2, @@ -1201,7 +1106,7 @@ void cogl_path_bezier3_to (ClutterFixed x1, ClutterFixed y3); /** - * cogl_path_bezier3_to_rel: + * cogl_path_rel_curve_to: * @x1: X coordinate of the second bezier control point * @y1: Y coordinate of the second bezier control point * @x2: X coordinate of the third bezier control point @@ -1214,7 +1119,7 @@ void cogl_path_bezier3_to (ClutterFixed x1, * as the first control point. The given coordinates are relative to the * current pen location. */ -void cogl_path_bezier3_to_rel (ClutterFixed x1, +void cogl_path_rel_curve_to (ClutterFixed x1, ClutterFixed y1, ClutterFixed x2, ClutterFixed y2, @@ -1230,7 +1135,7 @@ void cogl_path_bezier3_to_rel (ClutterFixed x1, void cogl_path_close (void); /** - * cogl_line: + * cogl_path_line: * @x1: X coordinate of the start line vertex * @y1: Y coordinate of the start line vertex * @x2: X coordinate of the end line vertex @@ -1239,13 +1144,13 @@ void cogl_path_close (void); * Clears the previously constructed shape and constructs a straight * line shape start and ending at the given coordinates. **/ -void cogl_line (ClutterFixed x1, +void cogl_path_line (ClutterFixed x1, ClutterFixed y1, ClutterFixed x2, ClutterFixed y2); /** - * cogl_polyline: + * cogl_path_polyline: * @coords: A pointer to the first element of an array of fixed-point * values that specify the vertex coordinates. * @num_points: The total number of vertices. @@ -1261,12 +1166,12 @@ void cogl_line (ClutterFixed x1, * fashion for the rest of the vertices. (num_points - 1) segments will * be constructed. **/ -void cogl_polyline (ClutterFixed *coords, +void cogl_path_polyline (ClutterFixed *coords, gint num_points); /** - * cogl_polygon: + * cogl_path_polygon: * @coords: A pointer to the first element of an array of fixed-point * values that specify the vertex coordinates. * @num_points: The total number of vertices. @@ -1279,12 +1184,12 @@ void cogl_polyline (ClutterFixed *coords, * represents the Y coordinate of the first vertex, continuing in the same * fashion for the rest of the vertices. **/ -void cogl_polygon (ClutterFixed *coords, +void cogl_path_polygon (ClutterFixed *coords, gint num_points); /** - * cogl_rectangle: + * cogl_path_rectangle: * @x: X coordinate of the top-left corner. * @y: Y coordinate of the top-left corner. * @width: Rectangle width. @@ -1293,35 +1198,13 @@ void cogl_polygon (ClutterFixed *coords, * Clears the previously constructed shape and constructs a rectangular * shape at the given coordinates. **/ -void cogl_rectangle (ClutterFixed x, +void cogl_path_rectangle (ClutterFixed x, ClutterFixed y, ClutterFixed width, ClutterFixed height); /** - * cogl_arc: - * @center_x: X coordinate of the elliptical arc center - * @center_y: Y coordinate of the elliptical arc center - * @radius_x: X radius of the elliptical arc - * @radius_y: Y radious of the elliptical arc - * @angle_1: Angle in the unit-circle at which the arc begin - * @angle_2: Angle in the unit-circle at which the arc ends - * @angle_step: Angle increment resolution for subdivision - * - * Clears the previously constructed shape and constructs and elliptical arc - * shape. - **/ -void cogl_arc (ClutterFixed center_x, - ClutterFixed center_y, - ClutterFixed radius_x, - ClutterFixed radius_y, - ClutterAngle angle_1, - ClutterAngle angle_2, - ClutterAngle angle_step); - - -/** - * cogl_ellipse: + * cogl_path_ellipse: * @center_x: X coordinate of the ellipse center * @center_y: Y coordinate of the ellipse center * @radius_x: X radius of the ellipse @@ -1331,15 +1214,14 @@ void cogl_arc (ClutterFixed center_x, * Clears the previously constructed shape and constructs an ellipse * shape. **/ -void cogl_ellipse (ClutterFixed center_x, +void cogl_path_ellipse (ClutterFixed center_x, ClutterFixed center_y, ClutterFixed radius_x, ClutterFixed radius_y, ClutterAngle angle_step); - /** - * cogl_round_rectangle: + * 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 @@ -1351,7 +1233,7 @@ void cogl_ellipse (ClutterFixed center_x, * Clears the previously constructed shape and constructs a rectangular * shape with rounded corners. **/ -void cogl_round_rectangle (ClutterFixed x, +void cogl_path_round_rectangle (ClutterFixed x, ClutterFixed y, ClutterFixed width, ClutterFixed height, @@ -1539,7 +1421,7 @@ void cogl_offscreen_unref (CoglHandle handle); * */ void cogl_offscreen_blit (CoglHandle src_buffer, - CoglHandle dst_buffer); + CoglHandle dst_buffer); /** * cogl_offscreen_blit_region: diff --git a/clutter/cogl/gl/cogl-primitives.c b/clutter/cogl/gl/cogl-primitives.c index 3528c2b5d..364eea89e 100644 --- a/clutter/cogl/gl/cogl-primitives.c +++ b/clutter/cogl/gl/cogl-primitives.c @@ -37,10 +37,10 @@ #define _COGL_MAX_BEZ_RECURSE_DEPTH 16 void -cogl_fast_fill_rectangle (gint x, - gint y, - guint width, - guint height) +cogl_rectangle (gint x, + gint y, + guint width, + guint height) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); @@ -52,10 +52,10 @@ cogl_fast_fill_rectangle (gint x, void -cogl_fast_fill_rectanglex (ClutterFixed x, - ClutterFixed y, - ClutterFixed width, - ClutterFixed height) +cogl_rectanglex (ClutterFixed x, + ClutterFixed y, + ClutterFixed width, + ClutterFixed height) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); @@ -68,13 +68,14 @@ cogl_fast_fill_rectanglex (ClutterFixed x, CLUTTER_FIXED_TO_FLOAT (y + height)) ); } +#if 0 void -cogl_fast_fill_trapezoid (gint y1, - gint x11, - gint x21, - gint y2, - gint x12, - gint x22) +cogl_trapezoid (gint y1, + gint x11, + gint x21, + gint y2, + gint x12, + gint x22) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); @@ -90,12 +91,12 @@ cogl_fast_fill_trapezoid (gint y1, } void -cogl_fast_fill_trapezoidx (ClutterFixed y1, - ClutterFixed x11, - ClutterFixed x21, - ClutterFixed y2, - ClutterFixed x12, - ClutterFixed x22) +cogl_trapezoidx (ClutterFixed y1, + ClutterFixed x11, + ClutterFixed x21, + ClutterFixed y2, + ClutterFixed x12, + ClutterFixed x22) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); @@ -114,6 +115,7 @@ cogl_fast_fill_trapezoidx (ClutterFixed y1, CLUTTER_FIXED_TO_FLOAT (y2)) ); GE( glEnd () ); } +#endif static void _cogl_path_clear_nodes () @@ -197,8 +199,7 @@ _cogl_path_fill_nodes () GE( glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE) ); cogl_enable (COGL_ENABLE_VERTEX_ARRAY - | (ctx->color_alpha < 255 - ? COGL_ENABLE_BLEND : 0)); + | (ctx->color_alpha < 255 ? COGL_ENABLE_BLEND : 0)); GE( glVertexPointer (2, GL_FLOAT, 0, ctx->path_nodes) ); GE( glDrawArrays (GL_TRIANGLE_FAN, 0, ctx->path_nodes_size) ); @@ -212,7 +213,7 @@ _cogl_path_fill_nodes () bounds_w = CLUTTER_FIXED_CEIL (ctx->path_nodes_max.x - ctx->path_nodes_min.x); bounds_h = CLUTTER_FIXED_CEIL (ctx->path_nodes_max.y - ctx->path_nodes_min.y); - cogl_fast_fill_rectangle (bounds_x, bounds_y, bounds_w, bounds_h); + cogl_rectangle (bounds_x, bounds_y, bounds_w, bounds_h); GE( glDisable (GL_STENCIL_TEST) ); } @@ -242,7 +243,7 @@ cogl_stroke () void cogl_path_move_to (ClutterFixed x, - ClutterFixed y) + ClutterFixed y) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); @@ -258,18 +259,18 @@ cogl_path_move_to (ClutterFixed x, } void -cogl_path_move_to_rel (ClutterFixed x, - ClutterFixed y) +cogl_path_rel_move_to (ClutterFixed x, + ClutterFixed y) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); cogl_path_move_to (ctx->path_pen.x + x, - ctx->path_pen.y + y); + ctx->path_pen.y + y); } void cogl_path_line_to (ClutterFixed x, - ClutterFixed y) + ClutterFixed y) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); @@ -280,52 +281,15 @@ cogl_path_line_to (ClutterFixed x, } void -cogl_path_line_to_rel (ClutterFixed x, - ClutterFixed y) +cogl_path_rel_line_to (ClutterFixed x, + ClutterFixed y) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); cogl_path_line_to (ctx->path_pen.x + x, - ctx->path_pen.y + y); + ctx->path_pen.y + y); } -void -cogl_path_h_line_to (ClutterFixed x) -{ - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - cogl_path_line_to (x, - ctx->path_pen.y); -} - -void -cogl_path_v_line_to (ClutterFixed y) -{ - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - cogl_path_line_to (ctx->path_pen.x, - y); -} - -void -cogl_path_h_line_to_rel (ClutterFixed x) -{ - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - cogl_path_line_to (ctx->path_pen.x + x, - ctx->path_pen.y); -} - -void -cogl_path_v_line_to_rel (ClutterFixed y) -{ - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - cogl_path_line_to (ctx->path_pen.x, - ctx->path_pen.y + y); -} - - void cogl_path_close () { @@ -367,10 +331,10 @@ cogl_polygon (ClutterFixed *coords, } void -cogl_rectangle (ClutterFixed x, - ClutterFixed y, - ClutterFixed width, - ClutterFixed height) +cogl_path_rectangle (ClutterFixed x, + ClutterFixed y, + ClutterFixed width, + ClutterFixed height) { cogl_path_move_to (x, y); cogl_path_line_to (x + width, y); @@ -430,13 +394,13 @@ _cogl_arc (ClutterFixed center_x, void cogl_path_arc (ClutterFixed center_x, - ClutterFixed center_y, - ClutterFixed radius_x, - ClutterFixed radius_y, - ClutterAngle angle_1, - ClutterAngle angle_2, - ClutterAngle angle_step) + ClutterFixed center_y, + ClutterFixed radius_x, + ClutterFixed radius_y, + ClutterAngle angle_1, + ClutterAngle angle_2) { + ClutterAngle angle_step = 10; _cogl_arc (center_x, center_y, radius_x, radius_y, angle_1, angle_2, @@ -462,16 +426,15 @@ cogl_path_arc_rel (ClutterFixed center_x, angle_step, 0 /* no move */); } - void cogl_arc (ClutterFixed center_x, ClutterFixed center_y, ClutterFixed radius_x, ClutterFixed radius_y, ClutterAngle angle_1, - ClutterAngle angle_2, - ClutterAngle angle_step) + ClutterAngle angle_2) { + ClutterAngle angle_step = 10; _cogl_arc (center_x, center_y, radius_x, radius_y, angle_1, angle_2, @@ -482,9 +445,9 @@ void cogl_ellipse (ClutterFixed center_x, ClutterFixed center_y, ClutterFixed radius_x, - ClutterFixed radius_y, - ClutterAngle angle_step) + ClutterFixed radius_y) { + ClutterAngle angle_step = 10; /* FIXME: if shows to be slow might be optimized * by mirroring just a quarter of it */ @@ -505,6 +468,7 @@ cogl_round_rectangle (ClutterFixed x, ClutterFixed radius, ClutterAngle arc_step) { + _COGL_GET_CONTEXT (ctx, NO_RETVAL); ClutterFixed inner_width = width - (radius << 1); ClutterFixed inner_height = height - (radius << 1); @@ -515,21 +479,25 @@ cogl_round_rectangle (ClutterFixed x, CLUTTER_ANGLE_FROM_DEG (270), arc_step); - cogl_path_h_line_to_rel (inner_width); + cogl_path_line_to (ctx->path_pen.x + inner_width, + ctx->path_pen.y); cogl_path_arc_rel (0, radius, radius, radius, CLUTTER_ANGLE_FROM_DEG (-90), CLUTTER_ANGLE_FROM_DEG (0), arc_step); - cogl_path_v_line_to_rel (inner_height); + cogl_path_line_to (ctx->path_pen.x, + ctx->path_pen.y + inner_height); + cogl_path_arc_rel (-radius, 0, radius, radius, CLUTTER_ANGLE_FROM_DEG (0), CLUTTER_ANGLE_FROM_DEG (90), arc_step); - cogl_path_h_line_to_rel (-inner_width); + cogl_path_line_to (ctx->path_pen.x - inner_width, + ctx->path_pen.y); cogl_path_arc_rel (0, -radius, radius, radius, CLUTTER_ANGLE_FROM_DEG (90), @@ -539,6 +507,7 @@ cogl_round_rectangle (ClutterFixed x, cogl_path_close (); } +#if 0 static void _cogl_path_bezier2_sub (CoglBezQuad *quad) { @@ -604,6 +573,7 @@ _cogl_path_bezier2_sub (CoglBezQuad *quad) qright->p3 = q->p3; } } +#endif static void _cogl_path_bezier3_sub (CoglBezCubic *cubic) @@ -696,6 +666,7 @@ _cogl_path_bezier3_sub (CoglBezCubic *cubic) } } +#if 0 void cogl_path_bezier2_to (ClutterFixed x1, ClutterFixed y1, @@ -720,15 +691,15 @@ cogl_path_bezier2_to (ClutterFixed x1, _cogl_path_add_node (quad.p3.x, quad.p3.y); ctx->path_pen = quad.p3; } - +#endif void -cogl_path_bezier3_to (ClutterFixed x1, - ClutterFixed y1, - ClutterFixed x2, - ClutterFixed y2, - ClutterFixed x3, - ClutterFixed y3) +cogl_path_curve_to (ClutterFixed x1, + ClutterFixed y1, + ClutterFixed x2, + ClutterFixed y2, + ClutterFixed x3, + ClutterFixed y3) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); @@ -752,21 +723,7 @@ cogl_path_bezier3_to (ClutterFixed x1, } void -cogl_path_bezier2_to_rel (ClutterFixed x1, - ClutterFixed y1, - ClutterFixed x2, - ClutterFixed y2) -{ - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - cogl_path_bezier2_to (ctx->path_pen.x + x1, - ctx->path_pen.y + y2, - ctx->path_pen.x + x2, - ctx->path_pen.y + y2); -} - -void -cogl_path_bezier3_to_rel (ClutterFixed x1, +cogl_rel_curve_to (ClutterFixed x1, ClutterFixed y1, ClutterFixed x2, ClutterFixed y2, @@ -775,10 +732,10 @@ cogl_path_bezier3_to_rel (ClutterFixed x1, { _COGL_GET_CONTEXT (ctx, NO_RETVAL); - cogl_path_bezier3_to (ctx->path_pen.x + x1, - ctx->path_pen.y + y2, - ctx->path_pen.x + x2, - ctx->path_pen.y + y2, - ctx->path_pen.x + x3, - ctx->path_pen.y + y3); + cogl_path_curve_to (ctx->path_pen.x + x1, + ctx->path_pen.y + y2, + ctx->path_pen.x + x2, + ctx->path_pen.y + y2, + ctx->path_pen.x + x3, + ctx->path_pen.y + y3); } diff --git a/clutter/cogl/gles/cogl-primitives.c b/clutter/cogl/gles/cogl-primitives.c index 006833743..ed25e3c45 100644 --- a/clutter/cogl/gles/cogl-primitives.c +++ b/clutter/cogl/gles/cogl-primitives.c @@ -37,10 +37,10 @@ #define _COGL_MAX_BEZ_RECURSE_DEPTH 16 void -cogl_fast_fill_rectangle (gint x, - gint y, - guint width, - guint height) +cogl_rectangle (gint x, + gint y, + guint width, + guint height) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); @@ -54,20 +54,19 @@ cogl_fast_fill_rectangle (gint x, (GLshort) x, (GLshort) (y + height), (GLshort) (x + width), (GLshort) (y + height) }; - + cogl_enable (COGL_ENABLE_VERTEX_ARRAY - | (ctx->color_alpha < 255 - ? COGL_ENABLE_BLEND : 0)); - - GE( glVertexPointer (2, GL_SHORT, 0, rect_verts) ); - GE( glDrawArrays (GL_TRIANGLE_STRIP, 0, 4) ); + | (ctx->color_alpha < 255 ? COGL_ENABLE_BLEND : 0)); + GE ( glVertexPointer (2, GL_SHORT, 0, rect_verts ) ); + GE ( glDrawArrays (GL_TRIANGLE_STRIP, 0, 4) ); } + void -cogl_fast_fill_rectanglex (ClutterFixed x, - ClutterFixed y, - ClutterFixed width, - ClutterFixed height) +cogl_rectanglex (ClutterFixed x, + ClutterFixed y, + ClutterFixed width, + ClutterFixed height) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); @@ -77,64 +76,64 @@ cogl_fast_fill_rectanglex (ClutterFixed x, x, y + height, x + width, y + height }; - + cogl_enable (COGL_ENABLE_VERTEX_ARRAY | (ctx->color_alpha < 255 ? COGL_ENABLE_BLEND : 0)); GE( glVertexPointer (2, GL_FIXED, 0, rect_verts) ); GE( glDrawArrays (GL_TRIANGLE_STRIP, 0, 4) ); + } +#if 0 void -cogl_fast_fill_trapezoid (gint y1, - gint x11, - gint x21, - gint y2, - gint x12, - gint x22) +cogl_trapezoid (gint y1, + gint x11, + gint x21, + gint y2, + gint x12, + gint x22) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); - GLshort trap_verts[8] = { - (GLshort) x11, (GLshort) y1, - (GLshort) x21, (GLshort) y1, - (GLshort) x12, (GLshort) y2, - (GLshort) x22, (GLshort) y2 - }; + cogl_enable (ctx->color_alpha < 255 + ? COGL_ENABLE_BLEND : 0); - cogl_enable (COGL_ENABLE_VERTEX_ARRAY - | (ctx->color_alpha < 255 - ? COGL_ENABLE_BLEND : 0)); - - GE( glVertexPointer (2, GL_SHORT, 0, trap_verts) ); - GE( glDrawArrays (GL_TRIANGLE_STRIP, 0, 4) ); + GE( glBegin (GL_QUADS) ); + GE( glVertex2i (x11, y1) ); + GE( glVertex2i (x21, y1) ); + GE( glVertex2i (x22, y2) ); + GE( glVertex2i (x12, y2) ); + GE( glEnd () ); } void -cogl_fast_fill_trapezoidx (ClutterFixed y1, - ClutterFixed x11, - ClutterFixed x21, - ClutterFixed y2, - ClutterFixed x12, - ClutterFixed x22) +cogl_trapezoidx (ClutterFixed y1, + ClutterFixed x11, + ClutterFixed x21, + ClutterFixed y2, + ClutterFixed x12, + ClutterFixed x22) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); - GLfixed trap_verts[8] = { - x11, y1, - x21, y1, - x12, y2, - x22, y2 - }; + cogl_enable (ctx->color_alpha < 255 + ? COGL_ENABLE_BLEND : 0); - cogl_enable (COGL_ENABLE_VERTEX_ARRAY - | (ctx->color_alpha < 255 - ? COGL_ENABLE_BLEND : 0)); + GE( glBegin (GL_QUADS) ); - GE( glVertexPointer (2, GL_FIXED, 0, trap_verts) ); - GE( glDrawArrays (GL_TRIANGLE_STRIP, 0, 4) ); + GE( glVertex2f (CLUTTER_FIXED_TO_FLOAT (x11), + CLUTTER_FIXED_TO_FLOAT (y1)) ); + GE( glVertex2f (CLUTTER_FIXED_TO_FLOAT (x21), + CLUTTER_FIXED_TO_FLOAT (y1)) ); + GE( glVertex2f (CLUTTER_FIXED_TO_FLOAT (x22), + CLUTTER_FIXED_TO_FLOAT (y2)) ); + GE( glVertex2f (CLUTTER_FIXED_TO_FLOAT (x12), + CLUTTER_FIXED_TO_FLOAT (y2)) ); + GE( glEnd () ); } +#endif static void _cogl_path_clear_nodes () @@ -142,7 +141,7 @@ _cogl_path_clear_nodes () _COGL_GET_CONTEXT (ctx, NO_RETVAL); if (ctx->path_nodes) - g_free (ctx->path_nodes); + g_free(ctx->path_nodes); ctx->path_nodes = (CoglFixedVec2*) g_malloc (2 * sizeof(CoglFixedVec2)); ctx->path_nodes_size = 0; @@ -169,8 +168,8 @@ _cogl_path_add_node (ClutterFixed x, ctx->path_nodes_cap *= 2; } - ctx->path_nodes [ctx->path_nodes_size] .x = x; - ctx->path_nodes [ctx->path_nodes_size] .y = y; + ctx->path_nodes [ctx->path_nodes_size] .x = CLUTTER_FIXED_TO_FLOAT (x); + ctx->path_nodes [ctx->path_nodes_size] .y = CLUTTER_FIXED_TO_FLOAT (y); ctx->path_nodes_size++; if (ctx->path_nodes_size == 1) @@ -196,7 +195,7 @@ _cogl_path_stroke_nodes () | (ctx->color_alpha < 255 ? COGL_ENABLE_BLEND : 0)); - GE( glVertexPointer (2, GL_FIXED, 0, ctx->path_nodes) ); + GE( glVertexPointer (2, GL_FLOAT, 0, ctx->path_nodes) ); GE( glDrawArrays (GL_LINE_STRIP, 0, ctx->path_nodes_size) ); } @@ -211,17 +210,16 @@ _cogl_path_fill_nodes () guint bounds_h; GE( glClear (GL_STENCIL_BUFFER_BIT) ); - + GE( glEnable (GL_STENCIL_TEST) ); GE( glStencilFunc (GL_ALWAYS, 0x0, 0x0) ); GE( glStencilOp (GL_INVERT, GL_INVERT, GL_INVERT) ); GE( glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE) ); cogl_enable (COGL_ENABLE_VERTEX_ARRAY - | (ctx->color_alpha < 255 - ? COGL_ENABLE_BLEND : 0)); + | (ctx->color_alpha < 255 ? COGL_ENABLE_BLEND : 0)); - GE( glVertexPointer (2, GL_FIXED, 0, ctx->path_nodes) ); + GE( glVertexPointer (2, GL_FLOAT, 0, ctx->path_nodes) ); GE( glDrawArrays (GL_TRIANGLE_FAN, 0, ctx->path_nodes_size) ); GE( glStencilFunc (GL_EQUAL, 0x1, 0x1) ); @@ -233,7 +231,7 @@ _cogl_path_fill_nodes () bounds_w = CLUTTER_FIXED_CEIL (ctx->path_nodes_max.x - ctx->path_nodes_min.x); bounds_h = CLUTTER_FIXED_CEIL (ctx->path_nodes_max.y - ctx->path_nodes_min.y); - cogl_fast_fill_rectangle (bounds_x, bounds_y, bounds_w, bounds_h); + cogl_rectangle (bounds_x, bounds_y, bounds_w, bounds_h); GE( glDisable (GL_STENCIL_TEST) ); } @@ -247,6 +245,7 @@ cogl_fill () return; _cogl_path_fill_nodes(); + } void @@ -262,8 +261,8 @@ cogl_stroke () void cogl_path_move_to (ClutterFixed x, - ClutterFixed y) -{ + ClutterFixed y) +{ _COGL_GET_CONTEXT (ctx, NO_RETVAL); /* FIXME: handle multiple contours maybe? */ @@ -278,18 +277,18 @@ cogl_path_move_to (ClutterFixed x, } void -cogl_path_move_to_rel (ClutterFixed x, - ClutterFixed y) +cogl_path_rel_move_to (ClutterFixed x, + ClutterFixed y) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); cogl_path_move_to (ctx->path_pen.x + x, - ctx->path_pen.y + y); + ctx->path_pen.y + y); } void cogl_path_line_to (ClutterFixed x, - ClutterFixed y) + ClutterFixed y) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); @@ -300,49 +299,13 @@ cogl_path_line_to (ClutterFixed x, } void -cogl_path_line_to_rel (ClutterFixed x, - ClutterFixed y) +cogl_path_rel_line_to (ClutterFixed x, + ClutterFixed y) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); cogl_path_line_to (ctx->path_pen.x + x, - ctx->path_pen.y + y); -} - -void -cogl_path_h_line_to (ClutterFixed x) -{ - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - cogl_path_line_to (x, - ctx->path_pen.y); -} - -void -cogl_path_v_line_to (ClutterFixed y) -{ - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - cogl_path_line_to (ctx->path_pen.x, - y); -} - -void -cogl_path_h_line_to_rel (ClutterFixed x) -{ - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - cogl_path_line_to (ctx->path_pen.x + x, - ctx->path_pen.y); -} - -void -cogl_path_v_line_to_rel (ClutterFixed y) -{ - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - cogl_path_line_to (ctx->path_pen.x, - ctx->path_pen.y + y); + ctx->path_pen.y + y); } void @@ -354,6 +317,7 @@ cogl_path_close () ctx->path_pen = ctx->path_start; } + void cogl_line (ClutterFixed x1, ClutterFixed y1, @@ -370,10 +334,10 @@ cogl_polyline (ClutterFixed *coords, { gint c = 0; - cogl_path_move_to(coords[0], coords[1]); + cogl_path_move_to (coords[0], coords[1]); for (c = 1; c < num_points; ++c) - cogl_path_line_to(coords[2*c], coords[2*c+1]); + cogl_path_line_to (coords[2*c], coords[2*c+1]); } void @@ -385,10 +349,10 @@ cogl_polygon (ClutterFixed *coords, } void -cogl_rectangle (ClutterFixed x, - ClutterFixed y, - ClutterFixed width, - ClutterFixed height) +cogl_path_rectangle (ClutterFixed x, + ClutterFixed y, + ClutterFixed width, + ClutterFixed height) { cogl_path_move_to (x, y); cogl_path_line_to (x + width, y); @@ -448,19 +412,20 @@ _cogl_arc (ClutterFixed center_x, void cogl_path_arc (ClutterFixed center_x, - ClutterFixed center_y, - ClutterFixed radius_x, - ClutterFixed radius_y, - ClutterAngle angle_1, - ClutterAngle angle_2, - ClutterAngle angle_step) -{ + ClutterFixed center_y, + ClutterFixed radius_x, + ClutterFixed radius_y, + ClutterAngle angle_1, + ClutterAngle angle_2) +{ + ClutterAngle angle_step = 10; _cogl_arc (center_x, center_y, radius_x, radius_y, angle_1, angle_2, angle_step, 0 /* no move */); } + void cogl_path_arc_rel (ClutterFixed center_x, ClutterFixed center_y, @@ -485,9 +450,9 @@ cogl_arc (ClutterFixed center_x, ClutterFixed radius_x, ClutterFixed radius_y, ClutterAngle angle_1, - ClutterAngle angle_2, - ClutterAngle angle_step) + ClutterAngle angle_2) { + ClutterAngle angle_step = 10; _cogl_arc (center_x, center_y, radius_x, radius_y, angle_1, angle_2, @@ -498,9 +463,9 @@ void cogl_ellipse (ClutterFixed center_x, ClutterFixed center_y, ClutterFixed radius_x, - ClutterFixed radius_y, - ClutterAngle angle_step) + ClutterFixed radius_y) { + ClutterAngle angle_step = 10; /* FIXME: if shows to be slow might be optimized * by mirroring just a quarter of it */ @@ -521,6 +486,7 @@ cogl_round_rectangle (ClutterFixed x, ClutterFixed radius, ClutterAngle arc_step) { + _COGL_GET_CONTEXT (ctx, NO_RETVAL); ClutterFixed inner_width = width - (radius << 1); ClutterFixed inner_height = height - (radius << 1); @@ -531,21 +497,25 @@ cogl_round_rectangle (ClutterFixed x, CLUTTER_ANGLE_FROM_DEG (270), arc_step); - cogl_path_h_line_to_rel (inner_width); + cogl_path_line_to (ctx->path_pen.x + inner_width, + ctx->path_pen.y); cogl_path_arc_rel (0, radius, radius, radius, CLUTTER_ANGLE_FROM_DEG (-90), CLUTTER_ANGLE_FROM_DEG (0), arc_step); - cogl_path_v_line_to_rel (inner_height); + cogl_path_line_to (ctx->path_pen.x, + ctx->path_pen.y + inner_height); + cogl_path_arc_rel (-radius, 0, radius, radius, CLUTTER_ANGLE_FROM_DEG (0), CLUTTER_ANGLE_FROM_DEG (90), arc_step); - cogl_path_h_line_to_rel (-inner_width); + cogl_path_line_to (ctx->path_pen.x - inner_width, + ctx->path_pen.y); cogl_path_arc_rel (0, -radius, radius, radius, CLUTTER_ANGLE_FROM_DEG (90), @@ -555,6 +525,7 @@ cogl_round_rectangle (ClutterFixed x, cogl_path_close (); } +#if 0 static void _cogl_path_bezier2_sub (CoglBezQuad *quad) { @@ -620,6 +591,7 @@ _cogl_path_bezier2_sub (CoglBezQuad *quad) qright->p3 = q->p3; } } +#endif static void _cogl_path_bezier3_sub (CoglBezCubic *cubic) @@ -712,17 +684,7 @@ _cogl_path_bezier3_sub (CoglBezCubic *cubic) } } -/** - * cogl_path_bezier2_to: - * @x1: X coordinate of the second bezier control point - * @y1: Y coordinate of the second bezier control point - * @x2: X coordinate of the third bezier control point - * @y2: Y coordinate of the third bezier control point - * - * Adds a quadratic bezier curve segment to the current path with the given - * second and third control points and using current pen location as the - * first control point. - **/ +#if 0 void cogl_path_bezier2_to (ClutterFixed x1, ClutterFixed y1, @@ -747,27 +709,15 @@ cogl_path_bezier2_to (ClutterFixed x1, _cogl_path_add_node (quad.p3.x, quad.p3.y); ctx->path_pen = quad.p3; } +#endif -/** - * cogl_path_bezier3_to: - * @x1: X coordinate of the second bezier control point - * @y1: Y coordinate of the second bezier control point - * @x2: X coordinate of the third bezier control point - * @y2: Y coordinate of the third bezier control point - * @x3: X coordinate of the fourth bezier control point - * @y3: Y coordinate of the fourth bezier control point - * - * Adds a cubic bezier curve segment to the current path with the given - * second, third and fourth control points and using current pen location - * as the first control point. - **/ void -cogl_path_bezier3_to (ClutterFixed x1, - ClutterFixed y1, - ClutterFixed x2, - ClutterFixed y2, - ClutterFixed x3, - ClutterFixed y3) +cogl_path_curve_to (ClutterFixed x1, + ClutterFixed y1, + ClutterFixed x2, + ClutterFixed y2, + ClutterFixed x3, + ClutterFixed y3) { _COGL_GET_CONTEXT (ctx, NO_RETVAL); @@ -790,48 +740,8 @@ cogl_path_bezier3_to (ClutterFixed x1, ctx->path_pen = cubic.p4; } -/** - * cogl_path_bezier2_to_rel: - * @x1: X coordinate of the second bezier control point - * @y1: Y coordinate of the second bezier control point - * @x2: X coordinate of the third bezier control point - * @y2: Y coordinate of the third bezier control point - * - * Adds a quadratic bezier curve segment to the current path with the given - * second and third control points and using current pen location as the - * first control point. The given coordinates are relative to the current - * pen location. - **/ void -cogl_path_bezier2_to_rel (ClutterFixed x1, - ClutterFixed y1, - ClutterFixed x2, - ClutterFixed y2) -{ - _COGL_GET_CONTEXT (ctx, NO_RETVAL); - - cogl_path_bezier2_to (ctx->path_pen.x + x1, - ctx->path_pen.y + y2, - ctx->path_pen.x + x2, - ctx->path_pen.y + y2); -} - -/** - * cogl_path_bezier3_to_rel: - * @x1: X coordinate of the second bezier control point - * @y1: Y coordinate of the second bezier control point - * @x2: X coordinate of the third bezier control point - * @y2: Y coordinate of the third bezier control point - * @x3: X coordinate of the fourth bezier control point - * @y3: Y coordinate of the fourth bezier control point - * - * Adds a cubic bezier curve segment to the current path with the given - * second, third and fourth control points and using current pen location - * as the first control point. The given coordinates are relative to the - * current pen location. - **/ -void -cogl_path_bezier3_to_rel (ClutterFixed x1, +cogl_rel_curve_to (ClutterFixed x1, ClutterFixed y1, ClutterFixed x2, ClutterFixed y2, @@ -840,10 +750,10 @@ cogl_path_bezier3_to_rel (ClutterFixed x1, { _COGL_GET_CONTEXT (ctx, NO_RETVAL); - cogl_path_bezier3_to (ctx->path_pen.x + x1, - ctx->path_pen.y + y2, - ctx->path_pen.x + x2, - ctx->path_pen.y + y2, - ctx->path_pen.x + x3, - ctx->path_pen.y + y3); + cogl_path_curve_to (ctx->path_pen.x + x1, + ctx->path_pen.y + y2, + ctx->path_pen.x + x2, + ctx->path_pen.y + y2, + ctx->path_pen.x + x3, + ctx->path_pen.y + y3); } diff --git a/clutter/cogl/gles/cogl.c b/clutter/cogl/gles/cogl.c index e43908893..455f80085 100644 --- a/clutter/cogl/gles/cogl.c +++ b/clutter/cogl/gles/cogl.c @@ -332,7 +332,7 @@ cogl_clip_set (ClutterFixed x_offset, GE( glColor4x (CFX_ONE, CFX_ONE, CFX_ONE, CFX_ONE ) ); - cogl_fast_fill_rectanglex (x_offset, y_offset, width, height); + cogl_rectanglex (x_offset, y_offset, width, height); GE( glStencilFunc (GL_EQUAL, 0x1, 0x1) ); GE( glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP) ); diff --git a/tests/test-cogl-offscreen.c b/tests/test-cogl-offscreen.c index 6d95db830..c27c1ca94 100644 --- a/tests/test-cogl-offscreen.c +++ b/tests/test-cogl-offscreen.c @@ -97,7 +97,7 @@ test_coglbox_paint(ClutterActor *self) priv = TEST_COGLBOX_GET_PRIVATE (self); cogl_color (&cback); - cogl_fast_fill_rectangle (0,0,400,400); + cogl_rectangle (0,0,400,400); cogl_color (&cfullopaque); cogl_texture_rectangle (priv->texhand_id, @@ -111,10 +111,10 @@ test_coglbox_paint(ClutterActor *self) cogl_draw_buffer (COGL_OFFSCREEN_BUFFER, priv->offscreen_id); cogl_color (&cred); - cogl_fast_fill_rectangle (20,20,100,100); + cogl_rectangle (20,20,100,100); cogl_color (&cgreen); - cogl_fast_fill_rectangle (80,80,100,100); + cogl_rectangle (80,80,100,100); cogl_draw_buffer (COGL_WINDOW_BUFFER, 0); diff --git a/tests/test-cogl-primitives.c b/tests/test-cogl-primitives.c index 2e1d270d5..a355b4dd1 100644 --- a/tests/test-cogl-primitives.c +++ b/tests/test-cogl-primitives.c @@ -80,29 +80,29 @@ static void test_paint_line () { cogl_line (CLUTTER_INT_TO_FIXED (-50), - CLUTTER_INT_TO_FIXED (-25), - CLUTTER_INT_TO_FIXED (50), - CLUTTER_INT_TO_FIXED (25)); + CLUTTER_INT_TO_FIXED (-25), + CLUTTER_INT_TO_FIXED (50), + CLUTTER_INT_TO_FIXED (25)); } static void test_paint_rect () { - cogl_rectangle (CLUTTER_INT_TO_FIXED (-50), - CLUTTER_INT_TO_FIXED (-25), - CLUTTER_INT_TO_FIXED (100), - CLUTTER_INT_TO_FIXED (50)); + cogl_path_rectangle (CLUTTER_INT_TO_FIXED (-50), + CLUTTER_INT_TO_FIXED (-25), + CLUTTER_INT_TO_FIXED (100), + CLUTTER_INT_TO_FIXED (50)); } static void test_paint_rndrect() { cogl_round_rectangle (CLUTTER_INT_TO_FIXED (-50), - CLUTTER_INT_TO_FIXED (-25), - CLUTTER_INT_TO_FIXED (100), - CLUTTER_INT_TO_FIXED (50), - CLUTTER_INT_TO_FIXED (10), - 5); + CLUTTER_INT_TO_FIXED (-25), + CLUTTER_INT_TO_FIXED (100), + CLUTTER_INT_TO_FIXED (50), + CLUTTER_INT_TO_FIXED (10), + 5); } static void @@ -139,52 +139,58 @@ test_paint_polyg () cogl_polygon (poly_coords, 4); } -static void -test_paint_arc () -{ - cogl_arc (0,0, - CLUTTER_INT_TO_FIXED (60), - CLUTTER_INT_TO_FIXED (40), - CLUTTER_ANGLE_FROM_DEG (-45), - CLUTTER_ANGLE_FROM_DEG (+45), - 10); -} - static void test_paint_elp () { cogl_ellipse (0, 0, - CLUTTER_INT_TO_FIXED (60), - CLUTTER_INT_TO_FIXED (40), - 10); + CLUTTER_INT_TO_FIXED (60), + CLUTTER_INT_TO_FIXED (40), + 10); } static void test_paint_bezier2 () { cogl_path_move_to (CLUTTER_INT_TO_FIXED (-50), - CLUTTER_INT_TO_FIXED (+25)); - - cogl_path_bezier2_to (CLUTTER_INT_TO_FIXED (0), - CLUTTER_INT_TO_FIXED (-25), - CLUTTER_INT_TO_FIXED (+50), - CLUTTER_INT_TO_FIXED (+25)); + CLUTTER_INT_TO_FIXED (+25)); + + /* a bezier2 is just the same as a bezier3 with both the two first + * coordinate pairs being equal + */ + cogl_path_curve_to (CLUTTER_INT_TO_FIXED (0), + CLUTTER_INT_TO_FIXED (-25), + CLUTTER_INT_TO_FIXED (0), + CLUTTER_INT_TO_FIXED (-25), + CLUTTER_INT_TO_FIXED (+50), + CLUTTER_INT_TO_FIXED (+25)); } static void test_paint_bezier3 () { cogl_path_move_to (CLUTTER_INT_TO_FIXED (-50), - CLUTTER_INT_TO_FIXED (+50)); + CLUTTER_INT_TO_FIXED (+50)); - cogl_path_bezier3_to (CLUTTER_INT_TO_FIXED (+100), - CLUTTER_INT_TO_FIXED (-50), - CLUTTER_INT_TO_FIXED (-100), - CLUTTER_INT_TO_FIXED (-50), - CLUTTER_INT_TO_FIXED (+50), - CLUTTER_INT_TO_FIXED (+50)); + cogl_path_curve_to (CLUTTER_INT_TO_FIXED (+100), + CLUTTER_INT_TO_FIXED (-50), + CLUTTER_INT_TO_FIXED (-100), + CLUTTER_INT_TO_FIXED (-50), + CLUTTER_INT_TO_FIXED (+50), + CLUTTER_INT_TO_FIXED (+50)); } +static PaintFunc paint_func []= +{ + test_paint_line, + test_paint_rect, + test_paint_rndrect, + test_paint_polyl, + test_paint_polyg, + test_paint_elp, + test_paint_bezier2, + test_paint_bezier3 +}; + static void test_coglbox_paint(ClutterActor *self) { @@ -196,20 +202,12 @@ test_coglbox_paint(ClutterActor *self) static GTimer *timer = NULL; static gint paint_index = 0; - const gint NUM_PAINT_FUNCS = 9; - PaintFunc paint_func [NUM_PAINT_FUNCS]; + gint NUM_PAINT_FUNCS; + + NUM_PAINT_FUNCS = G_N_ELEMENTS (paint_func); priv = TEST_COGLBOX_GET_PRIVATE (self); - paint_func[0] = test_paint_line; - paint_func[1] = test_paint_rect; - paint_func[2] = test_paint_rndrect; - paint_func[3] = test_paint_polyl; - paint_func[4] = test_paint_polyg; - paint_func[5] = test_paint_arc; - paint_func[6] = test_paint_elp; - paint_func[7] = test_paint_bezier2; - paint_func[8] = test_paint_bezier3; if (!timer) { diff --git a/tests/test-cogl-tex-convert.c b/tests/test-cogl-tex-convert.c index a602c6efc..78ebfc979 100644 --- a/tests/test-cogl-tex-convert.c +++ b/tests/test-cogl-tex-convert.c @@ -92,7 +92,7 @@ test_coglbox_paint(ClutterActor *self) priv = TEST_COGLBOX_GET_PRIVATE (self); cogl_color (&cback); - cogl_fast_fill_rectangle (0,0,400,400); + cogl_rectangle (0,0,400,400); cogl_color (&cwhite); diff --git a/tests/test-cogl-tex-foreign.c b/tests/test-cogl-tex-foreign.c index f887a636c..36f19cbde 100644 --- a/tests/test-cogl-tex-foreign.c +++ b/tests/test-cogl-tex-foreign.c @@ -92,7 +92,7 @@ test_coglbox_paint(ClutterActor *self) priv = TEST_COGLBOX_GET_PRIVATE (self); cogl_color (&cback); - cogl_fast_fill_rectangle (0,0,400,400); + cogl_rectangle (0,0,400,400); cogl_color (&cwhite); diff --git a/tests/test-cogl-tex-getset.c b/tests/test-cogl-tex-getset.c index 6ef9415cf..5726d5930 100644 --- a/tests/test-cogl-tex-getset.c +++ b/tests/test-cogl-tex-getset.c @@ -91,7 +91,7 @@ test_coglbox_paint(ClutterActor *self) priv = TEST_COGLBOX_GET_PRIVATE (self); cogl_color (&cback); - cogl_fast_fill_rectangle (0,0,400,400); + cogl_rectangle (0,0,400,400); cogl_color (&cwhite); diff --git a/tests/test-cogl-tex-tile.c b/tests/test-cogl-tex-tile.c index 7ce75056e..277238622 100644 --- a/tests/test-cogl-tex-tile.c +++ b/tests/test-cogl-tex-tile.c @@ -117,7 +117,7 @@ test_coglbox_paint(ClutterActor *self) cogl_push_matrix (); cogl_color (&cback); - cogl_fast_fill_rectangle (0,0,400,400); + cogl_rectangle (0,0,400,400); cogl_color (&cwhite); cogl_translate (100,100,0);