[cairo-commit] cairo/src cairo-meta-surface.c, 1.1, 1.2 cairo-output-stream.c, 1.6, 1.7 cairo-ps-surface.c, 1.37, 1.38 cairo-surface.c, 1.76, 1.77 cairoint.h, 1.159, 1.160

Kristian Hogsberg commit at pdx.freedesktop.org
Fri Jul 1 12:45:38 PDT 2005


Committed by: krh

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

Modified Files:
	cairo-meta-surface.c cairo-output-stream.c cairo-ps-surface.c 
	cairo-surface.c cairoint.h 
Log Message:
2005-07-01  Kristian Høgsberg  <krh at redhat.com>

        * src/cairo-ps-surface.c: Rewrite postscript backend to generate
        more interesting output than the current big-image implementation,
        using meta surfaces for font subsetting and image fallbacks.

        * src/cairo-meta-surface.c: Remove obsolete comment.

        * src/cairoint.h:
        * src/cairo-output-stream.c: Make a couple of stylistic changes
        and add _cairo_output_stream_write_hex_string.

        * src/cairo-surface.c: Add _cairo_surface_intersect_clip_path so
        we can replay path clipping.



Index: cairo-meta-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-meta-surface.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cairo-meta-surface.c	1 Jul 2005 19:22:23 -0000	1.1
+++ cairo-meta-surface.c	1 Jul 2005 19:45:35 -0000	1.2
@@ -43,12 +43,6 @@
  * fallbacks.  For example, when determining the font subsets or the
  * fallback areas.  Hmm... but maybe those passes could be integrated
  * into the delegation wrappers and the ps output pass, respectively.
- *
- * Don't want to mark a valid NULL pattern as a error object, which is
- * what we do if we set pattern->status = CAIRO_STATUS_NULL_POINTER.
- * We could make a CAIRO_PATTERN_TYPE_NULL alternatively.  Btw. what
- * about a CAIRO_PATTERN_TYPE_ERROR for pattern->status !=
- * CAIRO_STATUS_SUCCESS cases?
  */
 
 static const cairo_surface_backend_t cairo_meta_surface_backend;

Index: cairo-output-stream.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-output-stream.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- cairo-output-stream.c	17 May 2005 19:40:55 -0000	1.6
+++ cairo-output-stream.c	1 Jul 2005 19:45:35 -0000	1.7
@@ -90,6 +90,26 @@
     return stream->status;
 }
 
+void
+_cairo_output_stream_write_hex_string (cairo_output_stream_t *stream,
+				       const char *data,
+				       size_t length)
+{
+    const char hex_chars[] = "0123456789abcdef";
+    char buffer[2];
+    int i, column;
+
+    for (i = 0, column = 0; i < length; i++, column++) {
+	if (column == 38) {
+	    _cairo_output_stream_write (stream, "\n", 1);
+	    column = 0;
+	}
+	buffer[0] = hex_chars[(data[i] >> 4) & 0x0f];
+	buffer[1] = hex_chars[data[i] & 0x0f];
+	_cairo_output_stream_write (stream, buffer, 2);
+    }
+}
+
 /* Format a double in a locale independent way and trim trailing
  * zeros.  Based on code from Alex Larson <alexl at redhat.com>.
  * http://mail.gnome.org/archives/gtk-devel-list/2001-October/msg00087.html
@@ -187,8 +207,8 @@
 
 	switch (*f | length_modifier) {
 	case '%':
-	    p[0] = *f;
-	    p[1] = 0;
+	    buffer[0] = *f;
+	    buffer[1] = 0;
 	    break;
 	case 'd':
 	    snprintf (buffer, sizeof buffer, "%d", va_arg (ap, int));
@@ -211,6 +231,10 @@
 	case 'f':
 	    dtostr (buffer, sizeof buffer, va_arg (ap, double));
 	    break;
+	case 'c':
+	    buffer[0] = va_arg (ap, int);
+	    buffer[1] = 0;
+	    break;
 	default:
 	    ASSERT_NOT_REACHED;
 	}

Index: cairo-ps-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ps-surface.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- cairo-ps-surface.c	15 Jun 2005 02:45:23 -0000	1.37
+++ cairo-ps-surface.c	1 Jul 2005 19:45:35 -0000	1.38
@@ -1,6 +1,7 @@
 /* cairo - a vector graphics library with display and print output
  *
  * Copyright © 2003 University of Southern California
+ * Copyright © 2005 Red Hat, Inc
  *
  * This library is free software; you can redistribute it and/or
  * modify it either under the terms of the GNU Lesser General Public
@@ -32,14 +33,27 @@
  *
  * Contributor(s):
  *	Carl D. Worth <cworth at cworth.org>
[...1375 lines suppressed...]
+    _ps_locate_fallbacks_fill_rectangles,
+    _ps_locate_fallbacks_composite_trapezoids,
+    NULL, /* copy_page */
+    NULL, /* show_page */
+    NULL, /* set_clip_region */
     NULL, /* intersect_clip_path */
-    _cairo_ps_surface_get_extents,
-    NULL /* show_glyphs */
+    NULL, /* get_extents */
+    _ps_locate_fallbacks_show_glyphs,
+    _ps_locate_fallbacks_fill_path
 };
+
+
+static cairo_int_status_t
+_cairo_ps_surface_render_fallbacks (cairo_ps_surface_t *surface,
+				    cairo_surface_t    *page)
+{
+    return CAIRO_STATUS_SUCCESS;
+}

Index: cairo-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-surface.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- cairo-surface.c	17 Jun 2005 20:25:19 -0000	1.76
+++ cairo-surface.c	1 Jul 2005 19:45:35 -0000	1.77
@@ -889,6 +889,23 @@
     return surface->backend->set_clip_region (surface, region);
 }
 
+cairo_private cairo_int_status_t
+_cairo_surface_intersect_clip_path (cairo_surface_t    *surface,
+				    cairo_path_fixed_t *path,
+				    cairo_fill_rule_t   fill_rule,
+				    double		tolerance)
+{
+    if (surface->finished)
+	return CAIRO_STATUS_SURFACE_FINISHED;
+    
+    assert (surface->backend->intersect_clip_path != NULL);
+
+    return surface->backend->intersect_clip_path (surface,
+						  path,
+						  fill_rule,
+						  tolerance);
+}
+
 static cairo_status_t
 _cairo_surface_set_clip_path_recursive (cairo_surface_t *surface,
 					cairo_clip_path_t *clip_path)

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- cairoint.h	29 Jun 2005 14:04:34 -0000	1.159
+++ cairoint.h	1 Jul 2005 19:45:35 -0000	1.160
@@ -1543,6 +1543,12 @@
 				pixman_region16_t   *region,
 				unsigned int	    serial);
 
+cairo_private cairo_int_status_t
+_cairo_surface_intersect_clip_path (cairo_surface_t    *surface,
+				    cairo_path_fixed_t *path,
+				    cairo_fill_rule_t   fill_rule,
+				    double		tolerance);
+
 typedef struct _cairo_clip_path cairo_clip_path_t;
 
 cairo_private cairo_status_t
@@ -1830,6 +1836,11 @@
 _cairo_output_stream_write (cairo_output_stream_t *stream,
 			    const void *data, size_t length);
 
+cairo_private void
+_cairo_output_stream_write_hex_string (cairo_output_stream_t *stream,
+				       const char *data,
+				       size_t length);
+
 cairo_private cairo_status_t
 _cairo_output_stream_vprintf (cairo_output_stream_t *stream,
 			      const char *fmt, va_list ap);




More information about the cairo-commit mailing list