[Commit] cairo-demo/X11 cairo-knockout.c,1.2,1.3
Carl Worth
commit at keithp.com
Mon Sep 29 09:01:05 PDT 2003
Committed by: cworth
Update of /local/src/CVS/cairo-demo/X11
In directory home.keithp.com:/tmp/cvs-serv7017
Modified Files:
cairo-knockout.c
Log Message:
Use cairo_rectangle rather than private rect_path
Index: cairo-knockout.c
===================================================================
RCS file: /local/src/CVS/cairo-demo/X11/cairo-knockout.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cairo-knockout.c 4 Sep 2003 13:54:29 -0000 1.2
+++ cairo-knockout.c 29 Sep 2003 15:01:03 -0000 1.3
@@ -5,33 +5,16 @@
*
* Owen Taylor,
- * v0.1 30 November 2002
- * v0.2 1 December 2002 - typo fixes from Keith Packard
- * v0.3 17 April 2003 - Tracking changes in Xr, (Removal of Xr{Push,Pop}Group)
+ * v0.1 30 November 2002
+ * v0.2 1 December 2002 - typo fixes from Keith Packard
+ * v0.3 17 April 2003 - Tracking changes in Xr, (Removal of Xr{Push,Pop}Group)
+ * v0.4 29 September 2003 - Use cairo_rectangle rather than private rect_path
*/
#include <X11/Xlib.h>
#include <cairo.h>
#include <math.h>
#include <stdio.h>
-/* Create a rectangular path
- */
-static void
-rect_path (cairo_t *r,
- double x, double y,
- double width, double height)
-{
- cairo_new_path (r);
- cairo_move_to (r, x, y);
-
- cairo_rel_line_to (r, 0, height);
- cairo_rel_line_to (r, width, 0);
- cairo_rel_line_to (r, 0, -height);
- cairo_rel_line_to (r, -width, 0);
-
- cairo_close_path (r);
-}
-
/* Create a path that is roughly a circular oval with
* radii xr, yr at xc, yc. We only use 4 bezier's
* but the deviation is already pretty darn small.
@@ -101,14 +84,14 @@
cairo_set_rgb_color (r, 0.4, 0.4, 0.4);
- rect_path (r, 0, 0, 2 * CHECK_SIZE, 2 * CHECK_SIZE);
+ cairo_rectangle (r, 0, 0, 2 * CHECK_SIZE, 2 * CHECK_SIZE);
cairo_fill (r);
cairo_set_rgb_color (r, 0.7, 0.7, 0.7);
- rect_path (r, x, y, CHECK_SIZE, CHECK_SIZE);
+ cairo_rectangle (r, x, y, CHECK_SIZE, CHECK_SIZE);
cairo_fill (r);
- rect_path (r, x + CHECK_SIZE, y + CHECK_SIZE, CHECK_SIZE, CHECK_SIZE);
+ cairo_rectangle (r, x + CHECK_SIZE, y + CHECK_SIZE, CHECK_SIZE, CHECK_SIZE);
cairo_fill (r);
cairo_restore (r);
@@ -117,7 +100,7 @@
/* Fill the whole surface with the check */
cairo_set_pattern (r, check);
- rect_path (r, 0, 0, width, height);
+ cairo_rectangle (r, 0, 0, width, height);
cairo_fill (r);
cairo_surface_destroy (check);
More information about the Commit
mailing list