[cairo-commit] cairo/src Makefile.am, 1.66, 1.67 cairo-gstate.c, 1.180, 1.181 cairo-stroke-style.c, NONE, 1.1 cairoint.h, 1.225, 1.226

Carl Worth commit at pdx.freedesktop.org
Mon Nov 7 09:49:54 PST 2005


Committed by: cworth

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv31603/src

Modified Files:
	Makefile.am cairo-gstate.c cairoint.h 
Added Files:
	cairo-stroke-style.c 
Log Message:

2005-11-07  Carl Worth  <cworth at cworth.org>

        * src/Makefile.am:
        * src/cairoint.h:
        * src/cairo-stroke-style.c: (_cairo_stroke_style_init),
        (_cairo_stroke_style_init_copy), (_cairo_stroke_style_fini): Add
        functions to initialize and copy cairo_stroke_style_t objects.

        * src/cairo-gstate.c: (_cairo_gstate_init),
        (_cairo_gstate_init_copy), (_cairo_gstate_fini): Use new
        _cairo_stroke_style functions rather than direct modification.

        * src/cairoint.h: Add missing prototype for
        _cairo_font_options_init_copy.


Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/cairo/src/Makefile.am,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- Makefile.am	19 Sep 2005 21:14:03 -0000	1.66
+++ Makefile.am	7 Nov 2005 17:49:52 -0000	1.67
@@ -125,6 +125,7 @@
 	cairo-scaled-font.c			\
 	cairo-slope.c				\
 	cairo-spline.c				\
+	cairo-stroke-style.c			\
 	cairo-surface.c				\
 	cairo-traps.c				\
 	cairo-pattern.c				\

Index: cairo-gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate.c,v
retrieving revision 1.180
retrieving revision 1.181
diff -u -d -r1.180 -r1.181
--- cairo-gstate.c	7 Nov 2005 17:30:38 -0000	1.180
+++ cairo-gstate.c	7 Nov 2005 17:49:52 -0000	1.181
@@ -102,13 +102,7 @@
     gstate->tolerance = CAIRO_GSTATE_TOLERANCE_DEFAULT;
     gstate->antialias = CAIRO_ANTIALIAS_DEFAULT;
 
-    gstate->stroke_style.line_width = CAIRO_GSTATE_LINE_WIDTH_DEFAULT;
-    gstate->stroke_style.line_cap = CAIRO_GSTATE_LINE_CAP_DEFAULT;
-    gstate->stroke_style.line_join = CAIRO_GSTATE_LINE_JOIN_DEFAULT;
-    gstate->stroke_style.miter_limit = CAIRO_GSTATE_MITER_LIMIT_DEFAULT;
-    gstate->stroke_style.dash = NULL;
-    gstate->stroke_style.num_dashes = 0;
-    gstate->stroke_style.dash_offset = 0.0;
+    _cairo_stroke_style_init (&gstate->stroke_style);
 
     gstate->fill_rule = CAIRO_GSTATE_FILL_RULE_DEFAULT;
 
@@ -147,6 +141,7 @@
 static cairo_status_t
 _cairo_gstate_init_copy (cairo_gstate_t *gstate, cairo_gstate_t *other)
 {
+    cairo_status_t status;
     cairo_gstate_t *next;
     
     /* Copy all members, but don't smash the next pointer */
@@ -154,14 +149,10 @@
     *gstate = *other;
     gstate->next = next;
 
-    /* Now fix up pointer data that needs to be cloned/referenced */
-    if (other->stroke_style.dash) {
-	gstate->stroke_style.dash = malloc (other->stroke_style.num_dashes * sizeof (double));
-	if (gstate->stroke_style.dash == NULL)
-	    return CAIRO_STATUS_NO_MEMORY;
-	memcpy (gstate->stroke_style.dash, other->stroke_style.dash,
-		other->stroke_style.num_dashes * sizeof (double));
-    }
+    status = _cairo_stroke_style_init_copy (&gstate->stroke_style,
+					    &other->stroke_style);
+    if (status)
+	return status;
 
     _cairo_clip_init_copy (&gstate->clip, &other->clip);
 
@@ -196,10 +187,7 @@
 
     cairo_pattern_destroy (gstate->source);
 
-    if (gstate->stroke_style.dash) {
-	free (gstate->stroke_style.dash);
-	gstate->stroke_style.dash = NULL;
-    }
+    _cairo_stroke_style_fini (&gstate->stroke_style);
 }
 
 void

--- NEW FILE: cairo-stroke-style.c ---
(This appears to be a binary file; contents omitted.)

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.225
retrieving revision 1.226
diff -u -d -r1.225 -r1.226
--- cairoint.h	7 Nov 2005 17:33:38 -0000	1.225
+++ cairoint.h	7 Nov 2005 17:49:52 -0000	1.226
@@ -1358,6 +1358,10 @@
 cairo_private void
 _cairo_font_options_init_default (cairo_font_options_t *options);
 
+cairo_private void
+_cairo_font_options_init_copy (cairo_font_options_t		*options,
+			       const cairo_font_options_t	*other);
+
 /* cairo_hull.c */
 cairo_private cairo_status_t
 _cairo_hull_compute (cairo_pen_vertex_t *vertices, int *num_vertices);
@@ -1551,6 +1555,18 @@
 cairo_private void
 _cairo_scaled_font_map_destroy (void);
 
+/* cairo-stroke-style.c */
+
+cairo_private void
+_cairo_stroke_style_init (cairo_stroke_style_t *style);
+
+cairo_private cairo_status_t
+_cairo_stroke_style_init_copy (cairo_stroke_style_t *style,
+			       cairo_stroke_style_t *other);
+
+cairo_private void
+_cairo_stroke_style_fini (cairo_stroke_style_t *style);
+
 /* cairo-surface.c */
 
 extern const cairo_private cairo_surface_t _cairo_surface_nil;



More information about the cairo-commit mailing list