[cairo-commit] cairo/src cairo-font-subset.c, 1.3, 1.4 cairo-font.c, 1.60, 1.61 cairo-ft-font.c, 1.87, 1.88 cairo-glitz-surface.c, 1.54, 1.55 cairo-gstate.c, 1.153, 1.154 cairo-image-surface.c, 1.54, 1.55 cairo-meta-surface.c, 1.5, 1.6 cairo-pattern.c, 1.52, 1.53 cairo-pdf-surface.c, 1.54, 1.55 cairo-surface.c, 1.86, 1.87 cairo-xcb-surface.c, 1.44, 1.45 cairo-xlib-surface.c, 1.103, 1.104 cairo.c, 1.117, 1.118 cairo.h, 1.144, 1.145 cairoint.h, 1.177, 1.178

Kristian Hogsberg commit at pdx.freedesktop.org
Thu Aug 4 18:44:31 PDT 2005


Committed by: krh

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

Modified Files:
	cairo-font-subset.c cairo-font.c cairo-ft-font.c 
	cairo-glitz-surface.c cairo-gstate.c cairo-image-surface.c 
	cairo-meta-surface.c cairo-pattern.c cairo-pdf-surface.c 
	cairo-surface.c cairo-xcb-surface.c cairo-xlib-surface.c 
	cairo.c cairo.h cairoint.h 
Log Message:
2005-08-04  Kristian Høgsberg  <krh at redhat.com>

        * src/cairo-font.c: (cairo_font_face_reference),
        (_cairo_unscaled_font_reference), (cairo_scaled_font_reference):
        * src/cairo-gstate.c: (_cairo_clip_path_reference):
        * src/cairo-pattern.c: (cairo_pattern_reference):
        * src/cairo-pdf-surface.c: (_cairo_pdf_document_reference):
        * src/cairo-surface.c: (cairo_surface_reference):
        * src/cairo.c: (cairo_reference):
        * src/cairo.h:
        * src/cairoint.h:
        Change *_reference() functions to return the object being
        referenced.



Index: cairo-font-subset.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-font-subset.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cairo-font-subset.c	4 Aug 2005 20:22:19 -0000	1.3
+++ cairo-font-subset.c	5 Aug 2005 01:44:29 -0000	1.4
@@ -158,8 +158,7 @@
     if (font == NULL)
 	return NULL;
 
-    font->base.unscaled_font = unscaled_font;
-    _cairo_unscaled_font_reference (unscaled_font);
+    font->base.unscaled_font = _cairo_unscaled_font_reference (unscaled_font);
     font->base.backend = &cairo_pdf_ft_font_backend;
 
     _cairo_array_init (&font->output, sizeof (char));

Index: cairo-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-font.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- cairo-font.c	1 Aug 2005 20:33:47 -0000	1.60
+++ cairo-font.c	5 Aug 2005 01:44:29 -0000	1.61
@@ -72,17 +72,21 @@
  * Increases the reference count on @font_face by one. This prevents
  * @font_face from being destroyed until a matching call to
  * cairo_font_face_destroy() is made.
+ *
+ * Return value: the referenced #cairo_font_face_t.
  **/
-void
+cairo_font_face_t *
 cairo_font_face_reference (cairo_font_face_t *font_face)
 {
     if (font_face == NULL)
-	return;
+	return NULL;
 
     if (font_face->ref_count == (unsigned int)-1)
-	return;
+	return font_face;
 
     font_face->ref_count++;
+
+    return font_face;
 }
 
 /**
@@ -999,13 +1003,15 @@
     unscaled_font->backend = backend;
 }
 
-void
+cairo_unscaled_font_t *
 _cairo_unscaled_font_reference (cairo_unscaled_font_t *unscaled_font)
 {
     if (unscaled_font == NULL)
-	return;
+	return NULL;
 
     unscaled_font->ref_count++;
+
+    return unscaled_font;
 }
 
 void
@@ -1034,17 +1040,21 @@
  * Increases the reference count on @scaled_font by one. This prevents
  * @scaled_font from being destroyed until a matching call to
  * cairo_scaled_font_destroy() is made.
+ *
+ * Return value: the referenced #cairo_scaled_font_t.
  **/
