[cairo-commit] cairo-demo/cairo_snippets/snippets
curve_rectangle.cairo, 1.1, 1.2
Kristian Hogsberg
commit at pdx.freedesktop.org
Tue Feb 1 20:46:45 PST 2005
Committed by: krh
Update of /cvs/cairo/cairo-demo/cairo_snippets/snippets
In directory gabe:/tmp/cvs-serv2841/snippets
Modified Files:
curve_rectangle.cairo
Log Message:
2005-02-01 Kristian Høgsberg <krh at redhat.com>
* snippets/curve_rectangle.cairo: Fix clash between global width
and height parameters and rectangle width and height.
Index: curve_rectangle.cairo
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/snippets/curve_rectangle.cairo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- curve_rectangle.cairo 1 Feb 2005 22:58:09 -0000 1.1
+++ curve_rectangle.cairo 2 Feb 2005 04:46:43 -0000 1.2
@@ -1,20 +1,20 @@
/* a custom shape, that could be wrapped in a function */
-double x0 = 0.1, /*< parameters like cairo_rectangle */
- y0 = 0.1,
- width = 0.8,
- height = 0.8,
+double x0 = 0.1, /*< parameters like cairo_rectangle */
+ y0 = 0.1,
+ rect_width = 0.8,
+ rect_height = 0.8,
radius = 0.4; /*< and an approximate curvature radius */
double x1,y1;
snippet_normalize (cr, width, height);
-x1=x0+width;
-y1=y0+height;
-if (!width || !height)
+x1=x0+rect_width;
+y1=y0+rect_height;
+if (!rect_width || !rect_height)
return;
-if (width/2<radius) {
- if (height/2<radius) {
+if (rect_width/2<radius) {
+ if (rect_height/2<radius) {
cairo_move_to (cr, x0, (y0 + y1)/2);
cairo_curve_to (cr, x0 ,y0, x0, y0, (x0 + x1)/2, y0);
cairo_curve_to (cr, x1, y0, x1, y0, x1, (y0 + y1)/2);
@@ -29,7 +29,7 @@
cairo_curve_to (cr, x0, y1, x0, y1, x0, y1- radius);
}
} else {
- if (height/2<radius) {
+ if (rect_height/2<radius) {
cairo_move_to (cr, x0, (y0 + y1)/2);
cairo_curve_to (cr, x0 , y0, x0 , y0, x0 + radius, y0);
cairo_line_to (cr, x1 - radius, y0);
More information about the cairo-commit
mailing list