-void
+cairo_scaled_font_t *
 cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font)
 {
     if (scaled_font == NULL)
-	return;
+	return NULL;
 
     if (scaled_font->ref_count == (unsigned int)-1)
-	return;
+	return scaled_font;
 
     scaled_font->ref_count++;
+
+    return scaled_font;
 }
 
 /**

Index: cairo-ft-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ft-font.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- cairo-ft-font.c	4 Aug 2005 20:22:19 -0000	1.87
+++ cairo-ft-font.c	5 Aug 2005 01:44:29 -0000	1.88
@@ -2141,10 +2141,8 @@
 
     /* Looked for an existing matching font face */
     for (font_face = unscaled->faces; font_face; font_face = font_face->next_face) {
-	if (font_face->load_flags == load_flags) {
-	    cairo_font_face_reference (&font_face->base);
-	    return &font_face->base;
-	}
+	if (font_face->load_flags == load_flags)
+	    return cairo_font_face_reference (&font_face->base);
     }
 
     /* No match found, create a new one */

Index: cairo-glitz-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-glitz-surface.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- cairo-glitz-surface.c	28 Jul 2005 16:46:38 -0000	1.54
+++ cairo-glitz-surface.c	5 Aug 2005 01:44:29 -0000	1.55
@@ -349,8 +349,7 @@
 
     if (src->backend == surface->base.backend)
     {
-	*clone_out = src;
-	cairo_surface_reference (src);
+	*clone_out = cairo_surface_reference (src);	
 	
 	return CAIRO_STATUS_SUCCESS;
     }

Index: cairo-gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate.c,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -d -r1.153 -r1.154
--- cairo-gstate.c	1 Aug 2005 21:39:01 -0000	1.153
+++ cairo-gstate.c	5 Aug 2005 01:44:29 -0000	1.154
@@ -67,7 +67,7 @@
 static void
 _cairo_rectangle_intersect (cairo_rectangle_t *dest, cairo_rectangle_t *src);
 
-static void
+static cairo_clip_path_t *
 _cairo_clip_path_reference (cairo_clip_path_t *clip_path);
 
 static void
@@ -132,8 +132,7 @@
 
     _cairo_pen_init_empty (&gstate->pen_regular);
 
-    gstate->target = target;
-    cairo_surface_reference (gstate->target);
+    gstate->target = cairo_surface_reference (target);
 
     gstate->source = _cairo_pattern_create_solid (CAIRO_COLOR_BLACK);
     if (gstate->source->status)
@@ -1654,13 +1653,15 @@
     return CAIRO_STATUS_SUCCESS;
 }
 
-static void
+static cairo_clip_path_t *
 _cairo_clip_path_reference (cairo_clip_path_t *clip_path)
 {
     if (clip_path == NULL)
-	return;
+	return NULL;
 
     clip_path->ref_count++;
+
+    return clip_path;
 }
 
 static void

Index: cairo-image-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-image-surface.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- cairo-image-surface.c	28 Jul 2005 17:47:40 -0000	1.54
+++ cairo-image-surface.c	5 Aug 2005 01:44:29 -0000	1.55
@@ -408,8 +408,7 @@
     cairo_image_surface_t *surface = abstract_surface;
 
     if (src->backend == surface->base.backend) {
-	*clone_out = src;
-	cairo_surface_reference (src);
+	*clone_out = cairo_surface_reference (src);
 
 	return CAIRO_STATUS_SUCCESS;
     }	

Index: cairo-meta-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-meta-surface.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- cairo-meta-surface.c	27 Jul 2005 22:39:35 -0000	1.5
+++ cairo-meta-surface.c	5 Aug 2005 01:44:29 -0000	1.6
@@ -387,8 +387,7 @@
 	return CAIRO_STATUS_NO_MEMORY;
 
     command->type = CAIRO_COMMAND_SHOW_GLYPHS;
-    command->scaled_font = scaled_font;
-    cairo_scaled_font_reference (scaled_font);
+    command->scaled_font = cairo_scaled_font_reference (scaled_font);
     command->operator = operator;
     _cairo_pattern_init_copy (&command->pattern.base, pattern);
     command->source_x = source_x;

Index: cairo-pattern.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pattern.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- cairo-pattern.c	28 Jul 2005 16:46:38 -0000	1.52
+++ cairo-pattern.c	5 Aug 2005 01:44:29 -0000	1.53
@@ -236,8 +236,7 @@
 {
     _cairo_pattern_init (&pattern->base, CAIRO_PATTERN_SURFACE);
     
-    pattern->surface = surface;
-    cairo_surface_reference (surface);
+    pattern->surface = cairo_surface_reference (surface);
 }
 
 static void
@@ -489,17 +488,21 @@
  * Increases the reference count on @pattern by one. This prevents
  * @pattern from being destroyed until a matching call to
  * cairo_pattern_destroy() is made.
+ *
+ * Return value: the referenced #cairo_pattern_t.
  **/
-void
+cairo_pattern_t *
 cairo_pattern_reference (cairo_pattern_t *pattern)
 {
     if (pattern == NULL)
-	return;
+	return NULL;
 
     if (pattern->ref_count == (unsigned int)-1)
-	return;
+	return pattern;
 
     pattern->ref_count++;
+
+    return pattern;
 }
 
 /**

Index: cairo-pdf-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pdf-surface.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- cairo-pdf-surface.c	27 Jul 2005 22:39:35 -0000	1.54
+++ cairo-pdf-surface.c	5 Aug 2005 01:44:29 -0000	1.55
@@ -159,7 +159,7 @@
 static cairo_status_t
 _cairo_pdf_document_finish (cairo_pdf_document_t *document);
 
-static void
+static cairo_pdf_document_t *
 _cairo_pdf_document_reference (cairo_pdf_document_t *document);
 
 static unsigned int
@@ -365,8 +365,7 @@
     surface->width = width;
     surface->height = height;
 
-    _cairo_pdf_document_reference (document);
-    surface->document = document;
+    surface->document = _cairo_pdf_document_reference (document);
     _cairo_array_init (&surface->streams, sizeof (cairo_pdf_stream_t *));
     _cairo_array_init (&surface->patterns, sizeof (cairo_pdf_resource_t));
     _cairo_array_init (&surface->xobjects, sizeof (cairo_pdf_resource_t));
@@ -1658,10 +1657,12 @@
     return offset;
 }
 
-static void
+static cairo_pdf_document_t *
 _cairo_pdf_document_reference (cairo_pdf_document_t *document)
 {
     document->ref_count++;
+
+    return document;
 }
 
 static void

Index: cairo-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-surface.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- cairo-surface.c	1 Aug 2005 18:45:42 -0000	1.86
+++ cairo-surface.c	5 Aug 2005 01:44:29 -0000	1.87
@@ -245,18 +245,38 @@
 	return CAIRO_CLIP_MODE_MASK;
 }
 
-void
+/**
+ * cairo_surface_reference:
+ * @surface: a #cairo_surface_t
+ * 
+ * Increases the reference count on @surface by one. This prevents
+ * @surface from being destroyed until a matching call to
+ * cairo_surface_destroy() is made.
+ *
+ * Return value: the referenced #cairo_surface_t.
+ **/
+cairo_surface_t *
 cairo_surface_reference (cairo_surface_t *surface)
 {
     if (surface == NULL)
-	return;
+	return NULL;
 
     if (surface->ref_count == (unsigned int)-1)
-	return;
+	return surface;
 
     surface->ref_count++;
+
+    return surface;
 }
 
+/**
+ * cairo_surface_destroy:
+ * @surface: a #cairo_t
+ * 
+ * Decreases the reference count on @surface by one. If the result is
+ * zero, then @surface and all associated resources are freed.  See
+ * cairo_surface_reference().
+ **/
 void
 cairo_surface_destroy (cairo_surface_t *surface)
 {

Index: cairo-xcb-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-xcb-surface.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- cairo-xcb-surface.c	28 Jul 2005 17:02:54 -0000	1.44
+++ cairo-xcb-surface.c	5 Aug 2005 01:44:29 -0000	1.45
@@ -643,8 +643,7 @@
 	cairo_xcb_surface_t *xcb_src = (cairo_xcb_surface_t *)src;
 
 	if (xcb_src->dpy == surface->dpy) {
-	    *clone_out = src;
-	    cairo_surface_reference (src);
+	    *clone_out = cairo_surface_reference (src);
 	    
 	    return CAIRO_STATUS_SUCCESS;
 	}

Index: cairo-xlib-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-xlib-surface.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- cairo-xlib-surface.c	4 Aug 2005 22:53:30 -0000	1.103
+++ cairo-xlib-surface.c	5 Aug 2005 01:44:29 -0000	1.104
@@ -670,8 +670,7 @@
 	cairo_xlib_surface_t *xlib_src = (cairo_xlib_surface_t *)src;
 
 	if (_cairo_xlib_surface_same_screen (surface, xlib_src)) {
-	    *clone_out = src;
-	    cairo_surface_reference (src);
+	    *clone_out = cairo_surface_reference (src);
 	    
 	    return CAIRO_STATUS_SUCCESS;
 	}

Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- cairo.c	28 Jul 2005 17:41:08 -0000	1.117
+++ cairo.c	5 Aug 2005 01:44:29 -0000	1.118
@@ -178,14 +178,18 @@
  * Increases the reference count on @cr by one. This prevents
  * @cr from being destroyed until a matching call to cairo_destroy() 
  * is made.
+ *
+ * Return value: the referenced #cairo_t.
  **/
-void
+cairo_t *
 cairo_reference (cairo_t *cr)
 {
     if (cr->ref_count == (unsigned int)-1)
-	return;
+	return cr;
     
     cr->ref_count++;
+
+    return cr;
 }
 
 /**

Index: cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -d -r1.144 -r1.145
--- cairo.h	1 Aug 2005 20:33:47 -0000	1.144
+++ cairo.h	5 Aug 2005 01:44:29 -0000	1.145
@@ -222,7 +222,7 @@
 cairo_t *
 cairo_create (cairo_surface_t *target);
 
-void
+cairo_t *
 cairo_reference (cairo_t *cr);
 
 void
@@ -863,7 +863,7 @@
 
 /* Generic identifier for a font style */
 
-void
+cairo_font_face_t *
 cairo_font_face_reference (cairo_font_face_t *font_face);
 
 void
@@ -890,7 +890,7 @@
 			  const cairo_matrix_t       *ctm,
 			  const cairo_font_options_t *options);
 
-void
+cairo_scaled_font_t *
 cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font);
 
 void
@@ -1101,7 +1101,7 @@
 			      int		width,
 			      int		height);
 
-void
+cairo_surface_t *
 cairo_surface_reference (cairo_surface_t *surface);
 
 void
@@ -1241,7 +1241,7 @@
 cairo_pattern_create_radial (double cx0, double cy0, double radius0,
 			     double cx1, double cy1, double radius1);
 
-void
+cairo_pattern_t *
 cairo_pattern_reference (cairo_pattern_t *pattern);
 
 void

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.177
retrieving revision 1.178
diff -u -d -r1.177 -r1.178
--- cairoint.h	1 Aug 2005 20:33:47 -0000	1.177
+++ cairoint.h	5 Aug 2005 01:44:29 -0000	1.178
@@ -1353,7 +1353,7 @@
 _cairo_unscaled_font_init (cairo_unscaled_font_t               *font, 
 			   const cairo_unscaled_font_backend_t *backend);
 
-cairo_private void
+cairo_private cairo_unscaled_font_t *
 _cairo_unscaled_font_reference (cairo_unscaled_font_t *font);
 
 cairo_private void




More information about the cairo-commit mailing list